Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: third_party/harfbuzz-ng/src/hb-uniscribe.cc

Issue 475363002: Roll HarfBuzz to 0.9.35 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows build fix attempt Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-uniscribe.h ('k') | third_party/harfbuzz-ng/src/hb-version.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright © 2011,2012,2013 Google, Inc. 2 * Copyright © 2011,2012,2013 Google, Inc.
3 * 3 *
4 * This is part of HarfBuzz, a text shaping library. 4 * This is part of HarfBuzz, a text shaping library.
5 * 5 *
6 * Permission is hereby granted, without written agreement and without 6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this 7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the 8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in 9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software. 10 * all copies of this software.
11 * 11 *
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16 * DAMAGE. 16 * DAMAGE.
17 * 17 *
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23 * 23 *
24 * Google Author(s): Behdad Esfahbod 24 * Google Author(s): Behdad Esfahbod
25 */ 25 */
26 26
27 #define _WIN32_WINNT 0x0600
28 #define WIN32_LEAN_AND_MEAN
29
30 #define HB_SHAPER uniscribe 27 #define HB_SHAPER uniscribe
31 #include "hb-shaper-impl-private.hh" 28 #include "hb-shaper-impl-private.hh"
32 29
33 #include <windows.h> 30 #include <windows.h>
34 #include <usp10.h> 31 #include <usp10.h>
35 #include <rpc.h> 32 #include <rpc.h>
36 33
37 #include "hb-uniscribe.h" 34 #include "hb-uniscribe.h"
38 35
39 #include "hb-open-file-private.hh" 36 #include "hb-open-file-private.hh"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 if (unlikely (!funcs)) 238 if (unlikely (!funcs))
242 return NULL; 239 return NULL;
243 240
244 funcs->init (); 241 funcs->init ();
245 242
246 if (!hb_atomic_ptr_cmpexch (&uniscribe_funcs, NULL, funcs)) { 243 if (!hb_atomic_ptr_cmpexch (&uniscribe_funcs, NULL, funcs)) {
247 free (funcs); 244 free (funcs);
248 goto retry; 245 goto retry;
249 } 246 }
250 247
251 #ifdef HAVE_ATEXIT 248 #ifdef HB_USE_ATEXIT
252 atexit (free_uniscribe_funcs); /* First person registers atexit() callback. */ 249 atexit (free_uniscribe_funcs); /* First person registers atexit() callback. */
253 #endif 250 #endif
254 } 251 }
255 252
256 return funcs; 253 return funcs;
257 } 254 }
258 255
259 256
260 struct active_feature_t { 257 struct active_feature_t {
261 OPENTYPE_FEATURE_RECORD rec; 258 OPENTYPE_FEATURE_RECORD rec;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 303
307 /* face_name should point to a wchar_t[LF_FACESIZE] object. */ 304 /* face_name should point to a wchar_t[LF_FACESIZE] object. */
308 static void 305 static void
309 _hb_generate_unique_face_name (wchar_t *face_name, unsigned int *plen) 306 _hb_generate_unique_face_name (wchar_t *face_name, unsigned int *plen)
310 { 307 {
311 /* We'll create a private name for the font from a UUID using a simple, 308 /* We'll create a private name for the font from a UUID using a simple,
312 * somewhat base64-like encoding scheme */ 309 * somewhat base64-like encoding scheme */
313 const char *enc = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456 789+-"; 310 const char *enc = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456 789+-";
314 UUID id; 311 UUID id;
315 UuidCreate ((UUID*) &id); 312 UuidCreate ((UUID*) &id);
313 ASSERT_STATIC (2 + 3 * (16/2) < LF_FACESIZE);
316 unsigned int name_str_len = 0; 314 unsigned int name_str_len = 0;
317 face_name[name_str_len++] = 'F'; 315 face_name[name_str_len++] = 'F';
318 face_name[name_str_len++] = '_'; 316 face_name[name_str_len++] = '_';
319 unsigned char *p = (unsigned char *) &id; 317 unsigned char *p = (unsigned char *) &id;
320 for (unsigned int i = 0; i < 16; i += 2) 318 for (unsigned int i = 0; i < 16; i += 2)
321 { 319 {
322 /* Spread the 16 bits from two bytes of the UUID across three chars of face_ name, 320 /* Spread the 16 bits from two bytes of the UUID across three chars of face_ name,
323 * using the bits in groups of 5,5,6 to select chars from enc. 321 * using the bits in groups of 5,5,6 to select chars from enc.
324 * This will generate 24 characters; with the 'F_' prefix we already provide d, 322 * This will generate 24 characters; with the 'F_' prefix we already provide d,
325 * the name will be 26 chars (plus the NUL terminator), so will always fit w ithin 323 * the name will be 26 chars (plus the NUL terminator), so will always fit w ithin
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 log_clusters + chars_offset, 896 log_clusters + chars_offset,
899 char_props + chars_offset, 897 char_props + chars_offset,
900 glyphs + glyphs_offset, 898 glyphs + glyphs_offset,
901 glyph_props + glyphs_offset, 899 glyph_props + glyphs_offset,
902 (int *) &glyphs_len); 900 (int *) &glyphs_len);
903 901
904 if (unlikely (items[i].a.fNoGlyphIndex)) 902 if (unlikely (items[i].a.fNoGlyphIndex))
905 FAIL ("ScriptShapeOpenType() set fNoGlyphIndex"); 903 FAIL ("ScriptShapeOpenType() set fNoGlyphIndex");
906 if (unlikely (hr == E_OUTOFMEMORY)) 904 if (unlikely (hr == E_OUTOFMEMORY))
907 { 905 {
908 buffer->ensure (buffer->allocated * 2); 906 if (unlikely (!buffer->ensure (buffer->allocated * 2)))
909 if (buffer->in_error)
910 FAIL ("Buffer resize failed"); 907 FAIL ("Buffer resize failed");
911 goto retry; 908 goto retry;
912 } 909 }
913 if (unlikely (hr == USP_E_SCRIPT_NOT_IN_FONT)) 910 if (unlikely (hr == USP_E_SCRIPT_NOT_IN_FONT))
914 { 911 {
915 if (items[i].a.eScript == SCRIPT_UNDEFINED) 912 if (items[i].a.eScript == SCRIPT_UNDEFINED)
916 FAIL ("ScriptShapeOpenType() failed: Font doesn't support script"); 913 FAIL ("ScriptShapeOpenType() failed: Font doesn't support script");
917 items[i].a.eScript = SCRIPT_UNDEFINED; 914 items[i].a.eScript = SCRIPT_UNDEFINED;
918 goto retry_shape; 915 goto retry_shape;
919 } 916 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 for (unsigned int i = 0; i < buffer->len; i++) { 965 for (unsigned int i = 0; i < buffer->len; i++) {
969 uint32_t *p = &vis_clusters[log_clusters[buffer->info[i].utf16_index()]]; 966 uint32_t *p = &vis_clusters[log_clusters[buffer->info[i].utf16_index()]];
970 *p = MIN (*p, buffer->info[i].cluster); 967 *p = MIN (*p, buffer->info[i].cluster);
971 } 968 }
972 for (unsigned int i = 1; i < glyphs_len; i++) 969 for (unsigned int i = 1; i < glyphs_len; i++)
973 if (vis_clusters[i] == -1) 970 if (vis_clusters[i] == -1)
974 vis_clusters[i] = vis_clusters[i - 1]; 971 vis_clusters[i] = vis_clusters[i - 1];
975 972
976 #undef utf16_index 973 #undef utf16_index
977 974
978 buffer->ensure (glyphs_len); 975 if (unlikely (!buffer->ensure (glyphs_len)))
979 if (buffer->in_error)
980 FAIL ("Buffer in error"); 976 FAIL ("Buffer in error");
981 977
982 #undef FAIL 978 #undef FAIL
983 979
984 /* Set glyph infos */ 980 /* Set glyph infos */
985 buffer->len = 0; 981 buffer->len = 0;
986 for (unsigned int i = 0; i < glyphs_len; i++) 982 for (unsigned int i = 0; i < glyphs_len; i++)
987 { 983 {
988 hb_glyph_info_t *info = &buffer->info[buffer->len++]; 984 hb_glyph_info_t *info = &buffer->info[buffer->len++];
989 985
(...skipping 20 matching lines...) Expand all
1010 } 1006 }
1011 1007
1012 if (backward) 1008 if (backward)
1013 hb_buffer_reverse (buffer); 1009 hb_buffer_reverse (buffer);
1014 1010
1015 /* Wow, done! */ 1011 /* Wow, done! */
1016 return true; 1012 return true;
1017 } 1013 }
1018 1014
1019 1015
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-uniscribe.h ('k') | third_party/harfbuzz-ng/src/hb-version.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698