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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 hb_glyph_info_t *info = buffer->info; | 483 hb_glyph_info_t *info = buffer->info; |
484 for (unsigned int i = 0; i < count; i++) | 484 for (unsigned int i = 0; i < count; i++) |
485 if ((info[i].syllable() & 0x0F) == broken_cluster) | 485 if ((info[i].syllable() & 0x0F) == broken_cluster) |
486 { | 486 { |
487 has_broken_syllables = true; | 487 has_broken_syllables = true; |
488 break; | 488 break; |
489 } | 489 } |
490 if (likely (!has_broken_syllables)) | 490 if (likely (!has_broken_syllables)) |
491 return; | 491 return; |
492 | 492 |
493 | |
494 hb_codepoint_t dottedcircle_glyph; | |
495 if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph)) | |
496 return; | |
497 | |
498 hb_glyph_info_t dottedcircle = {0}; | 493 hb_glyph_info_t dottedcircle = {0}; |
499 if (!font->get_glyph (0x25CCu, 0, &dottedcircle.codepoint)) | 494 if (!font->get_glyph (0x25CCu, 0, &dottedcircle.codepoint)) |
500 return; | 495 return; |
501 dottedcircle.use_category() = hb_use_get_categories (0x25CC); | 496 dottedcircle.use_category() = hb_use_get_categories (0x25CC); |
502 | 497 |
503 buffer->clear_output (); | 498 buffer->clear_output (); |
504 | 499 |
505 buffer->idx = 0; | 500 buffer->idx = 0; |
506 | |
507 unsigned int last_syllable = 0; | 501 unsigned int last_syllable = 0; |
508 while (buffer->idx < buffer->len) | 502 while (buffer->idx < buffer->len && !buffer->in_error) |
509 { | 503 { |
510 unsigned int syllable = buffer->cur().syllable(); | 504 unsigned int syllable = buffer->cur().syllable(); |
511 syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F); | 505 syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F); |
512 if (unlikely (last_syllable != syllable && syllable_type == broken_cluster)) | 506 if (unlikely (last_syllable != syllable && syllable_type == broken_cluster)) |
513 { | 507 { |
514 last_syllable = syllable; | 508 last_syllable = syllable; |
515 | 509 |
516 hb_glyph_info_t info = dottedcircle; | 510 hb_glyph_info_t ginfo = dottedcircle; |
517 info.cluster = buffer->cur().cluster; | 511 ginfo.cluster = buffer->cur().cluster; |
518 info.mask = buffer->cur().mask; | 512 ginfo.mask = buffer->cur().mask; |
519 info.syllable() = buffer->cur().syllable(); | 513 ginfo.syllable() = buffer->cur().syllable(); |
520 /* TODO Set glyph_props? */ | 514 /* TODO Set glyph_props? */ |
521 | 515 |
522 /* Insert dottedcircle after possible Repha. */ | 516 /* Insert dottedcircle after possible Repha. */ |
523 while (buffer->idx < buffer->len && | 517 while (buffer->idx < buffer->len && |
524 last_syllable == buffer->cur().syllable() && | 518 last_syllable == buffer->cur().syllable() && |
525 buffer->cur().use_category() == USE_R) | 519 buffer->cur().use_category() == USE_R) |
526 buffer->next_glyph (); | 520 buffer->next_glyph (); |
527 | 521 |
528 buffer->output_info (info); | 522 buffer->output_info (ginfo); |
529 } | 523 } |
530 else | 524 else |
531 buffer->next_glyph (); | 525 buffer->next_glyph (); |
532 } | 526 } |
533 | 527 |
534 buffer->swap_buffers (); | 528 buffer->swap_buffers (); |
535 } | 529 } |
536 | 530 |
537 static void | 531 static void |
538 reorder (const hb_ot_shape_plan_t *plan, | 532 reorder (const hb_ot_shape_plan_t *plan, |
(...skipping 30 matching lines...) Expand all Loading... |
569 | 563 |
570 | 564 |
571 const hb_ot_complex_shaper_t _hb_ot_complex_shaper_use = | 565 const hb_ot_complex_shaper_t _hb_ot_complex_shaper_use = |
572 { | 566 { |
573 "use", | 567 "use", |
574 collect_features_use, | 568 collect_features_use, |
575 NULL, /* override_features */ | 569 NULL, /* override_features */ |
576 data_create_use, | 570 data_create_use, |
577 data_destroy_use, | 571 data_destroy_use, |
578 NULL, /* preprocess_text */ | 572 NULL, /* preprocess_text */ |
| 573 NULL, /* postprocess_glyphs */ |
579 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, | 574 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, |
580 NULL, /* decompose */ | 575 NULL, /* decompose */ |
581 compose_use, | 576 compose_use, |
582 setup_masks_use, | 577 setup_masks_use, |
583 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, | 578 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, |
584 false, /* fallback_position */ | 579 false, /* fallback_position */ |
585 }; | 580 }; |
OLD | NEW |