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

Side by Side Diff: third_party/harfbuzz-ng/src/hb-ot-shape-complex-use.cc

Issue 2163983005: Roll HarfBuzz to 1.3.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright © 2015 Mozilla Foundation. 2 * Copyright © 2015 Mozilla Foundation.
3 * Copyright © 2015 Google, Inc. 3 * Copyright © 2015 Google, Inc.
4 * 4 *
5 * This is part of HarfBuzz, a text shaping library. 5 * This is part of HarfBuzz, a text shaping library.
6 * 6 *
7 * Permission is hereby granted, without written agreement and without 7 * Permission is hereby granted, without written agreement and without
8 * license or royalty fees, to use, copy, modify, and distribute this 8 * license or royalty fees, to use, copy, modify, and distribute this
9 * software and its documentation for any purpose, provided that the 9 * software and its documentation for any purpose, provided that the
10 * above copyright notice and the following two paragraphs appear in 10 * above copyright notice and the following two paragraphs appear in
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 case HB_SCRIPT_NKO: 177 case HB_SCRIPT_NKO:
178 case HB_SCRIPT_PHAGS_PA: 178 case HB_SCRIPT_PHAGS_PA:
179 179
180 /* Unicode-6.0 additions */ 180 /* Unicode-6.0 additions */
181 case HB_SCRIPT_MANDAIC: 181 case HB_SCRIPT_MANDAIC:
182 182
183 /* Unicode-7.0 additions */ 183 /* Unicode-7.0 additions */
184 case HB_SCRIPT_MANICHAEAN: 184 case HB_SCRIPT_MANICHAEAN:
185 case HB_SCRIPT_PSALTER_PAHLAVI: 185 case HB_SCRIPT_PSALTER_PAHLAVI:
186 186
187 /* Unicode-9.0 additions */
188 case HB_SCRIPT_ADLAM:
189
187 return true; 190 return true;
188 191
189 default: 192 default:
190 return false; 193 return false;
191 } 194 }
192 } 195 }
193 196
194 static void * 197 static void *
195 data_create_use (const hb_ot_shape_plan_t *plan) 198 data_create_use (const hb_ot_shape_plan_t *plan)
196 { 199 {
(...skipping 23 matching lines...) Expand all
220 223
221 if (use_plan->arabic_plan) 224 if (use_plan->arabic_plan)
222 data_destroy_arabic (use_plan->arabic_plan); 225 data_destroy_arabic (use_plan->arabic_plan);
223 226
224 free (data); 227 free (data);
225 } 228 }
226 229
227 enum syllable_type_t { 230 enum syllable_type_t {
228 independent_cluster, 231 independent_cluster,
229 virama_terminated_cluster, 232 virama_terminated_cluster,
230 consonant_cluster, 233 standard_cluster,
231 vowel_cluster,
232 number_joiner_terminated_cluster, 234 number_joiner_terminated_cluster,
233 numeral_cluster, 235 numeral_cluster,
234 symbol_cluster, 236 symbol_cluster,
235 broken_cluster, 237 broken_cluster,
238 non_cluster,
236 }; 239 };
237 240
238 #include "hb-ot-shape-complex-use-machine.hh" 241 #include "hb-ot-shape-complex-use-machine.hh"
239 242
240 243
241 static void 244 static void
242 setup_masks_use (const hb_ot_shape_plan_t *plan, 245 setup_masks_use (const hb_ot_shape_plan_t *plan,
243 hb_buffer_t *buffer, 246 hb_buffer_t *buffer,
244 hb_font_t *font HB_UNUSED) 247 hb_font_t *font HB_UNUSED)
245 { 248 {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 unsigned int last_start = 0; 308 unsigned int last_start = 0;
306 joining_form_t last_form = _NONE; 309 joining_form_t last_form = _NONE;
307 hb_glyph_info_t *info = buffer->info; 310 hb_glyph_info_t *info = buffer->info;
308 foreach_syllable (buffer, start, end) 311 foreach_syllable (buffer, start, end)
309 { 312 {
310 syllable_type_t syllable_type = (syllable_type_t) (info[start].syllable() & 0x0F); 313 syllable_type_t syllable_type = (syllable_type_t) (info[start].syllable() & 0x0F);
311 switch (syllable_type) 314 switch (syllable_type)
312 { 315 {
313 case independent_cluster: 316 case independent_cluster:
314 case symbol_cluster: 317 case symbol_cluster:
318 case non_cluster:
315 /* These don't join. Nothing to do. */ 319 /* These don't join. Nothing to do. */
316 last_form = _NONE; 320 last_form = _NONE;
317 break; 321 break;
318 322
319 case virama_terminated_cluster: 323 case virama_terminated_cluster:
320 case consonant_cluster: 324 case standard_cluster:
321 case vowel_cluster:
322 case number_joiner_terminated_cluster: 325 case number_joiner_terminated_cluster:
323 case numeral_cluster: 326 case numeral_cluster:
324 case broken_cluster: 327 case broken_cluster:
325 328
326 bool join = last_form == FINA || last_form == ISOL; 329 bool join = last_form == FINA || last_form == ISOL;
327 330
328 if (join) 331 if (join)
329 { 332 {
330 /* Fixup previous syllable's form. */ 333 /* Fixup previous syllable's form. */
331 last_form = last_form == FINA ? MEDI : INIT; 334 last_form = last_form == FINA ? MEDI : INIT;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 return info.use_category() == USE_H && !_hb_glyph_info_ligated (&info); 417 return info.use_category() == USE_H && !_hb_glyph_info_ligated (&info);
415 } 418 }
416 419
417 static void 420 static void
418 reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end) 421 reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end)
419 { 422 {
420 syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllabl e() & 0x0F); 423 syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllabl e() & 0x0F);
421 /* Only a few syllable types need reordering. */ 424 /* Only a few syllable types need reordering. */
422 if (unlikely (!(FLAG_SAFE (syllable_type) & 425 if (unlikely (!(FLAG_SAFE (syllable_type) &
423 (FLAG (virama_terminated_cluster) | 426 (FLAG (virama_terminated_cluster) |
424 » » FLAG (consonant_cluster) | 427 » » FLAG (standard_cluster) |
425 » » FLAG (vowel_cluster) |
426 FLAG (broken_cluster) | 428 FLAG (broken_cluster) |
427 0)))) 429 0))))
428 return; 430 return;
429 431
430 hb_glyph_info_t *info = buffer->info; 432 hb_glyph_info_t *info = buffer->info;
431 433
432 #define BASE_FLAGS (FLAG (USE_B) | FLAG (USE_GB) | FLAG (USE_IV)) 434 #define BASE_FLAGS (FLAG (USE_B) | FLAG (USE_GB))
433 435
434 /* Move things forward. */ 436 /* Move things forward. */
435 if (info[start].use_category() == USE_R && end - start > 1) 437 if (info[start].use_category() == USE_R && end - start > 1)
436 { 438 {
437 /* Got a repha. Reorder it to after first base, before first halant. */ 439 /* Got a repha. Reorder it to after first base, before first halant. */
438 for (unsigned int i = start + 1; i < end; i++) 440 for (unsigned int i = start + 1; i < end; i++)
439 if ((FLAG_UNSAFE (info[i].use_category()) & (BASE_FLAGS)) || is_halant (in fo[i])) 441 if ((FLAG_UNSAFE (info[i].use_category()) & (BASE_FLAGS)) || is_halant (in fo[i]))
440 { 442 {
441 /* If we hit a halant, move before it; otherwise it's a base: move to it 's 443 /* If we hit a halant, move before it; otherwise it's a base: move to it 's
442 * place, and shift things in between backward. */ 444 * place, and shift things in between backward. */
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 data_destroy_use, 581 data_destroy_use,
580 NULL, /* preprocess_text */ 582 NULL, /* preprocess_text */
581 NULL, /* postprocess_glyphs */ 583 NULL, /* postprocess_glyphs */
582 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, 584 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
583 NULL, /* decompose */ 585 NULL, /* decompose */
584 compose_use, 586 compose_use,
585 setup_masks_use, 587 setup_masks_use,
586 HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY, 588 HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
587 false, /* fallback_position */ 589 false, /* fallback_position */
588 }; 590 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698