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

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3static const HB_OpenTypeFeature greek_features[] = { -
4 { ( ( (HB_UInt)'c' << 24 ) | ( (HB_UInt)'c' << 16 ) | ( (HB_UInt)'m' << 8 ) | (HB_UInt)'p' ), CcmpProperty }, -
5 { ( ( (HB_UInt)'l' << 24 ) | ( (HB_UInt)'i' << 16 ) | ( (HB_UInt)'g' << 8 ) | (HB_UInt)'a' ), CcmpProperty }, -
6 { ( ( (HB_UInt)'c' << 24 ) | ( (HB_UInt)'l' << 16 ) | ( (HB_UInt)'i' << 8 ) | (HB_UInt)'g' ), CcmpProperty }, -
7 {0, 0} -
8}; -
9 -
10 -
11 -
12 -
13 -
14 -
15 -
16typedef struct _hb_greek_decomposition { -
17 HB_UChar16 composed; -
18 HB_UChar16 base; -
19} hb_greek_decomposition; -
20 -
21static const hb_greek_decomposition decompose_0x300[] = { -
22 { 0x1FBA, 0x0391 }, -
23 { 0x1FC8, 0x0395 }, -
24 { 0x1FCA, 0x0397 }, -
25 { 0x1FDA, 0x0399 }, -
26 { 0x1FF8, 0x039F }, -
27 { 0x1FEA, 0x03A5 }, -
28 { 0x1FFA, 0x03A9 }, -
29 { 0x1F70, 0x03B1 }, -
30 { 0x1F72, 0x03B5 }, -
31 { 0x1F74, 0x03B7 }, -
32 { 0x1F76, 0x03B9 }, -
33 { 0x1F78, 0x03BF }, -
34 { 0x1F7A, 0x03C5 }, -
35 { 0x1F7C, 0x03C9 }, -
36 { 0x1FD2, 0x03CA }, -
37 { 0x1FE2, 0x03CB }, -
38 { 0x1F02, 0x1F00 }, -
39 { 0, 0 } -
40}; -
41 -
42static HB_UChar16 compose_0x300(HB_UChar16 base) -
43{ -
44 if ((base ^ 0x1f00) < 0x100) {
never evaluated: (base ^ 0x1f00) < 0x100
0
45 if (base <= 0x1f69 && !(base & 0x6))
never evaluated: base <= 0x1f69
never evaluated: !(base & 0x6)
0
46 return base + 2;
never executed: return base + 2;
0
47 if (base == 0x1fbf)
never evaluated: base == 0x1fbf
0
48 return 0x1fcd;
never executed: return 0x1fcd;
0
49 if (base == 0x1ffe)
never evaluated: base == 0x1ffe
0
50 return 0x1fdd;
never executed: return 0x1fdd;
0
51 return 0;
never executed: return 0;
0
52 } -
53 { -
54 const hb_greek_decomposition *d = decompose_0x300; -
55 while (d->base && d->base != base)
never evaluated: d->base
never evaluated: d->base != base
0
56 ++d;
never executed: ++d;
0
57 return d->composed;
never executed: return d->composed;
0
58 } -
59} -
60 -
61static const hb_greek_decomposition decompose_0x301[] = { -
62 { 0x0386, 0x0391 }, -
63 { 0x0388, 0x0395 }, -
64 { 0x0389, 0x0397 }, -
65 { 0x038A, 0x0399 }, -
66 { 0x038C, 0x039F }, -
67 { 0x038E, 0x03A5 }, -
68 { 0x038F, 0x03A9 }, -
69 { 0x03AC, 0x03B1 }, -
70 { 0x03AD, 0x03B5 }, -
71 { 0x03AE, 0x03B7 }, -
72 { 0x03AF, 0x03B9 }, -
73 { 0x03CC, 0x03BF }, -
74 { 0x03CD, 0x03C5 }, -
75 { 0x03CE, 0x03C9 }, -
76 { 0x0390, 0x03CA }, -
77 { 0x03B0, 0x03CB }, -
78 { 0x03D3, 0x03D2 }, -
79 { 0, 0 } -
80}; -
81 -
82 -
83static HB_UChar16 compose_0x301(HB_UChar16 base) -
84{ -
85 if ((base ^ 0x1f00) < 0x100) {
never evaluated: (base ^ 0x1f00) < 0x100
0
86 if (base <= 0x1f69 && !(base & 0x6))
never evaluated: base <= 0x1f69
never evaluated: !(base & 0x6)
0
87 return base + 4;
never executed: return base + 4;
0
88 if (base == 0x1fbf)
never evaluated: base == 0x1fbf
0
89 return 0x1fce;
never executed: return 0x1fce;
0
90 if (base == 0x1ffe)
never evaluated: base == 0x1ffe
0
91 return 0x1fde;
never executed: return 0x1fde;
0
92 }
never executed: }
0
93 { -
94 const hb_greek_decomposition *d = decompose_0x301; -
95 while (d->base && d->base != base)
never evaluated: d->base
never evaluated: d->base != base
0
96 ++d;
never executed: ++d;
0
97 return d->composed;
never executed: return d->composed;
0
98 } -
99} -
100 -
101static const hb_greek_decomposition decompose_0x304[] = { -
102 { 0x1FB9, 0x0391 }, -
103 { 0x1FD9, 0x0399 }, -
104 { 0x1FE9, 0x03A5 }, -
105 { 0x1FB1, 0x03B1 }, -
106 { 0x1FD1, 0x03B9 }, -
107 { 0x1FE1, 0x03C5 }, -
108 { 0, 0 } -
109}; -
110 -
111static HB_UChar16 compose_0x304(HB_UChar16 base) -
112{ -
113 const hb_greek_decomposition *d = decompose_0x304; -
114 while (d->base && d->base != base)
never evaluated: d->base
never evaluated: d->base != base
0
115 ++d;
never executed: ++d;
0
116 return d->composed;
never executed: return d->composed;
0
117} -
118 -
119static const hb_greek_decomposition decompose_0x306[] = { -
120 { 0x1FB8, 0x0391 }, -
121 { 0x1FD8, 0x0399 }, -
122 { 0x1FE8, 0x03A5 }, -
123 { 0x1FB0, 0x03B1 }, -
124 { 0x1FD0, 0x03B9 }, -
125 { 0x1FE0, 0x03C5 }, -
126 { 0, 0 } -
127}; -
128 -
129static HB_UChar16 compose_0x306(HB_UChar16 base) -
130{ -
131 const hb_greek_decomposition *d = decompose_0x306; -
132 while (d->base && d->base != base)
never evaluated: d->base
never evaluated: d->base != base
0
133 ++d;
never executed: ++d;
0
134 return d->composed;
never executed: return d->composed;
0
135} -
136 -
137static const hb_greek_decomposition decompose_0x308[] = { -
138 { 0x03AA, 0x0399 }, -
139 { 0x03AB, 0x03A5 }, -
140 { 0x03CA, 0x03B9 }, -
141 { 0x03CB, 0x03C5 }, -
142 { 0x03D4, 0x03D2 }, -
143 { 0, 0 } -
144}; -
145 -
146static HB_UChar16 compose_0x308(HB_UChar16 base) -
147{ -
148 const hb_greek_decomposition *d = decompose_0x308; -
149 while (d->base && d->base != base)
never evaluated: d->base
never evaluated: d->base != base
0
150 ++d;
never executed: ++d;
0
151 return d->composed;
never executed: return d->composed;
0
152} -
153 -
154 -
155static const hb_greek_decomposition decompose_0x313[] = { -
156 { 0x1F08, 0x0391 }, -
157 { 0x1F18, 0x0395 }, -
158 { 0x1F28, 0x0397 }, -
159 { 0x1F38, 0x0399 }, -
160 { 0x1F48, 0x039F }, -
161 { 0x1F68, 0x03A9 }, -
162 { 0x1F00, 0x03B1 }, -
163 { 0x1F10, 0x03B5 }, -
164 { 0x1F20, 0x03B7 }, -
165 { 0x1F30, 0x03B9 }, -
166 { 0x1F40, 0x03BF }, -
167 { 0x1FE4, 0x03C1 }, -
168 { 0x1F50, 0x03C5 }, -
169 { 0x1F60, 0x03C9 }, -
170 { 0, 0 } -
171}; -
172 -
173static HB_UChar16 compose_0x313(HB_UChar16 base) -
174{ -
175 const hb_greek_decomposition *d = decompose_0x313; -
176 while (d->base && d->base != base)
never evaluated: d->base
never evaluated: d->base != base
0
177 ++d;
never executed: ++d;
0
178 return d->composed;
never executed: return d->composed;
0
179} -
180 -
181static const hb_greek_decomposition decompose_0x314[] = { -
182 { 0x1F09, 0x0391 }, -
183 { 0x1F19, 0x0395 }, -
184 { 0x1F29, 0x0397 }, -
185 { 0x1F39, 0x0399 }, -
186 { 0x1F49, 0x039F }, -
187 { 0x1FEC, 0x03A1 }, -
188 { 0x1F59, 0x03A5 }, -
189 { 0x1F69, 0x03A9 }, -
190 { 0x1F01, 0x03B1 }, -
191 { 0x1F11, 0x03B5 }, -
192 { 0x1F21, 0x03B7 }, -
193 { 0x1F31, 0x03B9 }, -
194 { 0x1F41, 0x03BF }, -
195 { 0x1FE5, 0x03C1 }, -
196 { 0x1F51, 0x03C5 }, -
197 { 0x1F61, 0x03C9 }, -
198 { 0, 0 } -
199}; -
200 -
201static HB_UChar16 compose_0x314(HB_UChar16 base) -
202{ -
203 const hb_greek_decomposition *d = decompose_0x314; -
204 while (d->base && d->base != base)
never evaluated: d->base
never evaluated: d->base != base
0
205 ++d;
never executed: ++d;
0
206 return d->composed;
never executed: return d->composed;
0
207} -
208 -
209static const hb_greek_decomposition decompose_0x342[] = { -
210 { 0x1FB6, 0x03B1 }, -
211 { 0x1FC6, 0x03B7 }, -
212 { 0x1FD6, 0x03B9 }, -
213 { 0x1FE6, 0x03C5 }, -
214 { 0x1FF6, 0x03C9 }, -
215 { 0x1FD7, 0x03CA }, -
216 { 0x1FE7, 0x03CB }, -
217 { 0x1F06, 0x1F00 }, -
218 { 0x1F07, 0x1F01 }, -
219 { 0x1F0E, 0x1F08 }, -
220 { 0x1F0F, 0x1F09 }, -
221 { 0x1F26, 0x1F20 }, -
222 { 0x1F27, 0x1F21 }, -
223 { 0x1F2E, 0x1F28 }, -
224 { 0x1F2F, 0x1F29 }, -
225 { 0x1F36, 0x1F30 }, -
226 { 0x1F37, 0x1F31 }, -
227 { 0x1F3E, 0x1F38 }, -
228 { 0x1F3F, 0x1F39 }, -
229 { 0x1F56, 0x1F50 }, -
230 { 0x1F57, 0x1F51 }, -
231 { 0x1F5F, 0x1F59 }, -
232 { 0x1F66, 0x1F60 }, -
233 { 0x1F67, 0x1F61 }, -
234 { 0x1F6E, 0x1F68 }, -
235 { 0x1F6F, 0x1F69 }, -
236 { 0x1FCF, 0x1FBF }, -
237 { 0x1FDF, 0x1FFE }, -
238 { 0, 0 } -
239}; -
240 -
241static HB_UChar16 compose_0x342(HB_UChar16 base) -
242{ -
243 const hb_greek_decomposition *d = decompose_0x342; -
244 while (d->base && d->base != base)
never evaluated: d->base
never evaluated: d->base != base
0
245 ++d;
never executed: ++d;
0
246 return d->composed;
never executed: return d->composed;
0
247} -
248 -
249static const hb_greek_decomposition decompose_0x345[] = { -
250 { 0x1FBC, 0x0391 }, -
251 { 0x1FCC, 0x0397 }, -
252 { 0x1FFC, 0x03A9 }, -
253 { 0x1FB4, 0x03AC }, -
254 { 0x1FC4, 0x03AE }, -
255 { 0x1FB3, 0x03B1 }, -
256 { 0x1FC3, 0x03B7 }, -
257 { 0x1FF3, 0x03C9 }, -
258 { 0x1FF4, 0x03CE }, -
259 { 0x1F80, 0x1F00 }, -
260 { 0x1F81, 0x1F01 }, -
261 { 0x1F82, 0x1F02 }, -
262 { 0x1F83, 0x1F03 }, -
263 { 0x1F84, 0x1F04 }, -
264 { 0x1F85, 0x1F05 }, -
265 { 0x1F86, 0x1F06 }, -
266 { 0x1F87, 0x1F07 }, -
267 { 0x1F88, 0x1F08 }, -
268 { 0x1F89, 0x1F09 }, -
269 { 0x1F8A, 0x1F0A }, -
270 { 0x1F8B, 0x1F0B }, -
271 { 0x1F8C, 0x1F0C }, -
272 { 0x1F8D, 0x1F0D }, -
273 { 0x1F8E, 0x1F0E }, -
274 { 0x1F8F, 0x1F0F }, -
275 { 0x1F90, 0x1F20 }, -
276 { 0x1F91, 0x1F21 }, -
277 { 0x1F92, 0x1F22 }, -
278 { 0x1F93, 0x1F23 }, -
279 { 0x1F94, 0x1F24 }, -
280 { 0x1F95, 0x1F25 }, -
281 { 0x1F96, 0x1F26 }, -
282 { 0x1F97, 0x1F27 }, -
283 { 0x1F98, 0x1F28 }, -
284 { 0x1F99, 0x1F29 }, -
285 { 0x1F9A, 0x1F2A }, -
286 { 0x1F9B, 0x1F2B }, -
287 { 0x1F9C, 0x1F2C }, -
288 { 0x1F9D, 0x1F2D }, -
289 { 0x1F9E, 0x1F2E }, -
290 { 0x1F9F, 0x1F2F }, -
291 { 0x1FA0, 0x1F60 }, -
292 { 0x1FA1, 0x1F61 }, -
293 { 0x1FA2, 0x1F62 }, -
294 { 0x1FA3, 0x1F63 }, -
295 { 0x1FA4, 0x1F64 }, -
296 { 0x1FA5, 0x1F65 }, -
297 { 0x1FA6, 0x1F66 }, -
298 { 0x1FA7, 0x1F67 }, -
299 { 0x1FA8, 0x1F68 }, -
300 { 0x1FA9, 0x1F69 }, -
301 { 0x1FAA, 0x1F6A }, -
302 { 0x1FAB, 0x1F6B }, -
303 { 0x1FAC, 0x1F6C }, -
304 { 0x1FAD, 0x1F6D }, -
305 { 0x1FAE, 0x1F6E }, -
306 { 0x1FAF, 0x1F6F }, -
307 { 0x1FB2, 0x1F70 }, -
308 { 0x1FC2, 0x1F74 }, -
309 { 0x1FF2, 0x1F7C }, -
310 { 0x1FB7, 0x1FB6 }, -
311 { 0x1FC7, 0x1FC6 }, -
312 { 0x1FF7, 0x1FF6 }, -
313 { 0, 0 } -
314}; -
315 -
316static HB_UChar16 compose_0x345(HB_UChar16 base) -
317{ -
318 const hb_greek_decomposition *d = decompose_0x345; -
319 while (d->base && d->base != base)
never evaluated: d->base
never evaluated: d->base != base
0
320 ++d;
never executed: ++d;
0
321 return d->composed;
never executed: return d->composed;
0
322} -
323 -
324 -
325 -
326 -
327 -
328 -
329HB_Bool HB_GreekShape(HB_ShaperItem *shaper_item) -
330{ -
331 const int availableGlyphs = shaper_item->num_glyphs; -
332 const HB_UChar16 *uc = shaper_item->string + shaper_item->item.pos; -
333 unsigned short *logClusters = shaper_item->log_clusters; -
334 HB_GlyphAttributes *attributes = shaper_item->attributes; -
335 -
336 HB_Bool haveGlyphs; -
337 int slen = 1; -
338 int cluster_start = 0; -
339 hb_uint32 i; -
340 -
341 HB_UChar16 stackshapedChars[512]; HB_UChar16 *shapedChars = stackshapedChars; if ((2 * shaper_item->item.length) >= 512) shapedChars = (HB_UChar16 *)malloc((2 * shaper_item->item.length) * sizeof(HB_UChar16));;
never executed: shapedChars = (HB_UChar16 *)malloc((2 * shaper_item->item.length) * sizeof(HB_UChar16));
partially evaluated: (2 * shaper_item->item.length) >= 512
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:38
0-38
342 -
343 ((shaper_item->item.script == HB_Script_Greek) ? static_cast<void> (0) : __assert_fail ("shaper_item->item.script == HB_Script_Greek", "../3rdparty/harfbuzz/src/harfbuzz-greek.c", 370, __PRETTY_FUNCTION__)); -
344 -
345 *shapedChars = *uc; -
346 logClusters[0] = 0; -
347 -
348 attributes[0].mark = false; -
349 attributes[0].clusterStart = true; -
350 attributes[0].dontPrint = false; -
351 -
352 for (i = 1; i < shaper_item->item.length; ++i) {
evaluated: i < shaper_item->item.length
TRUEFALSE
yes
Evaluation Count:104
yes
Evaluation Count:38
38-104
353 hb_uint16 base = shapedChars[slen-1]; -
354 hb_uint16 shaped = 0; -
355 if (uc[i] == 0x300)
partially evaluated: uc[i] == 0x300
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
356 shaped = compose_0x300(base);
never executed: shaped = compose_0x300(base);
0
357 else if (uc[i] == 0x301)
partially evaluated: uc[i] == 0x301
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
358 shaped = compose_0x301(base);
never executed: shaped = compose_0x301(base);
0
359 else if (uc[i] == 0x304)
partially evaluated: uc[i] == 0x304
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
360 shaped = compose_0x304(base);
never executed: shaped = compose_0x304(base);
0
361 else if (uc[i] == 0x306)
partially evaluated: uc[i] == 0x306
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
362 shaped = compose_0x306(base);
never executed: shaped = compose_0x306(base);
0
363 else if (uc[i] == 0x308)
partially evaluated: uc[i] == 0x308
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
364 shaped = compose_0x308(base);
never executed: shaped = compose_0x308(base);
0
365 else if (uc[i] == 0x313)
partially evaluated: uc[i] == 0x313
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
366 shaped = compose_0x313(base);
never executed: shaped = compose_0x313(base);
0
367 else if (uc[i] == 0x314)
partially evaluated: uc[i] == 0x314
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
368 shaped = compose_0x314(base);
never executed: shaped = compose_0x314(base);
0
369 else if (uc[i] == 0x342)
partially evaluated: uc[i] == 0x342
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
370 shaped = compose_0x342(base);
never executed: shaped = compose_0x342(base);
0
371 else if (uc[i] == 0x345)
partially evaluated: uc[i] == 0x345
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
372 shaped = compose_0x345(base);
never executed: shaped = compose_0x345(base);
0
373 -
374 if (shaped) {
partially evaluated: shaped
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
375 if (shaper_item->font->klass->canRender(shaper_item->font, (HB_UChar16 *)&shaped, 1)) {
never evaluated: shaper_item->font->klass->canRender(shaper_item->font, (HB_UChar16 *)&shaped, 1)
0
376 shapedChars[slen-1] = shaped; -
377 } else {
never executed: }
0
378 shaped = 0; -
379 }
never executed: }
0
380 } -
381 -
382 if (!shaped) {
partially evaluated: !shaped
TRUEFALSE
yes
Evaluation Count:104
no
Evaluation Count:0
0-104
383 HB_CharCategory category; -
384 int cmb; -
385 shapedChars[slen] = uc[i]; -
386 HB_GetUnicodeCharProperties(uc[i], &category, &cmb); -
387 if (category != HB_Mark_NonSpacing) {
partially evaluated: category != HB_Mark_NonSpacing
TRUEFALSE
yes
Evaluation Count:104
no
Evaluation Count:0
0-104
388 attributes[slen].clusterStart = (!0); -
389 attributes[slen].mark = 0; -
390 attributes[slen].combiningClass = 0; -
391 attributes[slen].dontPrint = ((uc[i] >= 0x200b && uc[i] <= 0x200f ) || (uc[i] >= 0x2028 && uc[i] <= 0x202f ) || (uc[i] >= 0x206a && uc[i] <= 0x206f ));
partially evaluated: uc[i] >= 0x200b
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
never evaluated: uc[i] <= 0x200f
partially evaluated: uc[i] >= 0x2028
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
never evaluated: uc[i] <= 0x202f
partially evaluated: uc[i] >= 0x206a
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
never evaluated: uc[i] <= 0x206f
0-104
392 cluster_start = slen; -
393 } else {
executed: }
Execution Count:104
104
394 attributes[slen].clusterStart = 0; -
395 attributes[slen].mark = (!0); -
396 attributes[slen].combiningClass = cmb; -
397 }
never executed: }
0
398 ++slen; -
399 }
executed: }
Execution Count:104
104
400 logClusters[i] = cluster_start; -
401 }
executed: }
Execution Count:104
104
402 -
403 haveGlyphs = shaper_item->font->klass -
404 ->convertStringToGlyphIndices(shaper_item->font, -
405 shapedChars, slen, -
406 shaper_item->glyphs, &shaper_item->num_glyphs, -
407 shaper_item->item.bidiLevel % 2); -
408 -
409 if (stackshapedChars != shapedChars) free(shapedChars);;
never executed: free(shapedChars);
partially evaluated: stackshapedChars != shapedChars
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:38
0-38
410 -
411 if (!haveGlyphs)
partially evaluated: !haveGlyphs
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:38
0-38
412 return 0;
never executed: return 0;
0
413 -
414 -
415 if (HB_SelectScript(shaper_item, greek_features)) {
partially evaluated: HB_SelectScript(shaper_item, greek_features)
TRUEFALSE
yes
Evaluation Count:38
no
Evaluation Count:0
0-38
416 HB_OpenTypeShape(shaper_item, 0); -
417 return HB_OpenTypePosition(shaper_item, availableGlyphs, (!0));
executed: return HB_OpenTypePosition(shaper_item, availableGlyphs, (!0));
Execution Count:38
38
418 } -
419 -
420 HB_HeuristicPosition(shaper_item); -
421 -
422 return (!0);
never executed: return (!0);
0
423} -
424 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial