| 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 | 486 |
| 487 struct indic_shape_plan_t | 487 struct indic_shape_plan_t |
| 488 { | 488 { |
| 489 ASSERT_POD (); | 489 ASSERT_POD (); |
| 490 | 490 |
| 491 inline bool get_virama_glyph (hb_font_t *font, hb_codepoint_t *pglyph) const | 491 inline bool get_virama_glyph (hb_font_t *font, hb_codepoint_t *pglyph) const |
| 492 { | 492 { |
| 493 hb_codepoint_t glyph = virama_glyph; | 493 hb_codepoint_t glyph = virama_glyph; |
| 494 if (unlikely (virama_glyph == (hb_codepoint_t) -1)) | 494 if (unlikely (virama_glyph == (hb_codepoint_t) -1)) |
| 495 { | 495 { |
| 496 if (!config->virama || !font->get_glyph (config->virama, 0, &glyph)) | 496 if (!config->virama || !font->get_nominal_glyph (config->virama, &glyph)) |
| 497 glyph = 0; | 497 glyph = 0; |
| 498 /* Technically speaking, the spec says we should apply 'locl' to virama to
o. | 498 /* Technically speaking, the spec says we should apply 'locl' to virama to
o. |
| 499 * Maybe one day... */ | 499 * Maybe one day... */ |
| 500 | 500 |
| 501 /* Our get_glyph() function needs a font, so we can't get the virama glyph | 501 /* Our get_nominal_glyph() function needs a font, so we can't get the vira
ma glyph |
| 502 * during shape planning... Instead, overwrite it here. It's safe. Don'
t worry! */ | 502 * during shape planning... Instead, overwrite it here. It's safe. Don'
t worry! */ |
| 503 (const_cast<indic_shape_plan_t *> (this))->virama_glyph = glyph; | 503 (const_cast<indic_shape_plan_t *> (this))->virama_glyph = glyph; |
| 504 } | 504 } |
| 505 | 505 |
| 506 *pglyph = glyph; | 506 *pglyph = glyph; |
| 507 return glyph != 0; | 507 return glyph != 0; |
| 508 } | 508 } |
| 509 | 509 |
| 510 const indic_config_t *config; | 510 const indic_config_t *config; |
| 511 | 511 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 { | 735 { |
| 736 limit += 1; | 736 limit += 1; |
| 737 while (limit < end && is_joiner (info[limit])) | 737 while (limit < end && is_joiner (info[limit])) |
| 738 limit++; | 738 limit++; |
| 739 base = start; | 739 base = start; |
| 740 has_reph = true; | 740 has_reph = true; |
| 741 } | 741 } |
| 742 | 742 |
| 743 switch (indic_plan->config->base_pos) | 743 switch (indic_plan->config->base_pos) |
| 744 { | 744 { |
| 745 default: | |
| 746 assert (false); | |
| 747 HB_FALLTHROUGH; | |
| 748 | |
| 749 case BASE_POS_LAST: | 745 case BASE_POS_LAST: |
| 750 { | 746 { |
| 751 /* -> starting from the end of the syllable, move backwards */ | 747 /* -> starting from the end of the syllable, move backwards */ |
| 752 unsigned int i = end; | 748 unsigned int i = end; |
| 753 bool seen_below = false; | 749 bool seen_below = false; |
| 754 do { | 750 do { |
| 755 i--; | 751 i--; |
| 756 /* -> until a consonant is found */ | 752 /* -> until a consonant is found */ |
| 757 if (is_consonant (info[i])) | 753 if (is_consonant (info[i])) |
| 758 { | 754 { |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 if ((info[i].syllable() & 0x0F) == broken_cluster) | 1208 if ((info[i].syllable() & 0x0F) == broken_cluster) |
| 1213 { | 1209 { |
| 1214 has_broken_syllables = true; | 1210 has_broken_syllables = true; |
| 1215 break; | 1211 break; |
| 1216 } | 1212 } |
| 1217 if (likely (!has_broken_syllables)) | 1213 if (likely (!has_broken_syllables)) |
| 1218 return; | 1214 return; |
| 1219 | 1215 |
| 1220 | 1216 |
| 1221 hb_codepoint_t dottedcircle_glyph; | 1217 hb_codepoint_t dottedcircle_glyph; |
| 1222 if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph)) | 1218 if (!font->get_nominal_glyph (0x25CCu, &dottedcircle_glyph)) |
| 1223 return; | 1219 return; |
| 1224 | 1220 |
| 1225 hb_glyph_info_t dottedcircle = {0}; | 1221 hb_glyph_info_t dottedcircle = {0}; |
| 1226 dottedcircle.codepoint = 0x25CCu; | 1222 dottedcircle.codepoint = 0x25CCu; |
| 1227 set_indic_properties (dottedcircle); | 1223 set_indic_properties (dottedcircle); |
| 1228 dottedcircle.codepoint = dottedcircle_glyph; | 1224 dottedcircle.codepoint = dottedcircle_glyph; |
| 1229 | 1225 |
| 1230 buffer->clear_output (); | 1226 buffer->clear_output (); |
| 1231 | 1227 |
| 1232 buffer->idx = 0; | 1228 buffer->idx = 0; |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1796 * spec in 2012: | 1792 * spec in 2012: |
| 1797 * | 1793 * |
| 1798 * http://www.microsoft.com/typography/OpenTypeDev/sinhala/intro.htm#shapi
ng | 1794 * http://www.microsoft.com/typography/OpenTypeDev/sinhala/intro.htm#shapi
ng |
| 1799 */ | 1795 */ |
| 1800 | 1796 |
| 1801 const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) c->plan-
>data; | 1797 const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) c->plan-
>data; |
| 1802 | 1798 |
| 1803 hb_codepoint_t glyph; | 1799 hb_codepoint_t glyph; |
| 1804 | 1800 |
| 1805 if (hb_options ().uniscribe_bug_compatible || | 1801 if (hb_options ().uniscribe_bug_compatible || |
| 1806 » (c->font->get_glyph (ab, 0, &glyph) && | 1802 » (c->font->get_nominal_glyph (ab, &glyph) && |
| 1807 indic_plan->pstf.would_substitute (&glyph, 1, c->font->face))) | 1803 indic_plan->pstf.would_substitute (&glyph, 1, c->font->face))) |
| 1808 { | 1804 { |
| 1809 /* Ok, safe to use Uniscribe-style decomposition. */ | 1805 /* Ok, safe to use Uniscribe-style decomposition. */ |
| 1810 *a = 0x0DD9u; | 1806 *a = 0x0DD9u; |
| 1811 *b = ab; | 1807 *b = ab; |
| 1812 return true; | 1808 return true; |
| 1813 } | 1809 } |
| 1814 } | 1810 } |
| 1815 | 1811 |
| 1816 return (bool) c->unicode->decompose (ab, a, b); | 1812 return (bool) c->unicode->decompose (ab, a, b); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1842 data_destroy_indic, | 1838 data_destroy_indic, |
| 1843 NULL, /* preprocess_text */ | 1839 NULL, /* preprocess_text */ |
| 1844 NULL, /* postprocess_glyphs */ | 1840 NULL, /* postprocess_glyphs */ |
| 1845 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, | 1841 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, |
| 1846 decompose_indic, | 1842 decompose_indic, |
| 1847 compose_indic, | 1843 compose_indic, |
| 1848 setup_masks_indic, | 1844 setup_masks_indic, |
| 1849 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, | 1845 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, |
| 1850 false, /* fallback_position */ | 1846 false, /* fallback_position */ |
| 1851 }; | 1847 }; |
| OLD | NEW |