OLD | NEW |
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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 /* Got a repha. Reorder it to after first base, before first halant. */ | 429 /* Got a repha. Reorder it to after first base, before first halant. */ |
430 for (unsigned int i = start + 1; i < end; i++) | 430 for (unsigned int i = start + 1; i < end; i++) |
431 if (FLAG_UNSAFE (info[i].use_category()) & (HALANT_FLAGS | BASE_FLAGS)) | 431 if (FLAG_UNSAFE (info[i].use_category()) & (HALANT_FLAGS | BASE_FLAGS)) |
432 { | 432 { |
433 /* If we hit a halant, move before it; otherwise it's a base: move to it
's | 433 /* If we hit a halant, move before it; otherwise it's a base: move to it
's |
434 * place, and shift things in between backward. */ | 434 * place, and shift things in between backward. */ |
435 | 435 |
436 if (info[i].use_category() == USE_H) | 436 if (info[i].use_category() == USE_H) |
437 i--; | 437 i--; |
438 | 438 |
| 439 buffer->merge_clusters (start, i + 1); |
439 hb_glyph_info_t t = info[start]; | 440 hb_glyph_info_t t = info[start]; |
440 memmove (&info[start], &info[start + 1], (i - start) * sizeof (info[0]))
; | 441 memmove (&info[start], &info[start + 1], (i - start) * sizeof (info[0]))
; |
441 info[i] = t; | 442 info[i] = t; |
442 buffer->merge_clusters (start, i + 1); | |
443 | 443 |
444 break; | 444 break; |
445 } | 445 } |
446 } | 446 } |
447 | 447 |
448 /* Move things back. */ | 448 /* Move things back. */ |
449 unsigned int j = end; | 449 unsigned int j = end; |
450 for (unsigned int i = start; i < end; i++) | 450 for (unsigned int i = start; i < end; i++) |
451 { | 451 { |
452 uint32_t flag = FLAG_UNSAFE (info[i].use_category()); | 452 uint32_t flag = FLAG_UNSAFE (info[i].use_category()); |
453 if (flag & (HALANT_FLAGS | BASE_FLAGS)) | 453 if (flag & (HALANT_FLAGS | BASE_FLAGS)) |
454 { | 454 { |
455 /* If we hit a halant, move before it; otherwise it's a base: move to it's | 455 /* If we hit a halant, move before it; otherwise it's a base: move to it's |
456 * place, and shift things in between backward. */ | 456 * place, and shift things in between backward. */ |
457 if (info[i].use_category() == USE_H) | 457 if (info[i].use_category() == USE_H) |
458 j = i + 1; | 458 j = i + 1; |
459 else | 459 else |
460 j = i; | 460 j = i; |
461 } | 461 } |
462 else if (((flag) & (FLAG (USE_VPre) | FLAG (USE_VMPre))) && | 462 else if (((flag) & (FLAG (USE_VPre) | FLAG (USE_VMPre))) && |
463 /* Only move the first component of a MultipleSubst. */ | 463 /* Only move the first component of a MultipleSubst. */ |
464 0 == _hb_glyph_info_get_lig_comp (&info[i]) && | 464 0 == _hb_glyph_info_get_lig_comp (&info[i]) && |
465 j < i) | 465 j < i) |
466 { | 466 { |
| 467 buffer->merge_clusters (j, i + 1); |
467 hb_glyph_info_t t = info[i]; | 468 hb_glyph_info_t t = info[i]; |
468 memmove (&info[j + 1], &info[j], (i - j) * sizeof (info[0])); | 469 memmove (&info[j + 1], &info[j], (i - j) * sizeof (info[0])); |
469 info[j] = t; | 470 info[j] = t; |
470 buffer->merge_clusters (j, i + 1); | |
471 } | 471 } |
472 } | 472 } |
473 } | 473 } |
474 | 474 |
475 static inline void | 475 static inline void |
476 insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, | 476 insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, |
477 hb_font_t *font, | 477 hb_font_t *font, |
478 hb_buffer_t *buffer) | 478 hb_buffer_t *buffer) |
479 { | 479 { |
480 /* Note: This loop is extra overhead, but should not be measurable. */ | 480 /* Note: This loop is extra overhead, but should not be measurable. */ |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 data_create_use, | 576 data_create_use, |
577 data_destroy_use, | 577 data_destroy_use, |
578 NULL, /* preprocess_text */ | 578 NULL, /* preprocess_text */ |
579 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, | 579 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, |
580 NULL, /* decompose */ | 580 NULL, /* decompose */ |
581 compose_use, | 581 compose_use, |
582 setup_masks_use, | 582 setup_masks_use, |
583 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, | 583 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, |
584 false, /* fallback_position */ | 584 false, /* fallback_position */ |
585 }; | 585 }; |
OLD | NEW |