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 19 matching lines...) Expand all Loading... |
30 /* buffer var allocations */ | 30 /* buffer var allocations */ |
31 #define indic_category() complex_var_u8_0() /* indic_category_t */ | 31 #define indic_category() complex_var_u8_0() /* indic_category_t */ |
32 #define indic_position() complex_var_u8_1() /* indic_position_t */ | 32 #define indic_position() complex_var_u8_1() /* indic_position_t */ |
33 | 33 |
34 | 34 |
35 /* | 35 /* |
36 * Indic shaper. | 36 * Indic shaper. |
37 */ | 37 */ |
38 | 38 |
39 | 39 |
40 #define IN_HALF_BLOCK(u, Base) (((u) & ~0x7F) == (Base)) | 40 #define IN_HALF_BLOCK(u, Base) (((u) & ~0x7Fu) == (Base)) |
41 | 41 |
42 #define IS_DEVA(u) (IN_HALF_BLOCK (u, 0x0900)) | 42 #define IS_DEVA(u) (IN_HALF_BLOCK (u, 0x0900u)) |
43 #define IS_BENG(u) (IN_HALF_BLOCK (u, 0x0980)) | 43 #define IS_BENG(u) (IN_HALF_BLOCK (u, 0x0980u)) |
44 #define IS_GURU(u) (IN_HALF_BLOCK (u, 0x0A00)) | 44 #define IS_GURU(u) (IN_HALF_BLOCK (u, 0x0A00u)) |
45 #define IS_GUJR(u) (IN_HALF_BLOCK (u, 0x0A80)) | 45 #define IS_GUJR(u) (IN_HALF_BLOCK (u, 0x0A80u)) |
46 #define IS_ORYA(u) (IN_HALF_BLOCK (u, 0x0B00)) | 46 #define IS_ORYA(u) (IN_HALF_BLOCK (u, 0x0B00u)) |
47 #define IS_TAML(u) (IN_HALF_BLOCK (u, 0x0B80)) | 47 #define IS_TAML(u) (IN_HALF_BLOCK (u, 0x0B80u)) |
48 #define IS_TELU(u) (IN_HALF_BLOCK (u, 0x0C00)) | 48 #define IS_TELU(u) (IN_HALF_BLOCK (u, 0x0C00u)) |
49 #define IS_KNDA(u) (IN_HALF_BLOCK (u, 0x0C80)) | 49 #define IS_KNDA(u) (IN_HALF_BLOCK (u, 0x0C80u)) |
50 #define IS_MLYM(u) (IN_HALF_BLOCK (u, 0x0D00)) | 50 #define IS_MLYM(u) (IN_HALF_BLOCK (u, 0x0D00u)) |
51 #define IS_SINH(u) (IN_HALF_BLOCK (u, 0x0D80)) | 51 #define IS_SINH(u) (IN_HALF_BLOCK (u, 0x0D80u)) |
52 #define IS_KHMR(u) (IN_HALF_BLOCK (u, 0x1780)) | 52 #define IS_KHMR(u) (IN_HALF_BLOCK (u, 0x1780u)) |
53 | 53 |
54 | 54 |
55 #define MATRA_POS_LEFT(u) POS_PRE_M | 55 #define MATRA_POS_LEFT(u) POS_PRE_M |
56 #define MATRA_POS_RIGHT(u) ( \ | 56 #define MATRA_POS_RIGHT(u) ( \ |
57 IS_DEVA(u) ? POS_AFTER_SUB : \ | 57 IS_DEVA(u) ? POS_AFTER_SUB : \ |
58 IS_BENG(u) ? POS_AFTER_POST : \ | 58 IS_BENG(u) ? POS_AFTER_POST : \ |
59 IS_GURU(u) ? POS_AFTER_POST : \ | 59 IS_GURU(u) ? POS_AFTER_POST : \ |
60 IS_GUJR(u) ? POS_AFTER_POST : \ | 60 IS_GUJR(u) ? POS_AFTER_POST : \ |
61 IS_ORYA(u) ? POS_AFTER_POST : \ | 61 IS_ORYA(u) ? POS_AFTER_POST : \ |
62 IS_TAML(u) ? POS_AFTER_POST : \ | 62 IS_TAML(u) ? POS_AFTER_POST : \ |
63 » » » » IS_TELU(u) ? (u <= 0x0C42 ? POS_BEFORE_SUB : P
OS_AFTER_SUB) : \ | 63 » » » » IS_TELU(u) ? (u <= 0x0C42u ? POS_BEFORE_SUB :
POS_AFTER_SUB) : \ |
64 » » » » IS_KNDA(u) ? (u < 0x0CC3 || u > 0xCD6 ? POS_BE
FORE_SUB : POS_AFTER_SUB) : \ | 64 » » » » IS_KNDA(u) ? (u < 0x0CC3u || u > 0xCD6u ? POS_
BEFORE_SUB : POS_AFTER_SUB) : \ |
65 IS_MLYM(u) ? POS_AFTER_POST : \ | 65 IS_MLYM(u) ? POS_AFTER_POST : \ |
66 IS_SINH(u) ? POS_AFTER_SUB : \ | 66 IS_SINH(u) ? POS_AFTER_SUB : \ |
67 IS_KHMR(u) ? POS_AFTER_POST : \ | 67 IS_KHMR(u) ? POS_AFTER_POST : \ |
68 /*default*/ POS_AFTER_SUB \ | 68 /*default*/ POS_AFTER_SUB \ |
69 ) | 69 ) |
70 #define MATRA_POS_TOP(u) ( /* BENG and MLYM don't have top matras. */ \ | 70 #define MATRA_POS_TOP(u) ( /* BENG and MLYM don't have top matras. */ \ |
71 IS_DEVA(u) ? POS_AFTER_SUB : \ | 71 IS_DEVA(u) ? POS_AFTER_SUB : \ |
72 IS_GURU(u) ? POS_AFTER_POST : /* Deviate from
spec */ \ | 72 IS_GURU(u) ? POS_AFTER_POST : /* Deviate from
spec */ \ |
73 IS_GUJR(u) ? POS_AFTER_SUB : \ | 73 IS_GUJR(u) ? POS_AFTER_SUB : \ |
74 IS_ORYA(u) ? POS_AFTER_MAIN : \ | 74 IS_ORYA(u) ? POS_AFTER_MAIN : \ |
(...skipping 30 matching lines...) Expand all Loading... |
105 case POS_BELOW_C: return MATRA_POS_BOTTOM (u); | 105 case POS_BELOW_C: return MATRA_POS_BOTTOM (u); |
106 }; | 106 }; |
107 return side; | 107 return side; |
108 } | 108 } |
109 | 109 |
110 /* XXX | 110 /* XXX |
111 * This is a hack for now. We should move this data into the main Indic table. | 111 * This is a hack for now. We should move this data into the main Indic table. |
112 * Or completely remove it and just check in the tables. | 112 * Or completely remove it and just check in the tables. |
113 */ | 113 */ |
114 static const hb_codepoint_t ra_chars[] = { | 114 static const hb_codepoint_t ra_chars[] = { |
115 0x0930, /* Devanagari */ | 115 0x0930u, /* Devanagari */ |
116 0x09B0, /* Bengali */ | 116 0x09B0u, /* Bengali */ |
117 0x09F0, /* Bengali */ | 117 0x09F0u, /* Bengali */ |
118 0x0A30, /* Gurmukhi */» /* No Reph */ | 118 0x0A30u, /* Gurmukhi */» /* No Reph */ |
119 0x0AB0, /* Gujarati */ | 119 0x0AB0u, /* Gujarati */ |
120 0x0B30, /* Oriya */ | 120 0x0B30u, /* Oriya */ |
121 0x0BB0, /* Tamil */» » /* No Reph */ | 121 0x0BB0u, /* Tamil */» » /* No Reph */ |
122 0x0C30, /* Telugu */» » /* Reph formed only with ZWJ */ | 122 0x0C30u, /* Telugu */»» /* Reph formed only with ZWJ */ |
123 0x0CB0, /* Kannada */ | 123 0x0CB0u, /* Kannada */ |
124 0x0D30, /* Malayalam */» /* No Reph, Logical Repha */ | 124 0x0D30u, /* Malayalam */» /* No Reph, Logical Repha */ |
125 | 125 |
126 0x0DBB, /* Sinhala */»» /* Reph formed only with ZWJ */ | 126 0x0DBBu, /* Sinhala */» » /* Reph formed only with ZWJ */ |
127 | 127 |
128 0x179A, /* Khmer */» » /* No Reph, Visual Repha */ | 128 0x179Au, /* Khmer */» » /* No Reph, Visual Repha */ |
129 }; | 129 }; |
130 | 130 |
131 static inline bool | 131 static inline bool |
132 is_ra (hb_codepoint_t u) | 132 is_ra (hb_codepoint_t u) |
133 { | 133 { |
134 for (unsigned int i = 0; i < ARRAY_LENGTH (ra_chars); i++) | 134 for (unsigned int i = 0; i < ARRAY_LENGTH (ra_chars); i++) |
135 if (u == ra_chars[i]) | 135 if (u == ra_chars[i]) |
136 return true; | 136 return true; |
137 return false; | 137 return false; |
138 } | 138 } |
139 | 139 |
140 static inline bool | 140 static inline bool |
141 is_one_of (const hb_glyph_info_t &info, unsigned int flags) | 141 is_one_of (const hb_glyph_info_t &info, unsigned int flags) |
142 { | 142 { |
143 /* If it ligated, all bets are off. */ | 143 /* If it ligated, all bets are off. */ |
144 if (_hb_glyph_info_ligated (&info)) return false; | 144 if (_hb_glyph_info_ligated (&info)) return false; |
145 return !!(FLAG (info.indic_category()) & flags); | 145 return !!(FLAG (info.indic_category()) & flags); |
146 } | 146 } |
147 | 147 |
148 #define JOINER_FLAGS (FLAG (OT_ZWJ) | FLAG (OT_ZWNJ)) | |
149 static inline bool | 148 static inline bool |
150 is_joiner (const hb_glyph_info_t &info) | 149 is_joiner (const hb_glyph_info_t &info) |
151 { | 150 { |
152 return is_one_of (info, JOINER_FLAGS); | 151 return is_one_of (info, JOINER_FLAGS); |
153 } | 152 } |
154 | 153 |
155 #define MEDIAL_FLAGS (FLAG (OT_CM) | FLAG (OT_CM2)) | |
156 | |
157 /* Note: | |
158 * | |
159 * We treat Vowels and placeholders as if they were consonants. This is safe be
cause Vowels | |
160 * cannot happen in a consonant syllable. The plus side however is, we can call
the | |
161 * consonant syllable logic from the vowel syllable function and get it all righ
t! */ | |
162 #define CONSONANT_FLAGS (FLAG (OT_C) | FLAG (OT_Ra) | MEDIAL_FLAGS | FLAG (OT_V)
| FLAG (OT_NBSP) | FLAG (OT_DOTTEDCIRCLE)) | |
163 static inline bool | 154 static inline bool |
164 is_consonant (const hb_glyph_info_t &info) | 155 is_consonant (const hb_glyph_info_t &info) |
165 { | 156 { |
166 return is_one_of (info, CONSONANT_FLAGS); | 157 return is_one_of (info, CONSONANT_FLAGS); |
167 } | 158 } |
168 | 159 |
169 #define HALANT_OR_COENG_FLAGS (FLAG (OT_H) | FLAG (OT_Coeng)) | |
170 static inline bool | 160 static inline bool |
171 is_halant_or_coeng (const hb_glyph_info_t &info) | 161 is_halant_or_coeng (const hb_glyph_info_t &info) |
172 { | 162 { |
173 return is_one_of (info, HALANT_OR_COENG_FLAGS); | 163 return is_one_of (info, HALANT_OR_COENG_FLAGS); |
174 } | 164 } |
175 | 165 |
176 static inline void | 166 static inline void |
177 set_indic_properties (hb_glyph_info_t &info) | 167 set_indic_properties (hb_glyph_info_t &info) |
178 { | 168 { |
179 hb_codepoint_t u = info.codepoint; | 169 hb_codepoint_t u = info.codepoint; |
180 unsigned int type = hb_indic_get_categories (u); | 170 unsigned int type = hb_indic_get_categories (u); |
181 indic_category_t cat = (indic_category_t) (type & 0x7F); | 171 indic_category_t cat = (indic_category_t) (type & 0x7Fu); |
182 indic_position_t pos = (indic_position_t) (type >> 8); | 172 indic_position_t pos = (indic_position_t) (type >> 8); |
183 | 173 |
184 | 174 |
185 /* | 175 /* |
186 * Re-assign category | 176 * Re-assign category |
187 */ | 177 */ |
188 | 178 |
189 | 179 |
190 /* The spec says U+0952 is OT_A. However, testing shows that Uniscribe | 180 /* The spec says U+0952 is OT_A. However, testing shows that Uniscribe |
191 * treats U+0951..U+0954 all behave similarly. | 181 * treats a whole bunch of characters similarly. |
192 * TESTS: | 182 * TESTS: For example, for U+0951: |
193 * U+092E,U+0947,U+0952 | 183 * U+092E,U+0947,U+0952 |
194 * U+092E,U+0952,U+0947 | 184 * U+092E,U+0952,U+0947 |
195 * U+092E,U+0947,U+0951 | 185 * U+092E,U+0947,U+0951 |
196 * U+092E,U+0951,U+0947 | 186 * U+092E,U+0951,U+0947 |
| 187 * U+092E,U+0951,U+0952 |
| 188 * U+092E,U+0952,U+0951 |
197 */ | 189 */ |
198 if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x0951, 0x0954))) | 190 if (unlikely (hb_in_ranges (u, 0x0951u, 0x0952u, |
| 191 » » » » 0x1CD0u, 0x1CD2u, |
| 192 » » » » 0x1CD4u, 0x1CE1u) || |
| 193 » » » u == 0x1CF4u)) |
199 cat = OT_A; | 194 cat = OT_A; |
200 | 195 /* The following act more like the Bindus. */ |
201 if (unlikely (u == 0x17D1)) | 196 else if (unlikely (hb_in_range (u, 0x0953u, 0x0954u))) |
202 cat = OT_X; | 197 cat = OT_SM; |
203 if (cat == OT_X && | 198 /* The following act like consonants. */ |
204 unlikely (hb_in_range<hb_codepoint_t> (u, 0x17CB, 0x17D3))) /* Khmer Vario
us signs */ | 199 else if (unlikely (hb_in_ranges (u, 0x0A72u, 0x0A73u, |
| 200 » » » » 0x1CF5u, 0x1CF6u))) |
| 201 cat = OT_C; |
| 202 /* TODO: The following should only be allowed after a Visarga. |
| 203 * For now, just treat them like regular tone marks. */ |
| 204 else if (unlikely (hb_in_range (u, 0x1CE2u, 0x1CE8u))) |
| 205 cat = OT_A; |
| 206 /* TODO: The following should only be allowed after some of |
| 207 * the nasalization marks, maybe only for U+1CE9..U+1CF1. |
| 208 * For now, just treat them like tone marks. */ |
| 209 else if (unlikely (u == 0x1CEDu)) |
| 210 cat = OT_A; |
| 211 /* The following take marks in standalone clusters, similar to Avagraha. */ |
| 212 else if (unlikely (hb_in_ranges (u, 0xA8F2u, 0xA8F7u, |
| 213 » » » » 0x1CE9u, 0x1CECu, |
| 214 » » » » 0x1CEEu, 0x1CF1u))) |
| 215 { |
| 216 cat = OT_Symbol; |
| 217 ASSERT_STATIC ((int) INDIC_SYLLABIC_CATEGORY_AVAGRAHA == OT_Symbol); |
| 218 } |
| 219 else if (unlikely (hb_in_range (u, 0x17CDu, 0x17D1u) || |
| 220 » » u == 0x17CBu || u == 0x17D3u || u == 0x17DDu)) /* Khmer Var
ious signs */ |
205 { | 221 { |
206 /* These are like Top Matras. */ | 222 /* These are like Top Matras. */ |
207 cat = OT_M; | 223 cat = OT_M; |
208 pos = POS_ABOVE_C; | 224 pos = POS_ABOVE_C; |
209 } | 225 } |
210 if (u == 0x17C6) /* Khmer Bindu doesn't like to be repositioned. */ | 226 else if (unlikely (u == 0x17C6u)) cat = OT_N; /* Khmer Bindu doesn't like to b
e repositioned. */ |
211 cat = OT_N; | 227 else if (unlikely (u == 0x17D2u)) cat = OT_Coeng; /* Khmer coeng */ |
212 | 228 else if (unlikely (hb_in_range (u, 0x2010u, 0x2011u))) |
213 if (unlikely (u == 0x17D2)) cat = OT_Coeng; /* Khmer coeng */ | 229 » » » » cat = OT_PLACEHOLDER; |
214 else if (unlikely (u == 0x200C)) cat = OT_ZWNJ; | 230 else if (unlikely (u == 0x25CCu)) cat = OT_DOTTEDCIRCLE; |
215 else if (unlikely (u == 0x200D)) cat = OT_ZWJ; | 231 else if (unlikely (u == 0xA982u)) cat = OT_SM; /* Javanese repha. */ |
216 else if (unlikely (u == 0x25CC)) cat = OT_DOTTEDCIRCLE; | 232 else if (unlikely (u == 0xA9BEu)) cat = OT_CM2; /* Javanese medial ya. */ |
217 else if (unlikely (u == 0x0A71)) cat = OT_SM; /* GURMUKHI ADDAK. Move it to t
he end. */ | 233 else if (unlikely (u == 0xA9BDu)) { cat = OT_M; pos = POS_POST_C; } /* Javanes
e vocalic r. */ |
218 else if (unlikely (u == 0xA982)) cat = OT_SM; /* Javanese repha. */ | |
219 else if (unlikely (u == 0xA9BE)) cat = OT_CM2; /* Javanese medial ya. */ | |
220 else if (unlikely (u == 0xA9BD)) { cat = OT_M; pos = POS_POST_C; } /* Javanese
vocalic r. */ | |
221 | |
222 if (cat == OT_Repha) { | |
223 /* There are two kinds of characters marked as Repha: | |
224 * - The ones that are GenCat=Mn are already positioned visually, ie. after
base. (eg. Khmer) | |
225 * - The ones that are GenCat=Lo is encoded logically, ie. beginning of syll
able. (eg. Malayalam) | |
226 * | |
227 * We recategorize the first kind to look like a Nukta and attached to the b
ase directly. | |
228 */ | |
229 if (_hb_glyph_info_get_general_category (&info) == HB_UNICODE_GENERAL_CATEGO
RY_NON_SPACING_MARK) | |
230 cat = OT_N; | |
231 } | |
232 | |
233 | 234 |
234 | 235 |
235 /* | 236 /* |
236 * Re-assign position. | 237 * Re-assign position. |
237 */ | 238 */ |
238 | 239 |
239 if ((FLAG (cat) & CONSONANT_FLAGS)) | 240 if ((FLAG (cat) & CONSONANT_FLAGS)) |
240 { | 241 { |
241 pos = POS_BASE_C; | 242 pos = POS_BASE_C; |
242 if (is_ra (u)) | 243 if (is_ra (u)) |
243 cat = OT_Ra; | 244 cat = OT_Ra; |
244 } | 245 } |
245 else if (cat == OT_M) | 246 else if (cat == OT_M) |
246 { | 247 { |
247 pos = matra_position (u, pos); | 248 pos = matra_position (u, pos); |
248 } | 249 } |
249 else if ((FLAG (cat) & (FLAG (OT_SM) | FLAG (OT_VD) | FLAG (OT_A) | FLAG (OT_A
vag)))) | 250 else if ((FLAG (cat) & (FLAG (OT_SM) | FLAG (OT_VD) | FLAG (OT_A) | FLAG (OT_S
ymbol)))) |
250 { | 251 { |
251 pos = POS_SMVD; | 252 pos = POS_SMVD; |
252 } | 253 } |
253 | 254 |
254 if (unlikely (u == 0x0B01)) pos = POS_BEFORE_SUB; /* Oriya Bindu is BeforeSub
in the spec. */ | 255 if (unlikely (u == 0x0B01u)) pos = POS_BEFORE_SUB; /* Oriya Bindu is BeforeSub
in the spec. */ |
255 | 256 |
256 | 257 |
257 | 258 |
258 info.indic_category() = cat; | 259 info.indic_category() = cat; |
259 info.indic_position() = pos; | 260 info.indic_position() = pos; |
260 } | 261 } |
261 | 262 |
262 /* | 263 /* |
263 * Things above this line should ideally be moved to the Indic table itself. | 264 * Things above this line should ideally be moved to the Indic table itself. |
264 */ | 265 */ |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 base_position_t base_pos; | 309 base_position_t base_pos; |
309 reph_position_t reph_pos; | 310 reph_position_t reph_pos; |
310 reph_mode_t reph_mode; | 311 reph_mode_t reph_mode; |
311 blwf_mode_t blwf_mode; | 312 blwf_mode_t blwf_mode; |
312 pref_len_t pref_len; | 313 pref_len_t pref_len; |
313 }; | 314 }; |
314 | 315 |
315 static const indic_config_t indic_configs[] = | 316 static const indic_config_t indic_configs[] = |
316 { | 317 { |
317 /* Default. Should be first. */ | 318 /* Default. Should be first. */ |
318 {HB_SCRIPT_INVALID,» false, 0,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MO
DE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_1}, | 319 {HB_SCRIPT_INVALID,» false, 0,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_M
ODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_1}, |
319 {HB_SCRIPT_DEVANAGARI,true, 0x094D,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MO
DE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE}, | 320 {HB_SCRIPT_DEVANAGARI,true, 0x094Du,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_M
ODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE}, |
320 {HB_SCRIPT_BENGALI,» true, 0x09CD,BASE_POS_LAST, REPH_POS_AFTER_SUB, REPH_MO
DE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE}, | 321 {HB_SCRIPT_BENGALI,» true, 0x09CDu,BASE_POS_LAST, REPH_POS_AFTER_SUB, REPH_M
ODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE}, |
321 {HB_SCRIPT_GURMUKHI,» true, 0x0A4D,BASE_POS_LAST, REPH_POS_BEFORE_SUB, REPH_MO
DE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE}, | 322 {HB_SCRIPT_GURMUKHI,» true, 0x0A4Du,BASE_POS_LAST, REPH_POS_BEFORE_SUB, REPH_M
ODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE}, |
322 {HB_SCRIPT_GUJARATI,» true, 0x0ACD,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MO
DE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE}, | 323 {HB_SCRIPT_GUJARATI,» true, 0x0ACDu,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_M
ODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE}, |
323 {HB_SCRIPT_ORIYA,» true, 0x0B4D,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MO
DE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE}, | 324 {HB_SCRIPT_ORIYA,» true, 0x0B4Du,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_M
ODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE}, |
324 {HB_SCRIPT_TAMIL,» true, 0x0BCD,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MO
DE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_2}, | 325 {HB_SCRIPT_TAMIL,» true, 0x0BCDu,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_M
ODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_2}, |
325 {HB_SCRIPT_TELUGU,» true, 0x0C4D,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MO
DE_EXPLICIT, BLWF_MODE_POST_ONLY, PREF_LEN_2}, | 326 {HB_SCRIPT_TELUGU,» true, 0x0C4Du,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_M
ODE_EXPLICIT, BLWF_MODE_POST_ONLY, PREF_LEN_2}, |
326 {HB_SCRIPT_KANNADA,» true, 0x0CCD,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MO
DE_IMPLICIT, BLWF_MODE_POST_ONLY, PREF_LEN_2}, | 327 {HB_SCRIPT_KANNADA,» true, 0x0CCDu,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_M
ODE_IMPLICIT, BLWF_MODE_POST_ONLY, PREF_LEN_2}, |
327 {HB_SCRIPT_MALAYALAM,»true, 0x0D4D,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MO
DE_LOG_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_2}, | 328 {HB_SCRIPT_MALAYALAM,»true, 0x0D4Du,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_M
ODE_LOG_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_2}, |
328 {HB_SCRIPT_SINHALA,» false,0x0DCA,BASE_POS_LAST_SINHALA, | 329 {HB_SCRIPT_SINHALA,» false,0x0DCAu,BASE_POS_LAST_SINHALA, |
329 » » » » » » REPH_POS_AFTER_MAIN, REPH_MO
DE_EXPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE}, | 330 » » » » » » REPH_POS_AFTER_MAIN, REPH_M
ODE_EXPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE}, |
330 {HB_SCRIPT_KHMER,» false,0x17D2,BASE_POS_FIRST,REPH_POS_DONT_CARE, REPH_MO
DE_VIS_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_2}, | 331 {HB_SCRIPT_KHMER,» false,0x17D2u,BASE_POS_FIRST,REPH_POS_DONT_CARE, REPH_M
ODE_VIS_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_2}, |
331 {HB_SCRIPT_JAVANESE,» false,0xA9C0,BASE_POS_FIRST,REPH_POS_DONT_CARE, REPH_MO
DE_VIS_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_1}, | 332 {HB_SCRIPT_JAVANESE,» false,0xA9C0u,BASE_POS_FIRST,REPH_POS_DONT_CARE, REPH_M
ODE_VIS_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_1}, |
332 }; | 333 }; |
333 | 334 |
334 | 335 |
335 | 336 |
336 /* | 337 /* |
337 * Indic shaper. | 338 * Indic shaper. |
338 */ | 339 */ |
339 | 340 |
340 struct feature_list_t { | 341 struct feature_list_t { |
341 hb_tag_t tag; | 342 hb_tag_t tag; |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 if (unlikely (!indic_plan)) | 546 if (unlikely (!indic_plan)) |
546 return NULL; | 547 return NULL; |
547 | 548 |
548 indic_plan->config = &indic_configs[0]; | 549 indic_plan->config = &indic_configs[0]; |
549 for (unsigned int i = 1; i < ARRAY_LENGTH (indic_configs); i++) | 550 for (unsigned int i = 1; i < ARRAY_LENGTH (indic_configs); i++) |
550 if (plan->props.script == indic_configs[i].script) { | 551 if (plan->props.script == indic_configs[i].script) { |
551 indic_plan->config = &indic_configs[i]; | 552 indic_plan->config = &indic_configs[i]; |
552 break; | 553 break; |
553 } | 554 } |
554 | 555 |
555 indic_plan->is_old_spec = indic_plan->config->has_old_spec && ((plan->map.chos
en_script[0] & 0x000000FF) != '2'); | 556 indic_plan->is_old_spec = indic_plan->config->has_old_spec && ((plan->map.chos
en_script[0] & 0x000000FFu) != '2'); |
556 indic_plan->virama_glyph = (hb_codepoint_t) -1; | 557 indic_plan->virama_glyph = (hb_codepoint_t) -1; |
557 | 558 |
558 /* Use zero-context would_substitute() matching for new-spec of the main | 559 /* Use zero-context would_substitute() matching for new-spec of the main |
559 * Indic scripts, but not for old-spec or scripts with one spec only. */ | 560 * Indic scripts, and scripts with one spec only, but not for old-specs. */ |
560 bool zero_context = indic_plan->config->has_old_spec || !indic_plan->is_old_sp
ec; | 561 bool zero_context = !indic_plan->is_old_spec; |
561 indic_plan->rphf.init (&plan->map, HB_TAG('r','p','h','f'), zero_context); | 562 indic_plan->rphf.init (&plan->map, HB_TAG('r','p','h','f'), zero_context); |
562 indic_plan->pref.init (&plan->map, HB_TAG('p','r','e','f'), zero_context); | 563 indic_plan->pref.init (&plan->map, HB_TAG('p','r','e','f'), zero_context); |
563 indic_plan->blwf.init (&plan->map, HB_TAG('b','l','w','f'), zero_context); | 564 indic_plan->blwf.init (&plan->map, HB_TAG('b','l','w','f'), zero_context); |
564 indic_plan->pstf.init (&plan->map, HB_TAG('p','s','t','f'), zero_context); | 565 indic_plan->pstf.init (&plan->map, HB_TAG('p','s','t','f'), zero_context); |
565 | 566 |
566 for (unsigned int i = 0; i < ARRAY_LENGTH (indic_plan->mask_array); i++) | 567 for (unsigned int i = 0; i < ARRAY_LENGTH (indic_plan->mask_array); i++) |
567 indic_plan->mask_array[i] = (indic_features[i].flags & F_GLOBAL) ? | 568 indic_plan->mask_array[i] = (indic_features[i].flags & F_GLOBAL) ? |
568 0 : plan->map.get_1_mask (indic_features[i].tag
); | 569 0 : plan->map.get_1_mask (indic_features[i].tag
); |
569 | 570 |
570 return indic_plan; | 571 return indic_plan; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 indic_plan->pref.would_substitute (glyphs+1, 1, face))) | 608 indic_plan->pref.would_substitute (glyphs+1, 1, face))) |
608 return POS_POST_C; | 609 return POS_POST_C; |
609 return POS_BASE_C; | 610 return POS_BASE_C; |
610 } | 611 } |
611 | 612 |
612 | 613 |
613 enum syllable_type_t { | 614 enum syllable_type_t { |
614 consonant_syllable, | 615 consonant_syllable, |
615 vowel_syllable, | 616 vowel_syllable, |
616 standalone_cluster, | 617 standalone_cluster, |
617 avagraha_cluster, | 618 symbol_cluster, |
618 broken_cluster, | 619 broken_cluster, |
619 non_indic_cluster, | 620 non_indic_cluster, |
620 }; | 621 }; |
621 | 622 |
622 #include "hb-ot-shape-complex-indic-machine.hh" | 623 #include "hb-ot-shape-complex-indic-machine.hh" |
623 | 624 |
624 | 625 |
625 static void | 626 static void |
626 setup_masks_indic (const hb_ot_shape_plan_t *plan HB_UNUSED, | 627 setup_masks_indic (const hb_ot_shape_plan_t *plan HB_UNUSED, |
627 hb_buffer_t *buffer, | 628 hb_buffer_t *buffer, |
628 hb_font_t *font HB_UNUSED) | 629 hb_font_t *font HB_UNUSED) |
629 { | 630 { |
630 HB_BUFFER_ALLOCATE_VAR (buffer, indic_category); | 631 HB_BUFFER_ALLOCATE_VAR (buffer, indic_category); |
631 HB_BUFFER_ALLOCATE_VAR (buffer, indic_position); | 632 HB_BUFFER_ALLOCATE_VAR (buffer, indic_position); |
632 | 633 |
633 /* We cannot setup masks here. We save information about characters | 634 /* We cannot setup masks here. We save information about characters |
634 * and setup masks later on in a pause-callback. */ | 635 * and setup masks later on in a pause-callback. */ |
635 | 636 |
636 unsigned int count = buffer->len; | 637 unsigned int count = buffer->len; |
| 638 hb_glyph_info_t *info = buffer->info; |
637 for (unsigned int i = 0; i < count; i++) | 639 for (unsigned int i = 0; i < count; i++) |
638 set_indic_properties (buffer->info[i]); | 640 set_indic_properties (info[i]); |
639 } | 641 } |
640 | 642 |
641 static void | 643 static void |
642 setup_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED, | 644 setup_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED, |
643 hb_font_t *font HB_UNUSED, | 645 hb_font_t *font HB_UNUSED, |
644 hb_buffer_t *buffer) | 646 hb_buffer_t *buffer) |
645 { | 647 { |
646 find_syllables (buffer); | 648 find_syllables (buffer); |
647 } | 649 } |
648 | 650 |
(...skipping 16 matching lines...) Expand all Loading... |
665 const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) plan->data
; | 667 const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) plan->data
; |
666 | 668 |
667 if (indic_plan->config->base_pos != BASE_POS_LAST) | 669 if (indic_plan->config->base_pos != BASE_POS_LAST) |
668 return; | 670 return; |
669 | 671 |
670 hb_codepoint_t virama; | 672 hb_codepoint_t virama; |
671 if (indic_plan->get_virama_glyph (font, &virama)) | 673 if (indic_plan->get_virama_glyph (font, &virama)) |
672 { | 674 { |
673 hb_face_t *face = font->face; | 675 hb_face_t *face = font->face; |
674 unsigned int count = buffer->len; | 676 unsigned int count = buffer->len; |
| 677 hb_glyph_info_t *info = buffer->info; |
675 for (unsigned int i = 0; i < count; i++) | 678 for (unsigned int i = 0; i < count; i++) |
676 if (buffer->info[i].indic_position() == POS_BASE_C) { | 679 if (info[i].indic_position() == POS_BASE_C) |
677 » hb_codepoint_t consonant = buffer->info[i].codepoint; | 680 { |
678 » buffer->info[i].indic_position() = consonant_position_from_face (indic_p
lan, consonant, virama, face); | 681 » hb_codepoint_t consonant = info[i].codepoint; |
| 682 » info[i].indic_position() = consonant_position_from_face (indic_plan, con
sonant, virama, face); |
679 } | 683 } |
680 } | 684 } |
681 } | 685 } |
682 | 686 |
683 | 687 |
684 /* Rules from: | 688 /* Rules from: |
685 * https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx */ | 689 * https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx */ |
686 | 690 |
687 static void | 691 static void |
688 initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, | 692 initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, |
(...skipping 29 matching lines...) Expand all Loading... |
718 unsigned int limit = start; | 722 unsigned int limit = start; |
719 if (indic_plan->config->reph_pos != REPH_POS_DONT_CARE && | 723 if (indic_plan->config->reph_pos != REPH_POS_DONT_CARE && |
720 indic_plan->mask_array[RPHF] && | 724 indic_plan->mask_array[RPHF] && |
721 start + 3 <= end && | 725 start + 3 <= end && |
722 ( | 726 ( |
723 (indic_plan->config->reph_mode == REPH_MODE_IMPLICIT && !is_joiner (inf
o[start + 2])) || | 727 (indic_plan->config->reph_mode == REPH_MODE_IMPLICIT && !is_joiner (inf
o[start + 2])) || |
724 (indic_plan->config->reph_mode == REPH_MODE_EXPLICIT && info[start + 2]
.indic_category() == OT_ZWJ) | 728 (indic_plan->config->reph_mode == REPH_MODE_EXPLICIT && info[start + 2]
.indic_category() == OT_ZWJ) |
725 )) | 729 )) |
726 { | 730 { |
727 /* See if it matches the 'rphf' feature. */ | 731 /* See if it matches the 'rphf' feature. */ |
728 hb_codepoint_t glyphs[2] = {info[start].codepoint, info[start + 1].codepoi
nt}; | 732 hb_codepoint_t glyphs[3] = {info[start].codepoint, |
729 if (indic_plan->rphf.would_substitute (glyphs, ARRAY_LENGTH (glyphs), face
)) | 733 » » » » info[start + 1].codepoint, |
| 734 » » » » indic_plan->config->reph_mode == REPH_MODE_EXP
LICIT ? |
| 735 » » » » info[start + 2].codepoint : 0}; |
| 736 if (indic_plan->rphf.would_substitute (glyphs, 2, face) || |
| 737 » (indic_plan->config->reph_mode == REPH_MODE_EXPLICIT && |
| 738 » indic_plan->rphf.would_substitute (glyphs, 3, face))) |
730 { | 739 { |
731 limit += 2; | 740 limit += 2; |
732 while (limit < end && is_joiner (info[limit])) | 741 while (limit < end && is_joiner (info[limit])) |
733 limit++; | 742 limit++; |
734 base = start; | 743 base = start; |
735 has_reph = true; | 744 has_reph = true; |
736 } | 745 } |
737 } else if (indic_plan->config->reph_mode == REPH_MODE_LOG_REPHA && info[star
t].indic_category() == OT_Repha) | 746 } else if (indic_plan->config->reph_mode == REPH_MODE_LOG_REPHA && info[star
t].indic_category() == OT_Repha) |
738 { | 747 { |
739 limit += 1; | 748 limit += 1; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 info[i - 1].indic_category() == OT_H) | 803 info[i - 1].indic_category() == OT_H) |
795 break; | 804 break; |
796 } | 805 } |
797 } while (i > limit); | 806 } while (i > limit); |
798 } | 807 } |
799 break; | 808 break; |
800 | 809 |
801 case BASE_POS_LAST_SINHALA: | 810 case BASE_POS_LAST_SINHALA: |
802 { | 811 { |
803 /* Sinhala base positioning is slightly different from main Indic, in th
at: | 812 /* Sinhala base positioning is slightly different from main Indic, in th
at: |
804 » * 1. It's ZWJ behavior is different, | 813 » * 1. Its ZWJ behavior is different, |
805 * 2. We don't need to look into the font for consonant positions. | 814 * 2. We don't need to look into the font for consonant positions. |
806 */ | 815 */ |
807 | 816 |
808 if (!has_reph) | 817 if (!has_reph) |
809 base = limit; | 818 base = limit; |
810 | 819 |
811 /* Find the last base consonant that is not blocked by ZWJ. If there is | 820 /* Find the last base consonant that is not blocked by ZWJ. If there is |
812 * a ZWJ right before a base consonant, that would request a subjoined f
orm. */ | 821 * a ZWJ right before a base consonant, that would request a subjoined f
orm. */ |
813 for (unsigned int i = limit; i < end; i++) | 822 for (unsigned int i = limit; i < end; i++) |
814 if (is_consonant (info[i])) | 823 if (is_consonant (info[i])) |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 /* We made the vowels look like consonants. So let's call the consonant logic
! */ | 1153 /* We made the vowels look like consonants. So let's call the consonant logic
! */ |
1145 initial_reordering_consonant_syllable (plan, face, buffer, start, end); | 1154 initial_reordering_consonant_syllable (plan, face, buffer, start, end); |
1146 } | 1155 } |
1147 | 1156 |
1148 static void | 1157 static void |
1149 initial_reordering_standalone_cluster (const hb_ot_shape_plan_t *plan, | 1158 initial_reordering_standalone_cluster (const hb_ot_shape_plan_t *plan, |
1150 hb_face_t *face, | 1159 hb_face_t *face, |
1151 hb_buffer_t *buffer, | 1160 hb_buffer_t *buffer, |
1152 unsigned int start, unsigned int end) | 1161 unsigned int start, unsigned int end) |
1153 { | 1162 { |
1154 /* We treat NBSP/dotted-circle as if they are consonants, so we should just ch
ain. | 1163 /* We treat placeholder/dotted-circle as if they are consonants, so we |
1155 * Only if not in compatibility mode that is... */ | 1164 * should just chain. Only if not in compatibility mode that is... */ |
1156 | 1165 |
1157 if (hb_options ().uniscribe_bug_compatible) | 1166 if (hb_options ().uniscribe_bug_compatible) |
1158 { | 1167 { |
1159 /* For dotted-circle, this is what Uniscribe does: | 1168 /* For dotted-circle, this is what Uniscribe does: |
1160 * If dotted-circle is the last glyph, it just does nothing. | 1169 * If dotted-circle is the last glyph, it just does nothing. |
1161 * Ie. It doesn't form Reph. */ | 1170 * Ie. It doesn't form Reph. */ |
1162 if (buffer->info[end - 1].indic_category() == OT_DOTTEDCIRCLE) | 1171 if (buffer->info[end - 1].indic_category() == OT_DOTTEDCIRCLE) |
1163 return; | 1172 return; |
1164 } | 1173 } |
1165 | 1174 |
1166 initial_reordering_consonant_syllable (plan, face, buffer, start, end); | 1175 initial_reordering_consonant_syllable (plan, face, buffer, start, end); |
1167 } | 1176 } |
1168 | 1177 |
1169 static void | 1178 static void |
1170 initial_reordering_broken_cluster (const hb_ot_shape_plan_t *plan, | 1179 initial_reordering_broken_cluster (const hb_ot_shape_plan_t *plan, |
1171 hb_face_t *face, | 1180 hb_face_t *face, |
1172 hb_buffer_t *buffer, | 1181 hb_buffer_t *buffer, |
1173 unsigned int start, unsigned int end) | 1182 unsigned int start, unsigned int end) |
1174 { | 1183 { |
1175 /* We already inserted dotted-circles, so just call the standalone_cluster. */ | 1184 /* We already inserted dotted-circles, so just call the standalone_cluster. */ |
1176 initial_reordering_standalone_cluster (plan, face, buffer, start, end); | 1185 initial_reordering_standalone_cluster (plan, face, buffer, start, end); |
1177 } | 1186 } |
1178 | 1187 |
1179 static void | 1188 static void |
1180 initial_reordering_avagraha_cluster (const hb_ot_shape_plan_t *plan HB_UNUSED, | 1189 initial_reordering_symbol_cluster (const hb_ot_shape_plan_t *plan HB_UNUSED, |
1181 » » » » hb_face_t *face HB_UNUSED, | 1190 » » » » hb_face_t *face HB_UNUSED, |
1182 » » » » hb_buffer_t *buffer HB_UNUSED, | 1191 » » » » hb_buffer_t *buffer HB_UNUSED, |
1183 » » » » unsigned int start HB_UNUSED, unsigned int
end HB_UNUSED) | 1192 » » » » unsigned int start HB_UNUSED, unsigned int en
d HB_UNUSED) |
1184 { | 1193 { |
1185 /* Nothing to do right now. If we ever switch to using the output | 1194 /* Nothing to do right now. If we ever switch to using the output |
1186 * buffer in the reordering process, we'd need to next_glyph() here. */ | 1195 * buffer in the reordering process, we'd need to next_glyph() here. */ |
1187 } | 1196 } |
1188 | 1197 |
1189 static void | 1198 static void |
1190 initial_reordering_non_indic_cluster (const hb_ot_shape_plan_t *plan HB_UNUSED, | 1199 initial_reordering_non_indic_cluster (const hb_ot_shape_plan_t *plan HB_UNUSED, |
1191 hb_face_t *face HB_UNUSED, | 1200 hb_face_t *face HB_UNUSED, |
1192 hb_buffer_t *buffer HB_UNUSED, | 1201 hb_buffer_t *buffer HB_UNUSED, |
1193 unsigned int start HB_UNUSED, unsigned int
end HB_UNUSED) | 1202 unsigned int start HB_UNUSED, unsigned int
end HB_UNUSED) |
1194 { | 1203 { |
1195 /* Nothing to do right now. If we ever switch to using the output | 1204 /* Nothing to do right now. If we ever switch to using the output |
1196 * buffer in the reordering process, we'd need to next_glyph() here. */ | 1205 * buffer in the reordering process, we'd need to next_glyph() here. */ |
1197 } | 1206 } |
1198 | 1207 |
1199 | 1208 |
1200 static void | 1209 static void |
1201 initial_reordering_syllable (const hb_ot_shape_plan_t *plan, | 1210 initial_reordering_syllable (const hb_ot_shape_plan_t *plan, |
1202 hb_face_t *face, | 1211 hb_face_t *face, |
1203 hb_buffer_t *buffer, | 1212 hb_buffer_t *buffer, |
1204 unsigned int start, unsigned int end) | 1213 unsigned int start, unsigned int end) |
1205 { | 1214 { |
1206 syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllabl
e() & 0x0F); | 1215 syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllabl
e() & 0x0F); |
1207 switch (syllable_type) { | 1216 switch (syllable_type) { |
1208 case consonant_syllable: initial_reordering_consonant_syllable (plan, fac
e, buffer, start, end); return; | 1217 case consonant_syllable: initial_reordering_consonant_syllable (plan, fac
e, buffer, start, end); return; |
1209 case vowel_syllable: initial_reordering_vowel_syllable (plan, fac
e, buffer, start, end); return; | 1218 case vowel_syllable: initial_reordering_vowel_syllable (plan, fac
e, buffer, start, end); return; |
1210 case standalone_cluster: initial_reordering_standalone_cluster (plan, fac
e, buffer, start, end); return; | 1219 case standalone_cluster: initial_reordering_standalone_cluster (plan, fac
e, buffer, start, end); return; |
1211 case avagraha_cluster:» initial_reordering_avagraha_cluster (plan, fac
e, buffer, start, end); return; | 1220 case symbol_cluster:» » initial_reordering_symbol_cluster (plan, fac
e, buffer, start, end); return; |
1212 case broken_cluster: initial_reordering_broken_cluster (plan, fac
e, buffer, start, end); return; | 1221 case broken_cluster: initial_reordering_broken_cluster (plan, fac
e, buffer, start, end); return; |
1213 case non_indic_cluster: initial_reordering_non_indic_cluster (plan, fac
e, buffer, start, end); return; | 1222 case non_indic_cluster: initial_reordering_non_indic_cluster (plan, fac
e, buffer, start, end); return; |
1214 } | 1223 } |
1215 } | 1224 } |
1216 | 1225 |
1217 static inline void | 1226 static inline void |
1218 insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, | 1227 insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, |
1219 hb_font_t *font, | 1228 hb_font_t *font, |
1220 hb_buffer_t *buffer) | 1229 hb_buffer_t *buffer) |
1221 { | 1230 { |
1222 /* Note: This loop is extra overhead, but should not be measurable. */ | 1231 /* Note: This loop is extra overhead, but should not be measurable. */ |
1223 bool has_broken_syllables = false; | 1232 bool has_broken_syllables = false; |
1224 unsigned int count = buffer->len; | 1233 unsigned int count = buffer->len; |
| 1234 hb_glyph_info_t *info = buffer->info; |
1225 for (unsigned int i = 0; i < count; i++) | 1235 for (unsigned int i = 0; i < count; i++) |
1226 if ((buffer->info[i].syllable() & 0x0F) == broken_cluster) { | 1236 if ((info[i].syllable() & 0x0F) == broken_cluster) |
| 1237 { |
1227 has_broken_syllables = true; | 1238 has_broken_syllables = true; |
1228 break; | 1239 break; |
1229 } | 1240 } |
1230 if (likely (!has_broken_syllables)) | 1241 if (likely (!has_broken_syllables)) |
1231 return; | 1242 return; |
1232 | 1243 |
1233 | 1244 |
1234 hb_codepoint_t dottedcircle_glyph; | 1245 hb_codepoint_t dottedcircle_glyph; |
1235 if (!font->get_glyph (0x25CC, 0, &dottedcircle_glyph)) | 1246 if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph)) |
1236 return; | 1247 return; |
1237 | 1248 |
1238 hb_glyph_info_t dottedcircle = {0}; | 1249 hb_glyph_info_t dottedcircle = {0}; |
1239 dottedcircle.codepoint = 0x25CC; | 1250 dottedcircle.codepoint = 0x25CCu; |
1240 set_indic_properties (dottedcircle); | 1251 set_indic_properties (dottedcircle); |
1241 dottedcircle.codepoint = dottedcircle_glyph; | 1252 dottedcircle.codepoint = dottedcircle_glyph; |
1242 | 1253 |
1243 buffer->clear_output (); | 1254 buffer->clear_output (); |
1244 | 1255 |
1245 buffer->idx = 0; | 1256 buffer->idx = 0; |
1246 unsigned int last_syllable = 0; | 1257 unsigned int last_syllable = 0; |
1247 while (buffer->idx < buffer->len) | 1258 while (buffer->idx < buffer->len) |
1248 { | 1259 { |
1249 unsigned int syllable = buffer->cur().syllable(); | 1260 unsigned int syllable = buffer->cur().syllable(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 } | 1306 } |
1296 | 1307 |
1297 static void | 1308 static void |
1298 final_reordering_syllable (const hb_ot_shape_plan_t *plan, | 1309 final_reordering_syllable (const hb_ot_shape_plan_t *plan, |
1299 hb_buffer_t *buffer, | 1310 hb_buffer_t *buffer, |
1300 unsigned int start, unsigned int end) | 1311 unsigned int start, unsigned int end) |
1301 { | 1312 { |
1302 const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) plan->data
; | 1313 const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) plan->data
; |
1303 hb_glyph_info_t *info = buffer->info; | 1314 hb_glyph_info_t *info = buffer->info; |
1304 | 1315 |
| 1316 |
| 1317 /* This function relies heavily on halant glyphs. Lots of ligation |
| 1318 * and possibly multiplication substitutions happened prior to this |
| 1319 * phase, and that might have messed up our properties. Recover |
| 1320 * from a particular case of that where we're fairly sure that a |
| 1321 * class of OT_H is desired but has been lost. */ |
| 1322 if (indic_plan->virama_glyph) |
| 1323 { |
| 1324 unsigned int virama_glyph = indic_plan->virama_glyph; |
| 1325 for (unsigned int i = start; i < end; i++) |
| 1326 if (info[i].codepoint == virama_glyph && |
| 1327 _hb_glyph_info_ligated (&info[i]) && |
| 1328 _hb_glyph_info_multiplied (&info[i])) |
| 1329 { |
| 1330 /* This will make sure that this glyph passes is_halant_or_coeng() test.
*/ |
| 1331 info[i].indic_category() = OT_H; |
| 1332 _hb_glyph_info_clear_ligated_and_multiplied (&info[i]); |
| 1333 } |
| 1334 } |
| 1335 |
| 1336 |
1305 /* 4. Final reordering: | 1337 /* 4. Final reordering: |
1306 * | 1338 * |
1307 * After the localized forms and basic shaping forms GSUB features have been | 1339 * After the localized forms and basic shaping forms GSUB features have been |
1308 * applied (see below), the shaping engine performs some final glyph | 1340 * applied (see below), the shaping engine performs some final glyph |
1309 * reordering before applying all the remaining font features to the entire | 1341 * reordering before applying all the remaining font features to the entire |
1310 * cluster. | 1342 * cluster. |
1311 */ | 1343 */ |
1312 | 1344 |
| 1345 bool try_pref = !!indic_plan->mask_array[PREF]; |
| 1346 |
1313 /* Find base again */ | 1347 /* Find base again */ |
1314 unsigned int base; | 1348 unsigned int base; |
1315 for (base = start; base < end; base++) | 1349 for (base = start; base < end; base++) |
1316 if (info[base].indic_position() >= POS_BASE_C) { | 1350 if (info[base].indic_position() >= POS_BASE_C) |
| 1351 { |
| 1352 if (try_pref && base + 1 < end && indic_plan->config->pref_len == 2) |
| 1353 { |
| 1354 » for (unsigned int i = base + 1; i < end; i++) |
| 1355 » if ((info[i].mask & indic_plan->mask_array[PREF]) != 0) |
| 1356 » { |
| 1357 » if (!(_hb_glyph_info_substituted (&info[i]) && |
| 1358 » » _hb_glyph_info_ligated_and_didnt_multiply (&info[i]))) |
| 1359 » { |
| 1360 » /* Ok, this was a 'pref' candidate but didn't form any. |
| 1361 » * Base is around here... */ |
| 1362 » base = i; |
| 1363 » while (base < end && is_halant_or_coeng (info[base])) |
| 1364 » » base++; |
| 1365 » info[base].indic_position() = POS_BASE_C; |
| 1366 |
| 1367 » try_pref = false; |
| 1368 » } |
| 1369 » break; |
| 1370 » } |
| 1371 } |
| 1372 |
1317 if (start < base && info[base].indic_position() > POS_BASE_C) | 1373 if (start < base && info[base].indic_position() > POS_BASE_C) |
1318 base--; | 1374 base--; |
1319 break; | 1375 break; |
1320 } | 1376 } |
1321 if (base == end && start < base && | 1377 if (base == end && start < base && |
1322 info[base - 1].indic_category() != OT_ZWJ) | 1378 is_one_of (info[base - 1], FLAG (OT_ZWJ))) |
1323 base--; | 1379 base--; |
1324 while (start < base && | 1380 if (base < end) |
1325 » (info[base].indic_category() == OT_H || | 1381 while (start < base && |
1326 » info[base].indic_category() == OT_N)) | 1382 » is_one_of (info[base], (FLAG (OT_N) | HALANT_OR_COENG_FLAGS))) |
1327 base--; | 1383 base--; |
1328 | 1384 |
1329 | 1385 |
1330 /* o Reorder matras: | 1386 /* o Reorder matras: |
1331 * | 1387 * |
1332 * If a pre-base matra character had been reordered before applying basic | 1388 * If a pre-base matra character had been reordered before applying basic |
1333 * features, the glyph can be moved closer to the main consonant based on | 1389 * features, the glyph can be moved closer to the main consonant based on |
1334 * whether half-forms had been formed. Actual position for the matra is | 1390 * whether half-forms had been formed. Actual position for the matra is |
1335 * defined as “after last standalone halant glyph, after initial matra | 1391 * defined as “after last standalone halant glyph, after initial matra |
1336 * position and before the main consonant”. If ZWJ or ZWNJ follow this | 1392 * position and before the main consonant”. If ZWJ or ZWNJ follow this |
1337 * halant, position is moved after it. | 1393 * halant, position is moved after it. |
1338 */ | 1394 */ |
1339 | 1395 |
1340 if (start + 1 < end && start < base) /* Otherwise there can't be any pre-base
matra characters. */ | 1396 if (start + 1 < end && start < base) /* Otherwise there can't be any pre-base
matra characters. */ |
1341 { | 1397 { |
1342 /* If we lost track of base, alas, position before last thingy. */ | 1398 /* If we lost track of base, alas, position before last thingy. */ |
1343 unsigned int new_pos = base == end ? base - 2 : base - 1; | 1399 unsigned int new_pos = base == end ? base - 2 : base - 1; |
1344 | 1400 |
1345 /* Malayalam / Tamil do not have "half" forms or explicit virama forms. | 1401 /* Malayalam / Tamil do not have "half" forms or explicit virama forms. |
1346 * The glyphs formed by 'half' are Chillus or ligated explicit viramas. | 1402 * The glyphs formed by 'half' are Chillus or ligated explicit viramas. |
1347 * We want to position matra after them. | 1403 * We want to position matra after them. |
1348 */ | 1404 */ |
1349 if (buffer->props.script != HB_SCRIPT_MALAYALAM && buffer->props.script != H
B_SCRIPT_TAMIL) | 1405 if (buffer->props.script != HB_SCRIPT_MALAYALAM && buffer->props.script != H
B_SCRIPT_TAMIL) |
1350 { | 1406 { |
1351 while (new_pos > start && | 1407 while (new_pos > start && |
1352 » !(is_one_of (info[new_pos], (FLAG (OT_M) | FLAG (OT_H) | FLAG (OT_C
oeng))))) | 1408 » !(is_one_of (info[new_pos], (FLAG (OT_M) | HALANT_OR_COENG_FLAGS)))
) |
1353 new_pos--; | 1409 new_pos--; |
1354 | 1410 |
1355 /* If we found no Halant we are done. | 1411 /* If we found no Halant we are done. |
1356 * Otherwise only proceed if the Halant does | 1412 * Otherwise only proceed if the Halant does |
1357 * not belong to the Matra itself! */ | 1413 * not belong to the Matra itself! */ |
1358 if (is_halant_or_coeng (info[new_pos]) && | 1414 if (is_halant_or_coeng (info[new_pos]) && |
1359 info[new_pos].indic_position() != POS_PRE_M) | 1415 info[new_pos].indic_position() != POS_PRE_M) |
1360 { | 1416 { |
1361 /* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */ | 1417 /* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */ |
1362 if (new_pos + 1 < end && is_joiner (info[new_pos + 1])) | 1418 if (new_pos + 1 < end && is_joiner (info[new_pos + 1])) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1405 * - If repha is encoded as a sequence of characters (Ra,H or Ra,H,ZWJ), then | 1461 * - If repha is encoded as a sequence of characters (Ra,H or Ra,H,ZWJ), then |
1406 * we should only move it if the sequence ligated to the repha form. | 1462 * we should only move it if the sequence ligated to the repha form. |
1407 * | 1463 * |
1408 * - If repha is encoded separately and in the logical position, we should onl
y | 1464 * - If repha is encoded separately and in the logical position, we should onl
y |
1409 * move it if it did NOT ligate. If it ligated, it's probably the font tryi
ng | 1465 * move it if it did NOT ligate. If it ligated, it's probably the font tryi
ng |
1410 * to make it work without the reordering. | 1466 * to make it work without the reordering. |
1411 */ | 1467 */ |
1412 if (start + 1 < end && | 1468 if (start + 1 < end && |
1413 info[start].indic_position() == POS_RA_TO_BECOME_REPH && | 1469 info[start].indic_position() == POS_RA_TO_BECOME_REPH && |
1414 ((info[start].indic_category() == OT_Repha) ^ | 1470 ((info[start].indic_category() == OT_Repha) ^ |
1415 _hb_glyph_info_ligated (&info[start]))) | 1471 _hb_glyph_info_ligated_and_didnt_multiply (&info[start]))) |
1416 { | 1472 { |
1417 unsigned int new_reph_pos; | 1473 unsigned int new_reph_pos; |
1418 reph_position_t reph_pos = indic_plan->config->reph_pos; | 1474 reph_position_t reph_pos = indic_plan->config->reph_pos; |
1419 | 1475 |
1420 assert (reph_pos != REPH_POS_DONT_CARE); | 1476 assert (reph_pos != REPH_POS_DONT_CARE); |
1421 | 1477 |
1422 /* 1. If reph should be positioned after post-base consonant forms, | 1478 /* 1. If reph should be positioned after post-base consonant forms, |
1423 * proceed to step 5. | 1479 * proceed to step 5. |
1424 */ | 1480 */ |
1425 if (reph_pos == REPH_POS_AFTER_POST) | 1481 if (reph_pos == REPH_POS_AFTER_POST) |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 } | 1598 } |
1543 } | 1599 } |
1544 | 1600 |
1545 | 1601 |
1546 /* o Reorder pre-base reordering consonants: | 1602 /* o Reorder pre-base reordering consonants: |
1547 * | 1603 * |
1548 * If a pre-base reordering consonant is found, reorder it according to | 1604 * If a pre-base reordering consonant is found, reorder it according to |
1549 * the following rules: | 1605 * the following rules: |
1550 */ | 1606 */ |
1551 | 1607 |
1552 if (indic_plan->mask_array[PREF] && base + 1 < end) /* Otherwise there can't b
e any pre-base reordering Ra. */ | 1608 if (try_pref && base + 1 < end) /* Otherwise there can't be any pre-base reord
ering Ra. */ |
1553 { | 1609 { |
1554 unsigned int pref_len = indic_plan->config->pref_len; | 1610 unsigned int pref_len = indic_plan->config->pref_len; |
1555 for (unsigned int i = base + 1; i < end; i++) | 1611 for (unsigned int i = base + 1; i < end; i++) |
1556 if ((info[i].mask & indic_plan->mask_array[PREF]) != 0) | 1612 if ((info[i].mask & indic_plan->mask_array[PREF]) != 0) |
1557 { | 1613 { |
1558 /* 1. Only reorder a glyph produced by substitution during applica
tion | 1614 /* 1. Only reorder a glyph produced by substitution during applica
tion |
1559 * of the <pref> feature. (Note that a font may shape a Ra cons
onant with | 1615 * of the <pref> feature. (Note that a font may shape a Ra cons
onant with |
1560 * the feature generally but block it in certain contexts.) | 1616 * the feature generally but block it in certain contexts.) |
1561 */ | 1617 */ |
1562 /* Note: We just check that something got substituted. We don't check t
hat | 1618 /* Note: We just check that something got substituted. We don't check t
hat |
1563 * the <pref> feature actually did it... | 1619 * the <pref> feature actually did it... |
1564 * | 1620 * |
1565 * If pref len is longer than one, then only reorder if it ligated. If | 1621 * If pref len is longer than one, then only reorder if it ligated. If |
1566 * pref len is one, only reorder if it didn't ligate with other things.
*/ | 1622 * pref len is one, only reorder if it didn't ligate with other things.
*/ |
1567 if (_hb_glyph_info_substituted (&info[i]) && | 1623 if (_hb_glyph_info_substituted (&info[i]) && |
1568 » ((pref_len == 1) ^ _hb_glyph_info_ligated (&info[i]))) | 1624 » ((pref_len == 1) ^ _hb_glyph_info_ligated_and_didnt_multiply (&info[
i]))) |
1569 { | 1625 { |
1570 /* | 1626 /* |
1571 * 2. Try to find a target position the same way as for pre-base
matra. | 1627 * 2. Try to find a target position the same way as for pre-base
matra. |
1572 * If it is found, reorder pre-base consonant glyph. | 1628 * If it is found, reorder pre-base consonant glyph. |
1573 * | 1629 * |
1574 * 3. If position is not found, reorder immediately before main | 1630 * 3. If position is not found, reorder immediately before main |
1575 * consonant. | 1631 * consonant. |
1576 */ | 1632 */ |
1577 | 1633 |
1578 unsigned int new_pos = base; | 1634 unsigned int new_pos = base; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 | 1748 |
1693 static bool | 1749 static bool |
1694 decompose_indic (const hb_ot_shape_normalize_context_t *c, | 1750 decompose_indic (const hb_ot_shape_normalize_context_t *c, |
1695 hb_codepoint_t ab, | 1751 hb_codepoint_t ab, |
1696 hb_codepoint_t *a, | 1752 hb_codepoint_t *a, |
1697 hb_codepoint_t *b) | 1753 hb_codepoint_t *b) |
1698 { | 1754 { |
1699 switch (ab) | 1755 switch (ab) |
1700 { | 1756 { |
1701 /* Don't decompose these. */ | 1757 /* Don't decompose these. */ |
1702 case 0x0931 : return false; | 1758 case 0x0931u : return false; |
1703 case 0x0B94 : return false; | 1759 case 0x0B94u : return false; |
1704 | 1760 |
1705 | 1761 |
1706 /* | 1762 /* |
1707 * Decompose split matras that don't have Unicode decompositions. | 1763 * Decompose split matras that don't have Unicode decompositions. |
1708 */ | 1764 */ |
1709 | 1765 |
1710 case 0x0F77 : *a = 0x0FB2; *b= 0x0F81; return true; | 1766 case 0x0F77u : *a = 0x0FB2u; *b= 0x0F81u; return true; |
1711 case 0x0F79 : *a = 0x0FB3; *b= 0x0F81; return true; | 1767 case 0x0F79u : *a = 0x0FB3u; *b= 0x0F81u; return true; |
1712 case 0x17BE : *a = 0x17C1; *b= 0x17BE; return true; | 1768 case 0x17BEu : *a = 0x17C1u; *b= 0x17BEu; return true; |
1713 case 0x17BF : *a = 0x17C1; *b= 0x17BF; return true; | 1769 case 0x17BFu : *a = 0x17C1u; *b= 0x17BFu; return true; |
1714 case 0x17C0 : *a = 0x17C1; *b= 0x17C0; return true; | 1770 case 0x17C0u : *a = 0x17C1u; *b= 0x17C0u; return true; |
1715 case 0x17C4 : *a = 0x17C1; *b= 0x17C4; return true; | 1771 case 0x17C4u : *a = 0x17C1u; *b= 0x17C4u; return true; |
1716 case 0x17C5 : *a = 0x17C1; *b= 0x17C5; return true; | 1772 case 0x17C5u : *a = 0x17C1u; *b= 0x17C5u; return true; |
1717 case 0x1925 : *a = 0x1920; *b= 0x1923; return true; | 1773 case 0x1925u : *a = 0x1920u; *b= 0x1923u; return true; |
1718 case 0x1926 : *a = 0x1920; *b= 0x1924; return true; | 1774 case 0x1926u : *a = 0x1920u; *b= 0x1924u; return true; |
1719 case 0x1B3C : *a = 0x1B42; *b= 0x1B3C; return true; | 1775 case 0x1B3Cu : *a = 0x1B42u; *b= 0x1B3Cu; return true; |
1720 case 0x1112E : *a = 0x11127; *b= 0x11131; return true; | 1776 case 0x1112Eu : *a = 0x11127u; *b= 0x11131u; return true; |
1721 case 0x1112F : *a = 0x11127; *b= 0x11132; return true; | 1777 case 0x1112Fu : *a = 0x11127u; *b= 0x11132u; return true; |
1722 #if 0 | 1778 #if 0 |
1723 /* This one has no decomposition in Unicode, but needs no decomposition eith
er. */ | 1779 /* This one has no decomposition in Unicode, but needs no decomposition eith
er. */ |
1724 /* case 0x0AC9 : return false; */ | 1780 /* case 0x0AC9u : return false; */ |
1725 case 0x0B57 : *a = no decomp, -> RIGHT; return true; | 1781 case 0x0B57u : *a = no decomp, -> RIGHT; return true; |
1726 case 0x1C29 : *a = no decomp, -> LEFT; return true; | 1782 case 0x1C29u : *a = no decomp, -> LEFT; return true; |
1727 case 0xA9C0 : *a = no decomp, -> RIGHT; return true; | 1783 case 0xA9C0u : *a = no decomp, -> RIGHT; return true; |
1728 case 0x111BF : *a = no decomp, -> ABOVE; return true; | 1784 case 0x111BuF : *a = no decomp, -> ABOVE; return true; |
1729 #endif | 1785 #endif |
1730 } | 1786 } |
1731 | 1787 |
1732 if ((ab == 0x0DDA || hb_in_range<hb_codepoint_t> (ab, 0x0DDC, 0x0DDE))) | 1788 if ((ab == 0x0DDAu || hb_in_range (ab, 0x0DDCu, 0x0DDEu))) |
1733 { | 1789 { |
1734 /* | 1790 /* |
1735 * Sinhala split matras... Let the fun begin. | 1791 * Sinhala split matras... Let the fun begin. |
1736 * | 1792 * |
1737 * These four characters have Unicode decompositions. However, Uniscribe | 1793 * These four characters have Unicode decompositions. However, Uniscribe |
1738 * decomposes them "Khmer-style", that is, it uses the character itself to | 1794 * decomposes them "Khmer-style", that is, it uses the character itself to |
1739 * get the second half. The first half of all four decompositions is always | 1795 * get the second half. The first half of all four decompositions is always |
1740 * U+0DD9. | 1796 * U+0DD9. |
1741 * | 1797 * |
1742 * Now, there are buggy fonts, namely, the widely used lklug.ttf, that are | 1798 * Now, there are buggy fonts, namely, the widely used lklug.ttf, that are |
(...skipping 16 matching lines...) Expand all Loading... |
1759 | 1815 |
1760 const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) c->plan-
>data; | 1816 const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) c->plan-
>data; |
1761 | 1817 |
1762 hb_codepoint_t glyph; | 1818 hb_codepoint_t glyph; |
1763 | 1819 |
1764 if (hb_options ().uniscribe_bug_compatible || | 1820 if (hb_options ().uniscribe_bug_compatible || |
1765 (c->font->get_glyph (ab, 0, &glyph) && | 1821 (c->font->get_glyph (ab, 0, &glyph) && |
1766 indic_plan->pstf.would_substitute (&glyph, 1, c->font->face))) | 1822 indic_plan->pstf.would_substitute (&glyph, 1, c->font->face))) |
1767 { | 1823 { |
1768 /* Ok, safe to use Uniscribe-style decomposition. */ | 1824 /* Ok, safe to use Uniscribe-style decomposition. */ |
1769 *a = 0x0DD9; | 1825 *a = 0x0DD9u; |
1770 *b = ab; | 1826 *b = ab; |
1771 return true; | 1827 return true; |
1772 } | 1828 } |
1773 } | 1829 } |
1774 | 1830 |
1775 return c->unicode->decompose (ab, a, b); | 1831 return c->unicode->decompose (ab, a, b); |
1776 } | 1832 } |
1777 | 1833 |
1778 static bool | 1834 static bool |
1779 compose_indic (const hb_ot_shape_normalize_context_t *c, | 1835 compose_indic (const hb_ot_shape_normalize_context_t *c, |
1780 hb_codepoint_t a, | 1836 hb_codepoint_t a, |
1781 hb_codepoint_t b, | 1837 hb_codepoint_t b, |
1782 hb_codepoint_t *ab) | 1838 hb_codepoint_t *ab) |
1783 { | 1839 { |
1784 /* Avoid recomposing split matras. */ | 1840 /* Avoid recomposing split matras. */ |
1785 if (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (c->unicode->general_category (a))) | 1841 if (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (c->unicode->general_category (a))) |
1786 return false; | 1842 return false; |
1787 | 1843 |
1788 /* Composition-exclusion exceptions that we want to recompose. */ | 1844 /* Composition-exclusion exceptions that we want to recompose. */ |
1789 if (a == 0x09AF && b == 0x09BC) { *ab = 0x09DF; return true; } | 1845 if (a == 0x09AFu && b == 0x09BCu) { *ab = 0x09DFu; return true; } |
1790 | 1846 |
1791 return c->unicode->compose (a, b, ab); | 1847 return c->unicode->compose (a, b, ab); |
1792 } | 1848 } |
1793 | 1849 |
1794 | 1850 |
1795 const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic = | 1851 const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic = |
1796 { | 1852 { |
1797 "indic", | 1853 "indic", |
1798 collect_features_indic, | 1854 collect_features_indic, |
1799 override_features_indic, | 1855 override_features_indic, |
1800 data_create_indic, | 1856 data_create_indic, |
1801 data_destroy_indic, | 1857 data_destroy_indic, |
1802 NULL, /* preprocess_text */ | 1858 NULL, /* preprocess_text */ |
1803 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, | 1859 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, |
1804 decompose_indic, | 1860 decompose_indic, |
1805 compose_indic, | 1861 compose_indic, |
1806 setup_masks_indic, | 1862 setup_masks_indic, |
1807 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, | 1863 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, |
1808 false, /* fallback_position */ | 1864 false, /* fallback_position */ |
1809 }; | 1865 }; |
OLD | NEW |