../3rdparty/harfbuzz/src/harfbuzz-myanmar.c

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3enum MymrCharClassValues -
4{ -
5 Mymr_CC_RESERVED = 0, -
6 Mymr_CC_CONSONANT = 1, -
7 Mymr_CC_CONSONANT2 = 2, -
8 Mymr_CC_NGA = 3, -
9 Mymr_CC_YA = 4, -
10 Mymr_CC_RA = 5, -
11 Mymr_CC_WA = 6, -
12 Mymr_CC_HA = 7, -
13 Mymr_CC_IND_VOWEL = 8, -
14 Mymr_CC_ZERO_WIDTH_NJ_MARK = 9, -
15 Mymr_CC_VIRAMA = 10, -
16 Mymr_CC_PRE_VOWEL = 11, -
17 Mymr_CC_BELOW_VOWEL = 12, -
18 Mymr_CC_ABOVE_VOWEL = 13, -
19 Mymr_CC_POST_VOWEL = 14, -
20 Mymr_CC_SIGN_ABOVE = 15, -
21 Mymr_CC_SIGN_BELOW = 16, -
22 Mymr_CC_SIGN_AFTER = 17, -
23 Mymr_CC_ZERO_WIDTH_J_MARK = 18, -
24 Mymr_CC_COUNT = 19 -
25}; -
26 -
27enum MymrCharClassFlags -
28{ -
29 Mymr_CF_CLASS_MASK = 0x0000FFFF, -
30 -
31 Mymr_CF_CONSONANT = 0x01000000, -
32 Mymr_CF_MEDIAL = 0x02000000, -
33 Mymr_CF_IND_VOWEL = 0x04000000, -
34 Mymr_CF_DEP_VOWEL = 0x08000000, -
35 Mymr_CF_DOTTED_CIRCLE = 0x10000000, -
36 Mymr_CF_VIRAMA = 0x20000000, -
37 -
38 -
39 Mymr_CF_POS_BEFORE = 0x00080000, -
40 Mymr_CF_POS_BELOW = 0x00040000, -
41 Mymr_CF_POS_ABOVE = 0x00020000, -
42 Mymr_CF_POS_AFTER = 0x00010000, -
43 Mymr_CF_POS_MASK = 0x000f0000, -
44 -
45 Mymr_CF_AFTER_KINZI = 0x00100000 -
46}; -
47 -
48 -
49enum MymrChar -
50{ -
51 Mymr_C_SIGN_ZWNJ = 0x200C, -
52 Mymr_C_SIGN_ZWJ = 0x200D, -
53 Mymr_C_DOTTED_CIRCLE = 0x25CC, -
54 Mymr_C_RA = 0x101B, -
55 Mymr_C_YA = 0x101A, -
56 Mymr_C_NGA = 0x1004, -
57 Mymr_C_VOWEL_E = 0x1031, -
58 Mymr_C_VIRAMA = 0x1039 -
59}; -
60 -
61enum -
62{ -
63 Mymr_xx = Mymr_CC_RESERVED, -
64 Mymr_c1 = Mymr_CC_CONSONANT | Mymr_CF_CONSONANT | Mymr_CF_POS_BELOW, -
65 Mymr_c2 = Mymr_CC_CONSONANT2 | Mymr_CF_CONSONANT, -
66 Mymr_ng = Mymr_CC_NGA | Mymr_CF_CONSONANT | Mymr_CF_POS_ABOVE, -
67 Mymr_ya = Mymr_CC_YA | Mymr_CF_CONSONANT | Mymr_CF_MEDIAL | Mymr_CF_POS_AFTER | Mymr_CF_AFTER_KINZI, -
68 Mymr_ra = Mymr_CC_RA | Mymr_CF_CONSONANT | Mymr_CF_MEDIAL | Mymr_CF_POS_BEFORE, -
69 Mymr_wa = Mymr_CC_WA | Mymr_CF_CONSONANT | Mymr_CF_MEDIAL | Mymr_CF_POS_BELOW, -
70 Mymr_ha = Mymr_CC_HA | Mymr_CF_CONSONANT | Mymr_CF_MEDIAL | Mymr_CF_POS_BELOW, -
71 Mymr_id = Mymr_CC_IND_VOWEL | Mymr_CF_IND_VOWEL, -
72 Mymr_vi = Mymr_CC_VIRAMA | Mymr_CF_VIRAMA | Mymr_CF_POS_ABOVE | Mymr_CF_DOTTED_CIRCLE, -
73 Mymr_dl = Mymr_CC_PRE_VOWEL | Mymr_CF_DEP_VOWEL | Mymr_CF_POS_BEFORE | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI, -
74 Mymr_db = Mymr_CC_BELOW_VOWEL | Mymr_CF_DEP_VOWEL | Mymr_CF_POS_BELOW | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI, -
75 Mymr_da = Mymr_CC_ABOVE_VOWEL | Mymr_CF_DEP_VOWEL | Mymr_CF_POS_ABOVE | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI, -
76 Mymr_dr = Mymr_CC_POST_VOWEL | Mymr_CF_DEP_VOWEL | Mymr_CF_POS_AFTER | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI, -
77 Mymr_sa = Mymr_CC_SIGN_ABOVE | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_POS_ABOVE | Mymr_CF_AFTER_KINZI, -
78 Mymr_sb = Mymr_CC_SIGN_BELOW | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_POS_BELOW | Mymr_CF_AFTER_KINZI, -
79 Mymr_sp = Mymr_CC_SIGN_AFTER | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI -
80}; -
81 -
82 -
83typedef int MymrCharClass; -
84 -
85 -
86static const MymrCharClass mymrCharClasses[] = -
87{ -
88 Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_ng, Mymr_c1, Mymr_c1, Mymr_c1, -
89 Mymr_c1, Mymr_c1, Mymr_c2, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, -
90 Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, -
91 Mymr_c1, Mymr_c1, Mymr_ya, Mymr_ra, Mymr_c1, Mymr_wa, Mymr_c1, Mymr_ha, -
92 Mymr_c2, Mymr_c2, Mymr_xx, Mymr_id, Mymr_id, Mymr_id, Mymr_id, Mymr_id, -
93 Mymr_xx, Mymr_id, Mymr_id, Mymr_xx, Mymr_dr, Mymr_da, Mymr_da, Mymr_db, -
94 Mymr_db, Mymr_dl, Mymr_da, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_sa, Mymr_sb, -
95 Mymr_sp, Mymr_vi, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, -
96 Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, -
97 Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, -
98 Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, -
99 Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, -
100}; -
101 -
102static MymrCharClass -
103getMyanmarCharClass (HB_UChar16 ch) -
104{ -
105 if (ch == Mymr_C_SIGN_ZWJ)
never evaluated: ch == Mymr_C_SIGN_ZWJ
0
106 return Mymr_CC_ZERO_WIDTH_J_MARK;
never executed: return Mymr_CC_ZERO_WIDTH_J_MARK;
0
107 -
108 if (ch == Mymr_C_SIGN_ZWNJ)
never evaluated: ch == Mymr_C_SIGN_ZWNJ
0
109 return Mymr_CC_ZERO_WIDTH_NJ_MARK;
never executed: return Mymr_CC_ZERO_WIDTH_NJ_MARK;
0
110 -
111 if (ch < 0x1000 || ch > 0x105f)
never evaluated: ch < 0x1000
never evaluated: ch > 0x105f
0
112 return Mymr_CC_RESERVED;
never executed: return Mymr_CC_RESERVED;
0
113 -
114 return mymrCharClasses[ch - 0x1000];
never executed: return mymrCharClasses[ch - 0x1000];
0
115} -
116 -
117static const signed char mymrStateTable[][Mymr_CC_COUNT] = -
118{ -
119 -
120 { 1, 4, 4, 2, 4, 4, 4, 4, 24, 1, 27, 17, 18, 19, 20, 21, 1, 1, 4}, -
121 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, -
122 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 17, 18, 19, 20, 21, -1, -1, 4}, -
123 {-1, 4, 4, 4, 4, 4, 4, 4, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1}, -
124 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, 17, 18, 19, 20, 21, 1, 1, -1}, -
125 {-2, 6, -2, -2, 7, 8, 9, 10, -2, 23, -2, -2, -2, -2, -2, -2, -2, -2, -2}, -
126 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 25, 17, 18, 19, 20, 21, -1, -1, -1}, -
127 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 17, 18, 19, 20, 21, -1, -1, -1}, -
128 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 17, 18, 19, 20, 21, -1, -1, -1}, -
129 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 17, 18, 19, 20, 21, -1, -1, -1}, -
130 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 18, 19, 20, 21, -1, -1, -1}, -
131 {-1, -1, -1, -1, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, -
132 {-2, -2, -2, -2, -2, -2, 13, 14, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2}, -
133 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, 17, 18, 19, 20, 21, -1, -1, -1}, -
134 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 18, 19, 20, 21, -1, -1, -1}, -
135 {-2, -2, -2, -2, -2, -2, -2, 16, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2}, -
136 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 18, 19, 20, 21, -1, -1, -1}, -
137 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 1, 1, -1}, -
138 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, 21, 1, 1, -1}, -
139 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1}, -
140 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, 1, 1, -1}, -
141 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1}, -
142 {-1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1}, -
143 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1}, -
144 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1}, -
145 {-2, -2, -2, -2, 26, 26, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2}, -
146 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 17, 18, 19, 20, 21, -1, 1, -1}, -
147 {-1, 6, -1, -1, 7, 8, 9, 10, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1}, -
148 -
149 -
150 -
151}; -
152static int myanmar_nextSyllableBoundary(const HB_UChar16 *s, int start, int end, HB_Bool *invalid) -
153{ -
154 const HB_UChar16 *uc = s + start; -
155 int state = 0; -
156 int pos = start; -
157 *invalid = 0; -
158 -
159 while (pos < end) {
never evaluated: pos < end
0
160 MymrCharClass charClass = getMyanmarCharClass(*uc); -
161 state = mymrStateTable[state][charClass & Mymr_CF_CLASS_MASK]; -
162 if (pos == start)
never evaluated: pos == start
0
163 *invalid = (HB_Bool)(charClass & Mymr_CF_DOTTED_CIRCLE);
never executed: *invalid = (HB_Bool)(charClass & Mymr_CF_DOTTED_CIRCLE);
0
164 -
165 if(0) printf("state[%d]=%d class=%8x (uc=%4x)", pos - start, state, charClass, *uc);
never executed: printf("state[%d]=%d class=%8x (uc=%4x)", pos - start, state, charClass, *uc);
never evaluated: 0
0
166 -
167 if (state < 0) {
never evaluated: state < 0
0
168 if (state < -1)
never evaluated: state < -1
0
169 --pos;
never executed: --pos;
0
170 break;
never executed: break;
0
171 } -
172 ++uc; -
173 ++pos; -
174 }
never executed: }
0
175 return pos;
never executed: return pos;
0
176} -
177 -
178 -
179 -
180 -
181static const HB_OpenTypeFeature myanmar_features[] = { -
182 { ( ( (HB_UInt)'p' << 24 ) | ( (HB_UInt)'r' << 16 ) | ( (HB_UInt)'e' << 8 ) | (HB_UInt)'f' ), PreFormProperty }, -
183 { ( ( (HB_UInt)'b' << 24 ) | ( (HB_UInt)'l' << 16 ) | ( (HB_UInt)'w' << 8 ) | (HB_UInt)'f' ), BelowFormProperty }, -
184 { ( ( (HB_UInt)'a' << 24 ) | ( (HB_UInt)'b' << 16 ) | ( (HB_UInt)'v' << 8 ) | (HB_UInt)'f' ), AboveFormProperty }, -
185 { ( ( (HB_UInt)'p' << 24 ) | ( (HB_UInt)'s' << 16 ) | ( (HB_UInt)'t' << 8 ) | (HB_UInt)'f' ), PostFormProperty }, -
186 { ( ( (HB_UInt)'p' << 24 ) | ( (HB_UInt)'r' << 16 ) | ( (HB_UInt)'e' << 8 ) | (HB_UInt)'s' ), PreSubstProperty }, -
187 { ( ( (HB_UInt)'b' << 24 ) | ( (HB_UInt)'l' << 16 ) | ( (HB_UInt)'w' << 8 ) | (HB_UInt)'s' ), BelowSubstProperty }, -
188 { ( ( (HB_UInt)'a' << 24 ) | ( (HB_UInt)'b' << 16 ) | ( (HB_UInt)'v' << 8 ) | (HB_UInt)'s' ), AboveSubstProperty }, -
189 { ( ( (HB_UInt)'p' << 24 ) | ( (HB_UInt)'s' << 16 ) | ( (HB_UInt)'t' << 8 ) | (HB_UInt)'s' ), PostSubstProperty }, -
190 { ( ( (HB_UInt)'r' << 24 ) | ( (HB_UInt)'l' << 16 ) | ( (HB_UInt)'i' << 8 ) | (HB_UInt)'g' ), CligProperty }, -
191 { 0, 0 } -
192}; -
193static HB_Bool myanmar_shape_syllable(HB_Bool openType, HB_ShaperItem *item, HB_Bool invalid) -
194{ -
195 -
196 -
197 -
198 -
199 -
200 -
201 const int availableGlyphs = item->num_glyphs; -
202 -
203 const HB_UChar16 *uc = item->string + item->item.pos; -
204 int vowel_e = -1; -
205 int kinzi = -1; -
206 int medial_ra = -1; -
207 int base = -1; -
208 int i; -
209 int len = 0; -
210 unsigned short reordered[32]; -
211 unsigned char properties[32]; -
212 enum { -
213 AboveForm = 0x01, -
214 PreForm = 0x02, -
215 PostForm = 0x04, -
216 BelowForm = 0x08 -
217 }; -
218 HB_Bool lastWasVirama = 0; -
219 int basePos = -1; -
220 -
221 memset(properties, 0, 32*sizeof(unsigned char)); -
222 -
223 -
224 ((item->item.length < 32) ? static_cast<void> (0) : __assert_fail ("item->item.length < 32", "../3rdparty/harfbuzz/src/harfbuzz-myanmar.c", 285, __PRETTY_FUNCTION__)); -
225 -
226 -
227 -
228 -
229 -
230 -
231 -
232 for (i = 0; i < (int)item->item.length; ++i) {
never evaluated: i < (int)item->item.length
0
233 HB_UChar16 chr = uc[i]; -
234 -
235 if (chr == Mymr_C_VOWEL_E) {
never evaluated: chr == Mymr_C_VOWEL_E
0
236 vowel_e = i; -
237 continue;
never executed: continue;
0
238 } -
239 if (i == 0
never evaluated: i == 0
0
240 && chr == Mymr_C_NGA
never evaluated: chr == Mymr_C_NGA
0
241 && i + 2 < (int)item->item.length
never evaluated: i + 2 < (int)item->item.length
0
242 && uc[i+1] == Mymr_C_VIRAMA) {
never evaluated: uc[i+1] == Mymr_C_VIRAMA
0
243 int mc = getMyanmarCharClass(uc[i+2]); -
244 -
245 if ((mc & Mymr_CF_CONSONANT) == Mymr_CF_CONSONANT) {
never evaluated: (mc & Mymr_CF_CONSONANT) == Mymr_CF_CONSONANT
0
246 kinzi = i; -
247 continue;
never executed: continue;
0
248 } -
249 }
never executed: }
0
250 if (base >= 0
never evaluated: base >= 0
0
251 && chr == Mymr_C_VIRAMA
never evaluated: chr == Mymr_C_VIRAMA
0
252 && i + 1 < (int)item->item.length
never evaluated: i + 1 < (int)item->item.length
0
253 && uc[i+1] == Mymr_C_RA) {
never evaluated: uc[i+1] == Mymr_C_RA
0
254 medial_ra = i; -
255 continue;
never executed: continue;
0
256 } -
257 if (base < 0)
never evaluated: base < 0
0
258 base = i;
never executed: base = i;
0
259 }
never executed: }
0
260 -
261 if(0) printf("\n base=%d, vowel_e=%d, kinzi=%d, medial_ra=%d", base, vowel_e, kinzi, medial_ra);
never executed: printf("\n base=%d, vowel_e=%d, kinzi=%d, medial_ra=%d", base, vowel_e, kinzi, medial_ra);
never evaluated: 0
0
262 -
263 if (vowel_e >= 0) {
never evaluated: vowel_e >= 0
0
264 reordered[0] = Mymr_C_VOWEL_E; -
265 len = 1; -
266 }
never executed: }
0
267 -
268 if (medial_ra >= 0) {
never evaluated: medial_ra >= 0
0
269 reordered[len] = Mymr_C_VIRAMA; -
270 reordered[len+1] = Mymr_C_RA; -
271 properties[len] = PreForm; -
272 properties[len+1] = PreForm; -
273 len += 2; -
274 }
never executed: }
0
275 -
276 -
277 -
278 -
279 -
280 if (invalid) {
never evaluated: invalid
0
281 reordered[len] = C_DOTTED_CIRCLE; -
282 ++len; -
283 }
never executed: }
0
284 -
285 -
286 -
287 for (i = 0; i < (int)item->item.length; ++i) {
never evaluated: i < (int)item->item.length
0
288 hb_uint16 chr = uc[i]; -
289 MymrCharClass cc; -
290 if (i == vowel_e)
never evaluated: i == vowel_e
0
291 continue;
never executed: continue;
0
292 if (i == medial_ra || i == kinzi) {
never evaluated: i == medial_ra
never evaluated: i == kinzi
0
293 ++i; -
294 continue;
never executed: continue;
0
295 } -
296 -
297 cc = getMyanmarCharClass(uc[i]); -
298 if (kinzi >= 0 && i > base && (cc & Mymr_CF_AFTER_KINZI)) {
never evaluated: kinzi >= 0
never evaluated: i > base
never evaluated: (cc & Mymr_CF_AFTER_KINZI)
0
299 reordered[len] = Mymr_C_NGA; -
300 reordered[len+1] = Mymr_C_VIRAMA; -
301 properties[len-1] = AboveForm; -
302 properties[len] = AboveForm; -
303 len += 2; -
304 kinzi = -1; -
305 }
never executed: }
0
306 -
307 if (lastWasVirama) {
never evaluated: lastWasVirama
0
308 int prop = 0; -
309 switch(cc & Mymr_CF_POS_MASK) { -
310 case Mymr_CF_POS_BEFORE: -
311 prop = PreForm; -
312 break;
never executed: break;
0
313 case Mymr_CF_POS_BELOW: -
314 prop = BelowForm; -
315 break;
never executed: break;
0
316 case Mymr_CF_POS_ABOVE: -
317 prop = AboveForm; -
318 break;
never executed: break;
0
319 case Mymr_CF_POS_AFTER: -
320 prop = PostForm; -
321 break;
never executed: break;
0
322 default: -
323 break;
never executed: break;
0
324 } -
325 properties[len-1] = prop; -
326 properties[len] = prop; -
327 if(basePos >= 0 && basePos == len-2)
never evaluated: basePos >= 0
never evaluated: basePos == len-2
0
328 properties[len-2] = prop;
never executed: properties[len-2] = prop;
0
329 }
never executed: }
0
330 lastWasVirama = (chr == Mymr_C_VIRAMA); -
331 if(i == base)
never evaluated: i == base
0
332 basePos = len;
never executed: basePos = len;
0
333 -
334 if ((chr != Mymr_C_SIGN_ZWNJ && chr != Mymr_C_SIGN_ZWJ) || !len) {
never evaluated: chr != Mymr_C_SIGN_ZWNJ
never evaluated: chr != Mymr_C_SIGN_ZWJ
never evaluated: !len
0
335 reordered[len] = chr; -
336 ++len; -
337 }
never executed: }
0
338 }
never executed: }
0
339 if (kinzi >= 0) {
never evaluated: kinzi >= 0
0
340 reordered[len] = Mymr_C_NGA; -
341 reordered[len+1] = Mymr_C_VIRAMA; -
342 properties[len] = AboveForm; -
343 properties[len+1] = AboveForm; -
344 len += 2; -
345 }
never executed: }
0
346 -
347 if (!item->font->klass->convertStringToGlyphIndices(item->font, 0
348 reordered, len, 0
349 item->glyphs, &item->num_glyphs, 0
350 item->item.bidiLevel % 2))
never evaluated: !item->font->klass->convertStringToGlyphIndices(item->font, reordered, len, item->glyphs, &item->num_glyphs, item->item.bidiLevel % 2)
0
351 return 0;
never executed: return 0;
0
352 -
353 if(0) printf("after shaping: len=%d", len);
never executed: printf("after shaping: len=%d", len);
never evaluated: 0
0
354 for (i = 0; i < len; i++) {
never evaluated: i < len
0
355 item->attributes[i].mark = 0; -
356 item->attributes[i].clusterStart = 0; -
357 item->attributes[i].justification = 0; -
358 item->attributes[i].zeroWidth = 0; -
359 if(0) printf(" %d: %4x property=%x", i, reordered[i], properties[i]);
never executed: printf(" %d: %4x property=%x", i, reordered[i], properties[i]);
never evaluated: 0
0
360 }
never executed: }
0
361 -
362 -
363 -
364 -
365 if (openType) {
never evaluated: openType
0
366 hb_uint32 where[32]; -
367 -
368 for (i = 0; i < len; ++i) {
never evaluated: i < len
0
369 where[i] = ~(PreSubstProperty -
370 | BelowSubstProperty -
371 | AboveSubstProperty -
372 | PostSubstProperty -
373 | CligProperty -
374 | 0x80000000); -
375 if (properties[i] & PreForm)
never evaluated: properties[i] & PreForm
0
376 where[i] &= ~PreFormProperty;
never executed: where[i] &= ~PreFormProperty;
0
377 if (properties[i] & BelowForm)
never evaluated: properties[i] & BelowForm
0
378 where[i] &= ~BelowFormProperty;
never executed: where[i] &= ~BelowFormProperty;
0
379 if (properties[i] & AboveForm)
never evaluated: properties[i] & AboveForm
0
380 where[i] &= ~AboveFormProperty;
never executed: where[i] &= ~AboveFormProperty;
0
381 if (properties[i] & PostForm)
never evaluated: properties[i] & PostForm
0
382 where[i] &= ~PostFormProperty;
never executed: where[i] &= ~PostFormProperty;
0
383 }
never executed: }
0
384 -
385 HB_OpenTypeShape(item, where); -
386 if (!HB_OpenTypePosition(item, availableGlyphs, 0))
never evaluated: !HB_OpenTypePosition(item, availableGlyphs, 0)
0
387 return 0;
never executed: return 0;
0
388 } else
never executed: }
0
389 -
390 { -
391 if(0) printf("Not using openType");
never executed: printf("Not using openType");
never evaluated: 0
0
392 HB_HeuristicPosition(item); -
393 }
never executed: }
0
394 -
395 item->attributes[0].clusterStart = (!0); -
396 return (!0);
never executed: return (!0);
0
397} -
398 -
399HB_Bool HB_MyanmarShape(HB_ShaperItem *item) -
400{ -
401 HB_Bool openType = 0; -
402 unsigned short *logClusters = item->log_clusters; -
403 -
404 HB_ShaperItem syllable = *item; -
405 int first_glyph = 0; -
406 -
407 int sstart = item->item.pos; -
408 int end = sstart + item->item.length; -
409 int i = 0; -
410 -
411 ((item->item.script == HB_Script_Myanmar) ? static_cast<void> (0) : __assert_fail ("item->item.script == HB_Script_Myanmar", "../3rdparty/harfbuzz/src/harfbuzz-myanmar.c", 472, __PRETTY_FUNCTION__)); -
412 -
413 openType = HB_SelectScript(item, myanmar_features); -
414 -
415 -
416 if(0) printf("myanmar_shape: from %d length %d", item->item.pos, item->item.length);
never executed: printf("myanmar_shape: from %d length %d", item->item.pos, item->item.length);
never evaluated: 0
0
417 while (sstart < end) {
never evaluated: sstart < end
0
418 HB_Bool invalid; -
419 int send = myanmar_nextSyllableBoundary(item->string, sstart, end, &invalid); -
420 if(0) printf("syllable from %d, length %d, invalid=%s", sstart, send-sstart,
never evaluated: 0
0
421 invalid ? "TRUE" : "FALSE");
never executed: printf("syllable from %d, length %d, invalid=%s", sstart, send-sstart, invalid ? "TRUE" : "FALSE");
0
422 syllable.item.pos = sstart; -
423 syllable.item.length = send-sstart; -
424 syllable.glyphs = item->glyphs + first_glyph; -
425 syllable.attributes = item->attributes + first_glyph; -
426 syllable.advances = item->advances + first_glyph; -
427 syllable.offsets = item->offsets + first_glyph; -
428 syllable.num_glyphs = item->num_glyphs - first_glyph; -
429 if (!myanmar_shape_syllable(openType, &syllable, invalid)) {
never evaluated: !myanmar_shape_syllable(openType, &syllable, invalid)
0
430 if(0) printf("syllable shaping failed, syllable requests %d glyphs", syllable.num_glyphs);
never executed: printf("syllable shaping failed, syllable requests %d glyphs", syllable.num_glyphs);
never evaluated: 0
0
431 item->num_glyphs += syllable.num_glyphs; -
432 return 0;
never executed: return 0;
0
433 } -
434 -
435 -
436 if(0) printf("syllable:");
never executed: printf("syllable:");
never evaluated: 0
0
437 for (i = first_glyph; i < first_glyph + (int)syllable.num_glyphs; ++i)
never evaluated: i < first_glyph + (int)syllable.num_glyphs
0
438 if(0) printf(" %d -> glyph %x", i, item->glyphs[i]);
never executed: printf(" %d -> glyph %x", i, item->glyphs[i]);
never evaluated: 0
0
439 if(0) printf(" logclusters:");
never executed: printf(" logclusters:");
never evaluated: 0
0
440 for (i = sstart; i < send; ++i) {
never evaluated: i < send
0
441 if(0) printf(" %d -> glyph %d", i, first_glyph);
never executed: printf(" %d -> glyph %d", i, first_glyph);
never evaluated: 0
0
442 logClusters[i-item->item.pos] = first_glyph; -
443 }
never executed: }
0
444 sstart = send; -
445 first_glyph += syllable.num_glyphs; -
446 }
never executed: }
0
447 item->num_glyphs = first_glyph; -
448 return (!0);
never executed: return (!0);
0
449} -
450 -
451void HB_MyanmarAttributes(HB_Script script, const HB_UChar16 *text, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes) -
452{ -
453 int end = from + len; -
454 const HB_UChar16 *uc = text + from; -
455 hb_uint32 i = 0; -
456 ((script) = (script)); -
457 attributes += from; -
458 while (i < len) {
never evaluated: i < len
0
459 HB_Bool invalid; -
460 hb_uint32 boundary = myanmar_nextSyllableBoundary(text, from+i, end, &invalid) - from; -
461 -
462 attributes[i].graphemeBoundary = (!0); -
463 attributes[i].lineBreak = (!0); -
464 -
465 if (boundary > len-1)
never evaluated: boundary > len-1
0
466 boundary = len;
never executed: boundary = len;
0
467 i++; -
468 while (i < boundary) {
never evaluated: i < boundary
0
469 attributes[i].graphemeBoundary = 0; -
470 ++uc; -
471 ++i; -
472 }
never executed: }
0
473 ((i == boundary) ? static_cast<void> (0) : __assert_fail ("i == boundary", "../3rdparty/harfbuzz/src/harfbuzz-myanmar.c", 534, __PRETTY_FUNCTION__)); -
474 }
never executed: }
0
475}
never executed: }
0
476 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial