OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2011,2012 Google, Inc. | 2 * Copyright © 2011,2012 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. |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 while (limit < end && is_joiner (info[limit])) | 749 while (limit < end && is_joiner (info[limit])) |
750 limit++; | 750 limit++; |
751 base = start; | 751 base = start; |
752 has_reph = true; | 752 has_reph = true; |
753 } | 753 } |
754 | 754 |
755 switch (indic_plan->config->base_pos) | 755 switch (indic_plan->config->base_pos) |
756 { | 756 { |
757 default: | 757 default: |
758 assert (false); | 758 assert (false); |
759 » /* fallthrough */ | 759 » HB_FALLTHROUGH; |
760 | 760 |
761 case BASE_POS_LAST: | 761 case BASE_POS_LAST: |
762 { | 762 { |
763 /* -> starting from the end of the syllable, move backwards */ | 763 /* -> starting from the end of the syllable, move backwards */ |
764 unsigned int i = end; | 764 unsigned int i = end; |
765 bool seen_below = false; | 765 bool seen_below = false; |
766 do { | 766 do { |
767 i--; | 767 i--; |
768 /* -> until a consonant is found */ | 768 /* -> until a consonant is found */ |
769 if (is_consonant (info[i])) | 769 if (is_consonant (info[i])) |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 | 1236 |
1237 hb_glyph_info_t dottedcircle = {0}; | 1237 hb_glyph_info_t dottedcircle = {0}; |
1238 dottedcircle.codepoint = 0x25CCu; | 1238 dottedcircle.codepoint = 0x25CCu; |
1239 set_indic_properties (dottedcircle); | 1239 set_indic_properties (dottedcircle); |
1240 dottedcircle.codepoint = dottedcircle_glyph; | 1240 dottedcircle.codepoint = dottedcircle_glyph; |
1241 | 1241 |
1242 buffer->clear_output (); | 1242 buffer->clear_output (); |
1243 | 1243 |
1244 buffer->idx = 0; | 1244 buffer->idx = 0; |
1245 unsigned int last_syllable = 0; | 1245 unsigned int last_syllable = 0; |
1246 while (buffer->idx < buffer->len) | 1246 while (buffer->idx < buffer->len && !buffer->in_error) |
1247 { | 1247 { |
1248 unsigned int syllable = buffer->cur().syllable(); | 1248 unsigned int syllable = buffer->cur().syllable(); |
1249 syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F); | 1249 syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F); |
1250 if (unlikely (last_syllable != syllable && syllable_type == broken_cluster)) | 1250 if (unlikely (last_syllable != syllable && syllable_type == broken_cluster)) |
1251 { | 1251 { |
1252 last_syllable = syllable; | 1252 last_syllable = syllable; |
1253 | 1253 |
1254 hb_glyph_info_t info = dottedcircle; | 1254 hb_glyph_info_t ginfo = dottedcircle; |
1255 info.cluster = buffer->cur().cluster; | 1255 ginfo.cluster = buffer->cur().cluster; |
1256 info.mask = buffer->cur().mask; | 1256 ginfo.mask = buffer->cur().mask; |
1257 info.syllable() = buffer->cur().syllable(); | 1257 ginfo.syllable() = buffer->cur().syllable(); |
1258 /* TODO Set glyph_props? */ | 1258 /* TODO Set glyph_props? */ |
1259 | 1259 |
1260 /* Insert dottedcircle after possible Repha. */ | 1260 /* Insert dottedcircle after possible Repha. */ |
1261 while (buffer->idx < buffer->len && | 1261 while (buffer->idx < buffer->len && |
1262 last_syllable == buffer->cur().syllable() && | 1262 last_syllable == buffer->cur().syllable() && |
1263 buffer->cur().indic_category() == OT_Repha) | 1263 buffer->cur().indic_category() == OT_Repha) |
1264 buffer->next_glyph (); | 1264 buffer->next_glyph (); |
1265 | 1265 |
1266 buffer->output_info (info); | 1266 buffer->output_info (ginfo); |
1267 } | 1267 } |
1268 else | 1268 else |
1269 buffer->next_glyph (); | 1269 buffer->next_glyph (); |
1270 } | 1270 } |
1271 | 1271 |
1272 buffer->swap_buffers (); | 1272 buffer->swap_buffers (); |
1273 } | 1273 } |
1274 | 1274 |
1275 static void | 1275 static void |
1276 initial_reordering (const hb_ot_shape_plan_t *plan, | 1276 initial_reordering (const hb_ot_shape_plan_t *plan, |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 { | 1624 { |
1625 while (new_pos > start && | 1625 while (new_pos > start && |
1626 !(is_one_of (info[new_pos - 1], FLAG(OT_M) | HALANT_OR_COENG_
FLAGS))) | 1626 !(is_one_of (info[new_pos - 1], FLAG(OT_M) | HALANT_OR_COENG_
FLAGS))) |
1627 new_pos--; | 1627 new_pos--; |
1628 | 1628 |
1629 /* In Khmer coeng model, a H,Ra can go *after* matras. If it goes a
fter a | 1629 /* In Khmer coeng model, a H,Ra can go *after* matras. If it goes a
fter a |
1630 * split matra, it should be reordered to *before* the left part of
such matra. */ | 1630 * split matra, it should be reordered to *before* the left part of
such matra. */ |
1631 if (new_pos > start && info[new_pos - 1].indic_category() == OT_M) | 1631 if (new_pos > start && info[new_pos - 1].indic_category() == OT_M) |
1632 { | 1632 { |
1633 unsigned int old_pos = i; | 1633 unsigned int old_pos = i; |
1634 » for (unsigned int i = base + 1; i < old_pos; i++) | 1634 » for (unsigned int j = base + 1; j < old_pos; j++) |
1635 » » if (info[i].indic_category() == OT_M) | 1635 » » if (info[j].indic_category() == OT_M) |
1636 { | 1636 { |
1637 new_pos--; | 1637 new_pos--; |
1638 break; | 1638 break; |
1639 } | 1639 } |
1640 } | 1640 } |
1641 } | 1641 } |
1642 | 1642 |
1643 if (new_pos > start && is_halant_or_coeng (info[new_pos - 1])) | 1643 if (new_pos > start && is_halant_or_coeng (info[new_pos - 1])) |
1644 { | 1644 { |
1645 /* -> If ZWJ or ZWNJ follow this halant, position is moved after it.
*/ | 1645 /* -> If ZWJ or ZWNJ follow this halant, position is moved after it.
*/ |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 | 1827 |
1828 | 1828 |
1829 const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic = | 1829 const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic = |
1830 { | 1830 { |
1831 "indic", | 1831 "indic", |
1832 collect_features_indic, | 1832 collect_features_indic, |
1833 override_features_indic, | 1833 override_features_indic, |
1834 data_create_indic, | 1834 data_create_indic, |
1835 data_destroy_indic, | 1835 data_destroy_indic, |
1836 NULL, /* preprocess_text */ | 1836 NULL, /* preprocess_text */ |
| 1837 NULL, /* postprocess_glyphs */ |
1837 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, | 1838 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, |
1838 decompose_indic, | 1839 decompose_indic, |
1839 compose_indic, | 1840 compose_indic, |
1840 setup_masks_indic, | 1841 setup_masks_indic, |
1841 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, | 1842 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, |
1842 false, /* fallback_position */ | 1843 false, /* fallback_position */ |
1843 }; | 1844 }; |
OLD | NEW |