OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2011,2012,2013 Google, Inc. | 2 * Copyright © 2011,2012,2013 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 /* | 53 /* |
54 * Other features. | 54 * Other features. |
55 * These features are applied all at once, after final_reordering. | 55 * These features are applied all at once, after final_reordering. |
56 */ | 56 */ |
57 HB_TAG('p','r','e','s'), | 57 HB_TAG('p','r','e','s'), |
58 HB_TAG('a','b','v','s'), | 58 HB_TAG('a','b','v','s'), |
59 HB_TAG('b','l','w','s'), | 59 HB_TAG('b','l','w','s'), |
60 HB_TAG('p','s','t','s'), | 60 HB_TAG('p','s','t','s'), |
61 /* Positioning features, though we don't care about the types. */ | 61 /* Positioning features, though we don't care about the types. */ |
62 HB_TAG('d','i','s','t'), | 62 HB_TAG('d','i','s','t'), |
| 63 /* Pre-release version of Windows 8 Myanmar font had abvm,blwm |
| 64 * features. The released Windows 8 version of the font (as well |
| 65 * as the released spec) used 'mark' instead. The Windows 8 |
| 66 * shaper however didn't apply 'mark' but did apply 'mkmk'. |
| 67 * Perhaps it applied abvm/blwm. This was fixed in a Windows 8 |
| 68 * update, so now it applies mark/mkmk. We are guessing that |
| 69 * it still applies abvm/blwm too. |
| 70 */ |
| 71 HB_TAG('a','b','v','m'), |
| 72 HB_TAG('b','l','w','m'), |
63 }; | 73 }; |
64 | 74 |
65 static void | 75 static void |
66 setup_syllables (const hb_ot_shape_plan_t *plan, | 76 setup_syllables (const hb_ot_shape_plan_t *plan, |
67 hb_font_t *font, | 77 hb_font_t *font, |
68 hb_buffer_t *buffer); | 78 hb_buffer_t *buffer); |
69 static void | 79 static void |
70 initial_reordering (const hb_ot_shape_plan_t *plan, | 80 initial_reordering (const hb_ot_shape_plan_t *plan, |
71 hb_font_t *font, | 81 hb_font_t *font, |
72 hb_buffer_t *buffer); | 82 hb_buffer_t *buffer); |
(...skipping 24 matching lines...) Expand all Loading... |
97 } | 107 } |
98 map->add_gsub_pause (final_reordering); | 108 map->add_gsub_pause (final_reordering); |
99 for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++) | 109 for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++) |
100 map->add_feature (other_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ); | 110 map->add_feature (other_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ); |
101 } | 111 } |
102 | 112 |
103 static void | 113 static void |
104 override_features_myanmar (hb_ot_shape_planner_t *plan) | 114 override_features_myanmar (hb_ot_shape_planner_t *plan) |
105 { | 115 { |
106 plan->map.add_feature (HB_TAG('l','i','g','a'), 0, F_GLOBAL); | 116 plan->map.add_feature (HB_TAG('l','i','g','a'), 0, F_GLOBAL); |
107 | |
108 /* | |
109 * Note: | |
110 * | |
111 * Spec says 'mark' is used, and the mmrtext.ttf font from | |
112 * Windows 8 has lookups for it. But testing suggests that | |
113 * Windows 8 Uniscribe is NOT applying it. It *is* applying | |
114 * 'mkmk' however. | |
115 */ | |
116 if (hb_options ().uniscribe_bug_compatible) | |
117 plan->map.add_feature (HB_TAG('m','a','r','k'), 0, F_GLOBAL); | |
118 } | 117 } |
119 | 118 |
120 | 119 |
121 enum syllable_type_t { | 120 enum syllable_type_t { |
122 consonant_syllable, | 121 consonant_syllable, |
123 broken_cluster, | 122 broken_cluster, |
124 non_myanmar_cluster, | 123 non_myanmar_cluster, |
125 }; | 124 }; |
126 | 125 |
127 #include "hb-ot-shape-complex-myanmar-machine.hh" | 126 #include "hb-ot-shape-complex-myanmar-machine.hh" |
(...skipping 17 matching lines...) Expand all Loading... |
145 OT_VPre = 28, | 144 OT_VPre = 28, |
146 OT_VPst = 29, | 145 OT_VPst = 29, |
147 OT_VS = 30 /* Variation selectors */ | 146 OT_VS = 30 /* Variation selectors */ |
148 }; | 147 }; |
149 | 148 |
150 | 149 |
151 static inline bool | 150 static inline bool |
152 is_one_of (const hb_glyph_info_t &info, unsigned int flags) | 151 is_one_of (const hb_glyph_info_t &info, unsigned int flags) |
153 { | 152 { |
154 /* If it ligated, all bets are off. */ | 153 /* If it ligated, all bets are off. */ |
155 if (is_a_ligature (info)) return false; | 154 if (_hb_glyph_info_ligated (&info)) return false; |
156 return !!(FLAG (info.myanmar_category()) & flags); | 155 return !!(FLAG (info.myanmar_category()) & flags); |
157 } | 156 } |
158 | 157 |
159 /* Note: | 158 /* Note: |
160 * | 159 * |
161 * We treat Vowels and placeholders as if they were consonants. This is safe be
cause Vowels | 160 * We treat Vowels and placeholders as if they were consonants. This is safe be
cause Vowels |
162 * cannot happen in a consonant syllable. The plus side however is, we can call
the | 161 * cannot happen in a consonant syllable. The plus side however is, we can call
the |
163 * consonant syllable logic from the vowel syllable function and get it all righ
t! */ | 162 * consonant syllable logic from the vowel syllable function and get it all righ
t! */ |
164 #define CONSONANT_FLAGS (FLAG (OT_C) | FLAG (OT_CM) | FLAG (OT_Ra) | FLAG (OT_V)
| FLAG (OT_NBSP) | FLAG (OT_GB)) | 163 #define CONSONANT_FLAGS (FLAG (OT_C) | FLAG (OT_CM) | FLAG (OT_Ra) | FLAG (OT_V)
| FLAG (OT_NBSP) | FLAG (OT_GB)) |
165 static inline bool | 164 static inline bool |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 NULL, /* data_create */ | 535 NULL, /* data_create */ |
537 NULL, /* data_destroy */ | 536 NULL, /* data_destroy */ |
538 NULL, /* preprocess_text */ | 537 NULL, /* preprocess_text */ |
539 normalization_preference_myanmar, | 538 normalization_preference_myanmar, |
540 NULL, /* decompose */ | 539 NULL, /* decompose */ |
541 NULL, /* compose */ | 540 NULL, /* compose */ |
542 setup_masks_myanmar, | 541 setup_masks_myanmar, |
543 HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY, | 542 HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY, |
544 false, /* fallback_position */ | 543 false, /* fallback_position */ |
545 }; | 544 }; |
OLD | NEW |