Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | static inline void positionCluster(HB_ShaperItem *item, int gfrom, int glast) | - |
4 | { | - |
5 | int nmarks = glast - gfrom; | - |
6 | ((nmarks > 0) ? static_cast<void> (0) : __assert_fail ("nmarks > 0", "../3rdparty/harfbuzz/src/harfbuzz-shaper.cpp", 44, __PRETTY_FUNCTION__)); | - |
7 | | - |
8 | HB_Glyph *glyphs = item->glyphs; | - |
9 | HB_GlyphAttributes *attributes = item->attributes; | - |
10 | | - |
11 | HB_GlyphMetrics baseMetrics; | - |
12 | item->font->klass->getGlyphMetrics(item->font, glyphs[gfrom], &baseMetrics); | - |
13 | | - |
14 | if (item->item.script == HB_Script_Hebrew partially evaluated: item->item.script == HB_Script_Hebrew no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
15 | && (-baseMetrics.y) > baseMetrics.height) never evaluated: (-baseMetrics.y) > baseMetrics.height | 0 |
16 | | - |
17 | baseMetrics.height = -baseMetrics.y; never executed: baseMetrics.height = -baseMetrics.y; | 0 |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | HB_Fixed size = item->font->klass->getFontMetric(item->font, HB_FontAscent) / 10; | - |
23 | HB_Fixed offsetBase = ((1) * 64) + (size - ((4) * 64)) / 4; | - |
24 | if (size > ((4) * 64)) partially evaluated: size > ((4) * 64) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
25 | offsetBase += ((4) * 64); never executed: offsetBase += ((4) * 64); | 0 |
26 | else | - |
27 | offsetBase += size; executed: offsetBase += size; Execution Count:1 | 1 |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | if (nmarks == 2 && (attributes[gfrom+1].combiningClass == HB_Combining_AboveRight || partially evaluated: nmarks == 2 no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: attributes[gfrom+1].combiningClass == HB_Combining_AboveRight | 0-1 |
33 | attributes[gfrom+1].combiningClass == HB_Combining_AboveLeft || never evaluated: attributes[gfrom+1].combiningClass == HB_Combining_AboveLeft | 0 |
34 | attributes[gfrom+1].combiningClass == HB_Combining_Above)) never evaluated: attributes[gfrom+1].combiningClass == HB_Combining_Above | 0 |
35 | if (attributes[gfrom+2].combiningClass == 23 || never evaluated: attributes[gfrom+2].combiningClass == 23 | 0 |
36 | attributes[gfrom+2].combiningClass == 24 || never evaluated: attributes[gfrom+2].combiningClass == 24 | 0 |
37 | attributes[gfrom+2].combiningClass == 25 || never evaluated: attributes[gfrom+2].combiningClass == 25 | 0 |
38 | attributes[gfrom+2].combiningClass == 27 || never evaluated: attributes[gfrom+2].combiningClass == 27 | 0 |
39 | attributes[gfrom+2].combiningClass == 28 || never evaluated: attributes[gfrom+2].combiningClass == 28 | 0 |
40 | attributes[gfrom+2].combiningClass == 30 || never evaluated: attributes[gfrom+2].combiningClass == 30 | 0 |
41 | attributes[gfrom+2].combiningClass == 31 || never evaluated: attributes[gfrom+2].combiningClass == 31 | 0 |
42 | attributes[gfrom+2].combiningClass == 33 || never evaluated: attributes[gfrom+2].combiningClass == 33 | 0 |
43 | attributes[gfrom+2].combiningClass == 34 || never evaluated: attributes[gfrom+2].combiningClass == 34 | 0 |
44 | attributes[gfrom+2].combiningClass == 35 || never evaluated: attributes[gfrom+2].combiningClass == 35 | 0 |
45 | attributes[gfrom+2].combiningClass == 36 || never evaluated: attributes[gfrom+2].combiningClass == 36 | 0 |
46 | attributes[gfrom+2].combiningClass == 107 || never evaluated: attributes[gfrom+2].combiningClass == 107 | 0 |
47 | attributes[gfrom+2].combiningClass == 122) { never evaluated: attributes[gfrom+2].combiningClass == 122 | 0 |
48 | | - |
49 | int markTotalHeight = baseMetrics.height; | - |
50 | HB_GlyphMetrics markMetrics; | - |
51 | item->font->klass->getGlyphMetrics(item->font, glyphs[gfrom+1], &markMetrics); | - |
52 | markTotalHeight += markMetrics.height; | - |
53 | item->font->klass->getGlyphMetrics(item->font, glyphs[gfrom+2], &markMetrics); | - |
54 | markTotalHeight += markMetrics.height; | - |
55 | if ((markTotalHeight + 2 * offsetBase) > (size * 10)) never evaluated: (markTotalHeight + 2 * offsetBase) > (size * 10) | 0 |
56 | offsetBase = ((size * 10) - markTotalHeight) / 2; never executed: offsetBase = ((size * 10) - markTotalHeight) / 2; | 0 |
57 | } | 0 |
58 | | - |
59 | bool rightToLeft = item->item.bidiLevel % 2; | - |
60 | | - |
61 | int i; | - |
62 | unsigned char lastCmb = 0; | - |
63 | HB_GlyphMetrics attachmentRect; | - |
64 | memset(&attachmentRect, 0, sizeof(attachmentRect)); | - |
65 | | - |
66 | for(i = 1; i <= nmarks; i++) { evaluated: i <= nmarks yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
67 | HB_Glyph mark = glyphs[gfrom+i]; | - |
68 | HB_GlyphMetrics markMetrics; | - |
69 | item->font->klass->getGlyphMetrics(item->font, mark, &markMetrics); | - |
70 | HB_FixedPoint p; | - |
71 | p.x = p.y = 0; | - |
72 | | - |
73 | | - |
74 | HB_Fixed offset = offsetBase; | - |
75 | unsigned char cmb = attributes[gfrom+i].combiningClass; | - |
76 | | - |
77 | | - |
78 | | - |
79 | if (cmb < 200) { partially evaluated: cmb < 200 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
80 | | - |
81 | | - |
82 | | - |
83 | | - |
84 | | - |
85 | | - |
86 | if (cmb >= 27 && cmb <= 36 && offset < 3) never evaluated: cmb >= 27 never evaluated: cmb <= 36 never evaluated: offset < 3 | 0 |
87 | offset +=1; never executed: offset +=1; | 0 |
88 | | - |
89 | if ((cmb >= 10 && cmb <= 18) || never evaluated: cmb >= 10 never evaluated: cmb <= 18 | 0 |
90 | cmb == 20 || cmb == 22 || never evaluated: cmb == 20 never evaluated: cmb == 22 | 0 |
91 | cmb == 29 || cmb == 32) never evaluated: cmb == 29 never evaluated: cmb == 32 | 0 |
92 | cmb = HB_Combining_Below; never executed: cmb = HB_Combining_Below; | 0 |
93 | | - |
94 | else if (cmb == 23 || cmb == 27 || cmb == 28 || never evaluated: cmb == 23 never evaluated: cmb == 27 never evaluated: cmb == 28 | 0 |
95 | cmb == 30 || cmb == 31 || (cmb >= 33 && cmb <= 36)) never evaluated: cmb == 30 never evaluated: cmb == 31 never evaluated: cmb >= 33 never evaluated: cmb <= 36 | 0 |
96 | cmb = HB_Combining_Above; never executed: cmb = HB_Combining_Above; | 0 |
97 | | - |
98 | else if (cmb == 9 || cmb == 103 || cmb == 118) never evaluated: cmb == 9 never evaluated: cmb == 103 never evaluated: cmb == 118 | 0 |
99 | cmb = HB_Combining_BelowRight; never executed: cmb = HB_Combining_BelowRight; | 0 |
100 | | - |
101 | else if (cmb == 24 || cmb == 107 || cmb == 122) never evaluated: cmb == 24 never evaluated: cmb == 107 never evaluated: cmb == 122 | 0 |
102 | cmb = HB_Combining_AboveRight; never executed: cmb = HB_Combining_AboveRight; | 0 |
103 | else if (cmb == 25) never evaluated: cmb == 25 | 0 |
104 | cmb = HB_Combining_AboveLeft; never executed: cmb = HB_Combining_AboveLeft; | 0 |
105 | | - |
106 | | - |
107 | | - |
108 | } | - |
109 | | - |
110 | | - |
111 | if (cmb != lastCmb) { partially evaluated: cmb != lastCmb yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
112 | | - |
113 | attachmentRect = baseMetrics; | - |
114 | } executed: } Execution Count:1 | 1 |
115 | | - |
116 | switch(cmb) { | - |
117 | case HB_Combining_DoubleBelow: | - |
118 | | - |
119 | case HB_Combining_BelowLeft: | - |
120 | p.y += offset; | - |
121 | case HB_Combining_BelowLeftAttached: code before this statement never executed: case HB_Combining_BelowLeftAttached: | 0 |
122 | p.x += attachmentRect.x - markMetrics.x; | - |
123 | p.y += (attachmentRect.y + attachmentRect.height) - markMetrics.y; | - |
124 | break; | 0 |
125 | case HB_Combining_Below: | - |
126 | p.y += offset; | - |
127 | case HB_Combining_BelowAttached: code before this statement executed: case HB_Combining_BelowAttached: Execution Count:1 | 1 |
128 | p.x += attachmentRect.x - markMetrics.x; | - |
129 | p.y += (attachmentRect.y + attachmentRect.height) - markMetrics.y; | - |
130 | | - |
131 | p.x += (attachmentRect.width - markMetrics.width) / 2; | - |
132 | break; executed: break; Execution Count:1 | 1 |
133 | case HB_Combining_BelowRight: | - |
134 | p.y += offset; | - |
135 | case HB_Combining_BelowRightAttached: code before this statement never executed: case HB_Combining_BelowRightAttached: | 0 |
136 | p.x += attachmentRect.x + attachmentRect.width - markMetrics.width - markMetrics.x; | - |
137 | p.y += attachmentRect.y + attachmentRect.height - markMetrics.y; | - |
138 | break; | 0 |
139 | case HB_Combining_Left: | - |
140 | p.x -= offset; | - |
141 | case HB_Combining_LeftAttached: | - |
142 | break; | 0 |
143 | case HB_Combining_Right: | - |
144 | p.x += offset; | - |
145 | case HB_Combining_RightAttached: | - |
146 | break; | 0 |
147 | case HB_Combining_DoubleAbove: | - |
148 | | - |
149 | case HB_Combining_AboveLeft: | - |
150 | p.y -= offset; | - |
151 | case HB_Combining_AboveLeftAttached: code before this statement never executed: case HB_Combining_AboveLeftAttached: | 0 |
152 | p.x += attachmentRect.x - markMetrics.x; | - |
153 | p.y += attachmentRect.y - markMetrics.y - markMetrics.height; | - |
154 | break; | 0 |
155 | case HB_Combining_Above: | - |
156 | p.y -= offset; | - |
157 | case HB_Combining_AboveAttached: code before this statement never executed: case HB_Combining_AboveAttached: | 0 |
158 | p.x += attachmentRect.x - markMetrics.x; | - |
159 | p.y += attachmentRect.y - markMetrics.y - markMetrics.height; | - |
160 | | - |
161 | p.x += (attachmentRect.width - markMetrics.width) / 2; | - |
162 | break; | 0 |
163 | case HB_Combining_AboveRight: | - |
164 | p.y -= offset; | - |
165 | case HB_Combining_AboveRightAttached: code before this statement never executed: case HB_Combining_AboveRightAttached: | 0 |
166 | p.x += attachmentRect.x + attachmentRect.width - markMetrics.x - markMetrics.width; | - |
167 | p.y += attachmentRect.y - markMetrics.y - markMetrics.height; | - |
168 | break; | 0 |
169 | | - |
170 | case HB_Combining_IotaSubscript: | - |
171 | default: | - |
172 | break; | 0 |
173 | } | - |
174 | | - |
175 | markMetrics.x += p.x; | - |
176 | markMetrics.y += p.y; | - |
177 | | - |
178 | HB_GlyphMetrics unitedAttachmentRect = attachmentRect; | - |
179 | unitedAttachmentRect.x = ((attachmentRect.x) < (markMetrics.x) ? (attachmentRect.x) : (markMetrics.x)); partially evaluated: (attachmentRect.x) < (markMetrics.x) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
180 | unitedAttachmentRect.y = ((attachmentRect.y) < (markMetrics.y) ? (attachmentRect.y) : (markMetrics.y)); partially evaluated: (attachmentRect.y) < (markMetrics.y) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
181 | unitedAttachmentRect.width = ((attachmentRect.x + attachmentRect.width) > (markMetrics.x + markMetrics.width) ? (attachmentRect.x + attachmentRect.width) : (markMetrics.x + markMetrics.width)) - unitedAttachmentRect.x; partially evaluated: (attachmentRect.x + attachmentRect.width) > (markMetrics.x + markMetrics.width) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
182 | unitedAttachmentRect.height = ((attachmentRect.y + attachmentRect.height) > (markMetrics.y + markMetrics.height) ? (attachmentRect.y + attachmentRect.height) : (markMetrics.y + markMetrics.height)) - unitedAttachmentRect.y; partially evaluated: (attachmentRect.y + attachmentRect.height) > (markMetrics.y + markMetrics.height) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
183 | attachmentRect = unitedAttachmentRect; | - |
184 | | - |
185 | lastCmb = cmb; | - |
186 | if (rightToLeft) { partially evaluated: rightToLeft no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
187 | item->offsets[gfrom+i].x = p.x; | - |
188 | item->offsets[gfrom+i].y = p.y; | - |
189 | } else { | 0 |
190 | item->offsets[gfrom+i].x = p.x - baseMetrics.xOffset; | - |
191 | item->offsets[gfrom+i].y = p.y - baseMetrics.yOffset; | - |
192 | } executed: } Execution Count:1 | 1 |
193 | item->advances[gfrom+i] = 0; | - |
194 | } executed: } Execution Count:1 | 1 |
195 | } executed: } Execution Count:1 | 1 |
196 | | - |
197 | void HB_HeuristicPosition(HB_ShaperItem *item) | - |
198 | { | - |
199 | item->font->klass->getGlyphAdvances(item->font, item->glyphs, item->num_glyphs, item->advances, item->face->current_flags);; | - |
200 | HB_GlyphAttributes *attributes = item->attributes; | - |
201 | | - |
202 | int cEnd = -1; | - |
203 | int i = item->num_glyphs; | - |
204 | while (i--) { evaluated: i-- yes Evaluation Count:609417 | yes Evaluation Count:163020 |
| 163020-609417 |
205 | if (cEnd == -1 && attributes[i].mark) { evaluated: cEnd == -1 yes Evaluation Count:609416 | yes Evaluation Count:1 |
evaluated: attributes[i].mark yes Evaluation Count:1 | yes Evaluation Count:609415 |
| 1-609416 |
206 | cEnd = i; | - |
207 | } else if (cEnd != -1 && !attributes[i].mark) { executed: } Execution Count:1 evaluated: cEnd != -1 yes Evaluation Count:1 | yes Evaluation Count:609415 |
partially evaluated: !attributes[i].mark yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-609415 |
208 | positionCluster(item, i, cEnd); | - |
209 | cEnd = -1; | - |
210 | } executed: } Execution Count:1 | 1 |
211 | } | - |
212 | } executed: } Execution Count:163020 | 163020 |
213 | | - |
214 | | - |
215 | | - |
216 | | - |
217 | void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item) | - |
218 | { | - |
219 | const HB_UChar16 *uc = item->string + item->item.pos; | - |
220 | hb_uint32 length = item->item.length; | - |
221 | | - |
222 | | - |
223 | | - |
224 | ((item->num_glyphs <= length) ? static_cast<void> (0) : __assert_fail ("item->num_glyphs <= length", "../3rdparty/harfbuzz/src/harfbuzz-shaper.cpp", 262, __PRETTY_FUNCTION__)); | - |
225 | | - |
226 | | - |
227 | HB_GlyphAttributes *attributes = item->attributes; | - |
228 | unsigned short *logClusters = item->log_clusters; | - |
229 | | - |
230 | hb_uint32 glyph_pos = 0; | - |
231 | hb_uint32 i; | - |
232 | for (i = 0; i < length; i++) { evaluated: i < length yes Evaluation Count:2916917 | yes Evaluation Count:248280 |
| 248280-2916917 |
233 | if ((((uc[i]) & 0xfc00) == 0xd800) && i < length - 1 partially evaluated: (((uc[i]) & 0xfc00) == 0xd800) no Evaluation Count:0 | yes Evaluation Count:2916917 |
never evaluated: i < length - 1 | 0-2916917 |
234 | && (((uc[i + 1]) & 0xfc00) == 0xdc00)) { never evaluated: (((uc[i + 1]) & 0xfc00) == 0xdc00) | 0 |
235 | logClusters[i] = glyph_pos; | - |
236 | logClusters[++i] = glyph_pos; | - |
237 | } else { | 0 |
238 | logClusters[i] = glyph_pos; | - |
239 | } executed: } Execution Count:2916917 | 2916917 |
240 | ++glyph_pos; | - |
241 | } executed: } Execution Count:2916917 | 2916917 |
242 | ((glyph_pos == item->num_glyphs) ? static_cast<void> (0) : __assert_fail ("glyph_pos == item->num_glyphs", "../3rdparty/harfbuzz/src/harfbuzz-shaper.cpp", 280, __PRETTY_FUNCTION__)); | - |
243 | | - |
244 | | - |
245 | int cStart = 0; | - |
246 | const bool symbolFont = item->face->isSymbolFont; | - |
247 | attributes[0].mark = false; | - |
248 | attributes[0].clusterStart = true; | - |
249 | attributes[0].dontPrint = (!symbolFont && uc[0] == 0x00ad) || ((uc[0] >= 0x200b && uc[0] <= 0x200f ) || (uc[0] >= 0x2028 && uc[0] <= 0x202f ) || (uc[0] >= 0x206a && uc[0] <= 0x206f )); evaluated: !symbolFont yes Evaluation Count:248273 | yes Evaluation Count:7 |
partially evaluated: uc[0] == 0x00ad no Evaluation Count:0 | yes Evaluation Count:248273 |
evaluated: uc[0] >= 0x200b yes Evaluation Count:10885 | yes Evaluation Count:237395 |
partially evaluated: uc[0] <= 0x200f no Evaluation Count:0 | yes Evaluation Count:10885 |
evaluated: uc[0] >= 0x2028 yes Evaluation Count:10882 | yes Evaluation Count:237398 |
evaluated: uc[0] <= 0x202f yes Evaluation Count:10848 | yes Evaluation Count:34 |
evaluated: uc[0] >= 0x206a yes Evaluation Count:34 | yes Evaluation Count:237398 |
partially evaluated: uc[0] <= 0x206f no Evaluation Count:0 | yes Evaluation Count:34 |
| 0-248273 |
250 | | - |
251 | int pos = 0; | - |
252 | HB_CharCategory lastCat; | - |
253 | int dummy; | - |
254 | HB_GetUnicodeCharProperties(uc[0], &lastCat, &dummy); | - |
255 | for (i = 1; i < length; ++i) { evaluated: i < length yes Evaluation Count:2668637 | yes Evaluation Count:248280 |
| 248280-2668637 |
256 | if (logClusters[i] == pos) partially evaluated: logClusters[i] == pos no Evaluation Count:0 | yes Evaluation Count:2668637 |
| 0-2668637 |
257 | | - |
258 | continue; never executed: continue; | 0 |
259 | ++pos; | - |
260 | while (pos < logClusters[i]) { partially evaluated: pos < logClusters[i] no Evaluation Count:0 | yes Evaluation Count:2668637 |
| 0-2668637 |
261 | attributes[pos] = attributes[pos-1]; | - |
262 | ++pos; | - |
263 | } | 0 |
264 | | - |
265 | if ((!symbolFont && uc[i] == 0x00ad) || ((uc[i] >= 0x200b && uc[i] <= 0x200f ) || (uc[i] >= 0x2028 && uc[i] <= 0x202f ) || (uc[i] >= 0x206a && uc[i] <= 0x206f ))) evaluated: !symbolFont yes Evaluation Count:2668588 | yes Evaluation Count:49 |
partially evaluated: uc[i] == 0x00ad no Evaluation Count:0 | yes Evaluation Count:2668588 |
evaluated: uc[i] >= 0x200b yes Evaluation Count:1002 | yes Evaluation Count:2667635 |
evaluated: uc[i] <= 0x200f yes Evaluation Count:1 | yes Evaluation Count:1001 |
evaluated: uc[i] >= 0x2028 yes Evaluation Count:119 | yes Evaluation Count:2668517 |
evaluated: uc[i] <= 0x202f yes Evaluation Count:17 | yes Evaluation Count:102 |
evaluated: uc[i] >= 0x206a yes Evaluation Count:102 | yes Evaluation Count:2668517 |
partially evaluated: uc[i] <= 0x206f no Evaluation Count:0 | yes Evaluation Count:102 |
| 0-2668588 |
266 | attributes[pos].dontPrint = true; executed: attributes[pos].dontPrint = true; Execution Count:18 | 18 |
267 | HB_CharCategory cat; | - |
268 | int cmb; | - |
269 | HB_GetUnicodeCharProperties(uc[i], &cat, &cmb); | - |
270 | if (cat != HB_Mark_NonSpacing) { evaluated: cat != HB_Mark_NonSpacing yes Evaluation Count:2668636 | yes Evaluation Count:1 |
| 1-2668636 |
271 | attributes[pos].mark = false; | - |
272 | attributes[pos].clusterStart = true; | - |
273 | attributes[pos].combiningClass = 0; | - |
274 | cStart = logClusters[i]; | - |
275 | } else { executed: } Execution Count:2668636 | 2668636 |
276 | if (cmb == 0) { partially evaluated: cmb == 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
277 | | - |
278 | if ((uc[pos] & 0xff00) == 0x0e00) { never evaluated: (uc[pos] & 0xff00) == 0x0e00 | 0 |
279 | | - |
280 | if (uc[pos] == 0xe31 || never evaluated: uc[pos] == 0xe31 | 0 |
281 | uc[pos] == 0xe34 || never evaluated: uc[pos] == 0xe34 | 0 |
282 | uc[pos] == 0xe35 || never evaluated: uc[pos] == 0xe35 | 0 |
283 | uc[pos] == 0xe36 || never evaluated: uc[pos] == 0xe36 | 0 |
284 | uc[pos] == 0xe37 || never evaluated: uc[pos] == 0xe37 | 0 |
285 | uc[pos] == 0xe47 || never evaluated: uc[pos] == 0xe47 | 0 |
286 | uc[pos] == 0xe4c || never evaluated: uc[pos] == 0xe4c | 0 |
287 | uc[pos] == 0xe4d || never evaluated: uc[pos] == 0xe4d | 0 |
288 | uc[pos] == 0xe4e) { never evaluated: uc[pos] == 0xe4e | 0 |
289 | cmb = HB_Combining_AboveRight; | - |
290 | } else if (uc[pos] == 0xeb1 || never evaluated: uc[pos] == 0xeb1 | 0 |
291 | uc[pos] == 0xeb4 || never evaluated: uc[pos] == 0xeb4 | 0 |
292 | uc[pos] == 0xeb5 || never evaluated: uc[pos] == 0xeb5 | 0 |
293 | uc[pos] == 0xeb6 || never evaluated: uc[pos] == 0xeb6 | 0 |
294 | uc[pos] == 0xeb7 || never evaluated: uc[pos] == 0xeb7 | 0 |
295 | uc[pos] == 0xebb || never evaluated: uc[pos] == 0xebb | 0 |
296 | uc[pos] == 0xecc || never evaluated: uc[pos] == 0xecc | 0 |
297 | uc[pos] == 0xecd) { never evaluated: uc[pos] == 0xecd | 0 |
298 | cmb = HB_Combining_Above; | - |
299 | } else if (uc[pos] == 0xebc) { never evaluated: uc[pos] == 0xebc | 0 |
300 | cmb = HB_Combining_Below; | - |
301 | } | 0 |
302 | } | - |
303 | } | 0 |
304 | | - |
305 | attributes[pos].mark = true; | - |
306 | attributes[pos].clusterStart = false; | - |
307 | attributes[pos].combiningClass = cmb; | - |
308 | logClusters[i] = cStart; | - |
309 | } executed: } Execution Count:1 | 1 |
310 | | - |
311 | | - |
312 | | - |
313 | if (lastCat == HB_Separator_Space) evaluated: lastCat == HB_Separator_Space yes Evaluation Count:309775 | yes Evaluation Count:2358862 |
| 309775-2358862 |
314 | attributes[pos-1].justification = HB_Space; executed: attributes[pos-1].justification = HB_Space; Execution Count:309775 | 309775 |
315 | else if (cat != HB_Mark_NonSpacing) evaluated: cat != HB_Mark_NonSpacing yes Evaluation Count:2358861 | yes Evaluation Count:1 |
| 1-2358861 |
316 | attributes[pos-1].justification = HB_Character; executed: attributes[pos-1].justification = HB_Character; Execution Count:2358861 | 2358861 |
317 | else | - |
318 | attributes[pos-1].justification = HB_NoJustification; executed: attributes[pos-1].justification = HB_NoJustification; Execution Count:1 | 1 |
319 | | - |
320 | lastCat = cat; | - |
321 | } executed: } Execution Count:2668637 | 2668637 |
322 | pos = logClusters[length-1]; | - |
323 | if (lastCat == HB_Separator_Space) evaluated: lastCat == HB_Separator_Space yes Evaluation Count:1597 | yes Evaluation Count:246683 |
| 1597-246683 |
324 | attributes[pos].justification = HB_Space; executed: attributes[pos].justification = HB_Space; Execution Count:1597 | 1597 |
325 | else | - |
326 | attributes[pos].justification = HB_Character; executed: attributes[pos].justification = HB_Character; Execution Count:246683 | 246683 |
327 | } | - |
328 | | - |
329 | | - |
330 | static const HB_OpenTypeFeature basic_features[] = { | - |
331 | { ( ( (HB_UInt)'c' << 24 ) | ( (HB_UInt)'c' << 16 ) | ( (HB_UInt)'m' << 8 ) | (HB_UInt)'p' ), CcmpProperty }, | - |
332 | { ( ( (HB_UInt)'l' << 24 ) | ( (HB_UInt)'i' << 16 ) | ( (HB_UInt)'g' << 8 ) | (HB_UInt)'a' ), LigaProperty }, | - |
333 | { ( ( (HB_UInt)'c' << 24 ) | ( (HB_UInt)'l' << 16 ) | ( (HB_UInt)'i' << 8 ) | (HB_UInt)'g' ), CligProperty }, | - |
334 | {0, 0} | - |
335 | }; | - |
336 | | - |
337 | static const HB_OpenTypeFeature disabled_features[] = { | - |
338 | { ( ( (HB_UInt)'c' << 24 ) | ( (HB_UInt)'p' << 16 ) | ( (HB_UInt)'c' << 8 ) | (HB_UInt)'t' ), 0x80000000 }, | - |
339 | { ( ( (HB_UInt)'h' << 24 ) | ( (HB_UInt)'a' << 16 ) | ( (HB_UInt)'l' << 8 ) | (HB_UInt)'t' ), 0x80000000 }, | - |
340 | | - |
341 | | - |
342 | { ( ( (HB_UInt)'v' << 24 ) | ( (HB_UInt)'a' << 16 ) | ( (HB_UInt)'l' << 8 ) | (HB_UInt)'t' ), 0x80000000 }, | - |
343 | { ( ( (HB_UInt)'v' << 24 ) | ( (HB_UInt)'h' << 16 ) | ( (HB_UInt)'a' << 8 ) | (HB_UInt)'l' ), 0x80000000 }, | - |
344 | { ( ( (HB_UInt)'v' << 24 ) | ( (HB_UInt)'k' << 16 ) | ( (HB_UInt)'r' << 8 ) | (HB_UInt)'n' ), 0x80000000 }, | - |
345 | { ( ( (HB_UInt)'v' << 24 ) | ( (HB_UInt)'p' << 16 ) | ( (HB_UInt)'a' << 8 ) | (HB_UInt)'l' ), 0x80000000 }, | - |
346 | {0, 0} | - |
347 | }; | - |
348 | | - |
349 | | - |
350 | HB_Bool HB_ConvertStringToGlyphIndices(HB_ShaperItem *shaper_item) | - |
351 | { | - |
352 | if (shaper_item->glyphIndicesPresent) { partially evaluated: shaper_item->glyphIndicesPresent yes Evaluation Count:248280 | no Evaluation Count:0 |
| 0-248280 |
353 | shaper_item->num_glyphs = shaper_item->initialGlyphCount; | - |
354 | shaper_item->glyphIndicesPresent = false; | - |
355 | return true; executed: return true; Execution Count:248280 | 248280 |
356 | } | - |
357 | return shaper_item->font->klass | 0 |
358 | ->convertStringToGlyphIndices(shaper_item->font, | 0 |
359 | shaper_item->string + shaper_item->item.pos, shaper_item->item.length, | 0 |
360 | shaper_item->glyphs, &shaper_item->num_glyphs, | 0 |
361 | shaper_item->item.bidiLevel % 2); never executed: return shaper_item->font->klass ->convertStringToGlyphIndices(shaper_item->font, shaper_item->string + shaper_item->item.pos, shaper_item->item.length, shaper_item->glyphs, &shaper_item->num_glyphs, shaper_item->item.bidiLevel % 2); | 0 |
362 | } | - |
363 | | - |
364 | HB_Bool HB_BasicShape(HB_ShaperItem *shaper_item) | - |
365 | { | - |
366 | | - |
367 | const int availableGlyphs = shaper_item->num_glyphs; | - |
368 | | - |
369 | | - |
370 | if (!HB_ConvertStringToGlyphIndices(shaper_item)) partially evaluated: !HB_ConvertStringToGlyphIndices(shaper_item) no Evaluation Count:0 | yes Evaluation Count:248109 |
| 0-248109 |
371 | return false; never executed: return false; | 0 |
372 | | - |
373 | HB_HeuristicSetGlyphAttributes(shaper_item); | - |
374 | | - |
375 | | - |
376 | if (HB_SelectScript(shaper_item, basic_features)) { evaluated: HB_SelectScript(shaper_item, basic_features) yes Evaluation Count:247835 | yes Evaluation Count:274 |
| 274-247835 |
377 | HB_OpenTypeShape(shaper_item, 0); | - |
378 | return HB_OpenTypePosition(shaper_item, availableGlyphs, true); executed: return HB_OpenTypePosition(shaper_item, availableGlyphs, true); Execution Count:247835 | 247835 |
379 | } | - |
380 | | - |
381 | | - |
382 | HB_HeuristicPosition(shaper_item); | - |
383 | return true; executed: return true; Execution Count:274 | 274 |
384 | } | - |
385 | | - |
386 | const HB_ScriptEngine HB_ScriptEngines[] = { | - |
387 | | - |
388 | { HB_BasicShape, 0}, | - |
389 | | - |
390 | { HB_GreekShape, 0}, | - |
391 | | - |
392 | { HB_BasicShape, 0}, | - |
393 | | - |
394 | { HB_BasicShape, 0}, | - |
395 | | - |
396 | { HB_HebrewShape, 0 }, | - |
397 | | - |
398 | { HB_ArabicShape, 0}, | - |
399 | | - |
400 | { HB_ArabicShape, 0}, | - |
401 | | - |
402 | { HB_BasicShape, 0 }, | - |
403 | | - |
404 | { HB_IndicShape, HB_IndicAttributes }, | - |
405 | | - |
406 | { HB_IndicShape, HB_IndicAttributes }, | - |
407 | | - |
408 | { HB_IndicShape, HB_IndicAttributes }, | - |
409 | | - |
410 | { HB_IndicShape, HB_IndicAttributes }, | - |
411 | | - |
412 | { HB_IndicShape, HB_IndicAttributes }, | - |
413 | | - |
414 | { HB_IndicShape, HB_IndicAttributes }, | - |
415 | | - |
416 | { HB_IndicShape, HB_IndicAttributes }, | - |
417 | | - |
418 | { HB_IndicShape, HB_IndicAttributes }, | - |
419 | | - |
420 | { HB_IndicShape, HB_IndicAttributes }, | - |
421 | | - |
422 | { HB_IndicShape, HB_IndicAttributes }, | - |
423 | | - |
424 | { HB_ThaiShape, HB_ThaiAttributes }, | - |
425 | | - |
426 | { HB_BasicShape, 0 }, | - |
427 | | - |
428 | { HB_TibetanShape, HB_TibetanAttributes }, | - |
429 | | - |
430 | { HB_MyanmarShape, HB_MyanmarAttributes }, | - |
431 | | - |
432 | { HB_BasicShape, 0 }, | - |
433 | | - |
434 | { HB_HangulShape, 0 }, | - |
435 | | - |
436 | { HB_BasicShape, 0 }, | - |
437 | | - |
438 | { HB_BasicShape, 0 }, | - |
439 | | - |
440 | { HB_KhmerShape, HB_KhmerAttributes }, | - |
441 | | - |
442 | { HB_ArabicShape, 0} | - |
443 | }; | - |
444 | | - |
445 | void HB_GetTailoredCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, | - |
446 | const HB_ScriptItem *items, hb_uint32 numItems, | - |
447 | HB_CharAttributes *attributes) | - |
448 | { | - |
449 | if (stringLength == 0) partially evaluated: stringLength == 0 no Evaluation Count:0 | yes Evaluation Count:197626 |
| 0-197626 |
450 | return; | 0 |
451 | for (hb_uint32 i = 0; i < numItems; ++i) { evaluated: i < numItems yes Evaluation Count:176633 | yes Evaluation Count:197626 |
| 176633-197626 |
452 | HB_Script script = items[i].script; | - |
453 | if (script == HB_Script_Inherited) partially evaluated: script == HB_Script_Inherited no Evaluation Count:0 | yes Evaluation Count:176633 |
| 0-176633 |
454 | script = HB_Script_Common; never executed: script = HB_Script_Common; | 0 |
455 | HB_AttributeFunction attributeFunction = HB_ScriptEngines[script].charAttributes; | - |
456 | if (!attributeFunction) evaluated: !attributeFunction yes Evaluation Count:176614 | yes Evaluation Count:19 |
| 19-176614 |
457 | continue; executed: continue; Execution Count:176614 | 176614 |
458 | attributeFunction(script, string, items[i].pos, items[i].length, attributes); | - |
459 | } executed: } Execution Count:19 | 19 |
460 | } executed: } Execution Count:197626 | 197626 |
461 | | - |
462 | | - |
463 | static inline char *tag_to_string(HB_UInt tag) | - |
464 | { | - |
465 | static char string[5]; | - |
466 | string[0] = (tag >> 24)&0xff; | - |
467 | string[1] = (tag >> 16)&0xff; | - |
468 | string[2] = (tag >> 8)&0xff; | - |
469 | string[3] = tag&0xff; | - |
470 | string[4] = 0; | - |
471 | return string; never executed: return string; | 0 |
472 | } | - |
473 | enum { | - |
474 | RequiresGsub = 1, | - |
475 | RequiresGpos = 2 | - |
476 | }; | - |
477 | | - |
478 | struct OTScripts { | - |
479 | unsigned int tag; | - |
480 | int flags; | - |
481 | }; | - |
482 | static const OTScripts ot_scripts [] = { | - |
483 | | - |
484 | { ( ( (HB_UInt)'l' << 24 ) | ( (HB_UInt)'a' << 16 ) | ( (HB_UInt)'t' << 8 ) | (HB_UInt)'n' ), 0 }, | - |
485 | | - |
486 | { ( ( (HB_UInt)'g' << 24 ) | ( (HB_UInt)'r' << 16 ) | ( (HB_UInt)'e' << 8 ) | (HB_UInt)'k' ), 0 }, | - |
487 | | - |
488 | { ( ( (HB_UInt)'c' << 24 ) | ( (HB_UInt)'y' << 16 ) | ( (HB_UInt)'r' << 8 ) | (HB_UInt)'l' ), 0 }, | - |
489 | | - |
490 | { ( ( (HB_UInt)'a' << 24 ) | ( (HB_UInt)'r' << 16 ) | ( (HB_UInt)'m' << 8 ) | (HB_UInt)'n' ), 0 }, | - |
491 | | - |
492 | { ( ( (HB_UInt)'h' << 24 ) | ( (HB_UInt)'e' << 16 ) | ( (HB_UInt)'b' << 8 ) | (HB_UInt)'r' ), 1 }, | - |
493 | | - |
494 | { ( ( (HB_UInt)'a' << 24 ) | ( (HB_UInt)'r' << 16 ) | ( (HB_UInt)'a' << 8 ) | (HB_UInt)'b' ), 1 }, | - |
495 | | - |
496 | { ( ( (HB_UInt)'s' << 24 ) | ( (HB_UInt)'y' << 16 ) | ( (HB_UInt)'r' << 8 ) | (HB_UInt)'c' ), 1 }, | - |
497 | | - |
498 | { ( ( (HB_UInt)'t' << 24 ) | ( (HB_UInt)'h' << 16 ) | ( (HB_UInt)'a' << 8 ) | (HB_UInt)'a' ), 1 }, | - |
499 | | - |
500 | { ( ( (HB_UInt)'d' << 24 ) | ( (HB_UInt)'e' << 16 ) | ( (HB_UInt)'v' << 8 ) | (HB_UInt)'a' ), 1 }, | - |
501 | | - |
502 | { ( ( (HB_UInt)'b' << 24 ) | ( (HB_UInt)'e' << 16 ) | ( (HB_UInt)'n' << 8 ) | (HB_UInt)'g' ), 1 }, | - |
503 | | - |
504 | { ( ( (HB_UInt)'g' << 24 ) | ( (HB_UInt)'u' << 16 ) | ( (HB_UInt)'r' << 8 ) | (HB_UInt)'u' ), 1 }, | - |
505 | | - |
506 | { ( ( (HB_UInt)'g' << 24 ) | ( (HB_UInt)'u' << 16 ) | ( (HB_UInt)'j' << 8 ) | (HB_UInt)'r' ), 1 }, | - |
507 | | - |
508 | { ( ( (HB_UInt)'o' << 24 ) | ( (HB_UInt)'r' << 16 ) | ( (HB_UInt)'y' << 8 ) | (HB_UInt)'a' ), 1 }, | - |
509 | | - |
510 | { ( ( (HB_UInt)'t' << 24 ) | ( (HB_UInt)'a' << 16 ) | ( (HB_UInt)'m' << 8 ) | (HB_UInt)'l' ), 1 }, | - |
511 | | - |
512 | { ( ( (HB_UInt)'t' << 24 ) | ( (HB_UInt)'e' << 16 ) | ( (HB_UInt)'l' << 8 ) | (HB_UInt)'u' ), 1 }, | - |
513 | | - |
514 | { ( ( (HB_UInt)'k' << 24 ) | ( (HB_UInt)'n' << 16 ) | ( (HB_UInt)'d' << 8 ) | (HB_UInt)'a' ), 1 }, | - |
515 | | - |
516 | { ( ( (HB_UInt)'m' << 24 ) | ( (HB_UInt)'l' << 16 ) | ( (HB_UInt)'y' << 8 ) | (HB_UInt)'m' ), 1 }, | - |
517 | | - |
518 | { ( ( (HB_UInt)'s' << 24 ) | ( (HB_UInt)'i' << 16 ) | ( (HB_UInt)'n' << 8 ) | (HB_UInt)'h' ), 1 }, | - |
519 | | - |
520 | { ( ( (HB_UInt)'t' << 24 ) | ( (HB_UInt)'h' << 16 ) | ( (HB_UInt)'a' << 8 ) | (HB_UInt)'i' ), 1 }, | - |
521 | | - |
522 | { ( ( (HB_UInt)'l' << 24 ) | ( (HB_UInt)'a' << 16 ) | ( (HB_UInt)'o' << 8 ) | (HB_UInt)' ' ), 1 }, | - |
523 | | - |
524 | { ( ( (HB_UInt)'t' << 24 ) | ( (HB_UInt)'i' << 16 ) | ( (HB_UInt)'b' << 8 ) | (HB_UInt)'t' ), 1 }, | - |
525 | | - |
526 | { ( ( (HB_UInt)'m' << 24 ) | ( (HB_UInt)'y' << 16 ) | ( (HB_UInt)'m' << 8 ) | (HB_UInt)'r' ), 1 }, | - |
527 | | - |
528 | { ( ( (HB_UInt)'g' << 24 ) | ( (HB_UInt)'e' << 16 ) | ( (HB_UInt)'o' << 8 ) | (HB_UInt)'r' ), 0 }, | - |
529 | | - |
530 | { ( ( (HB_UInt)'h' << 24 ) | ( (HB_UInt)'a' << 16 ) | ( (HB_UInt)'n' << 8 ) | (HB_UInt)'g' ), 1 }, | - |
531 | | - |
532 | { ( ( (HB_UInt)'o' << 24 ) | ( (HB_UInt)'g' << 16 ) | ( (HB_UInt)'a' << 8 ) | (HB_UInt)'m' ), 0 }, | - |
533 | | - |
534 | { ( ( (HB_UInt)'r' << 24 ) | ( (HB_UInt)'u' << 16 ) | ( (HB_UInt)'n' << 8 ) | (HB_UInt)'r' ), 0 }, | - |
535 | | - |
536 | { ( ( (HB_UInt)'k' << 24 ) | ( (HB_UInt)'h' << 16 ) | ( (HB_UInt)'m' << 8 ) | (HB_UInt)'r' ), 1 }, | - |
537 | | - |
538 | { ( ( (HB_UInt)'n' << 24 ) | ( (HB_UInt)'k' << 16 ) | ( (HB_UInt)'o' << 8 ) | (HB_UInt)' ' ), 1 } | - |
539 | }; | - |
540 | enum { NumOTScripts = sizeof(ot_scripts)/sizeof(OTScripts) }; | - |
541 | | - |
542 | static HB_Bool checkScript(HB_Face face, int script) | - |
543 | { | - |
544 | ((script < HB_ScriptCount) ? static_cast<void> (0) : __assert_fail ("script < HB_ScriptCount", "../3rdparty/harfbuzz/src/harfbuzz-shaper.cpp", 598, __PRETTY_FUNCTION__)); | - |
545 | | - |
546 | if (!face->gsub && !face->gpos) evaluated: !face->gsub yes Evaluation Count:2212 | yes Evaluation Count:3892 |
partially evaluated: !face->gpos yes Evaluation Count:2212 | no Evaluation Count:0 |
| 0-3892 |
547 | return false; executed: return false; Execution Count:2212 | 2212 |
548 | | - |
549 | unsigned int tag = ot_scripts[script].tag; | - |
550 | int requirements = ot_scripts[script].flags; | - |
551 | | - |
552 | if (requirements & RequiresGsub) { evaluated: requirements & RequiresGsub yes Evaluation Count:2919 | yes Evaluation Count:973 |
| 973-2919 |
553 | if (!face->gsub) partially evaluated: !face->gsub no Evaluation Count:0 | yes Evaluation Count:2919 |
| 0-2919 |
554 | return false; never executed: return false; | 0 |
555 | | - |
556 | HB_UShort script_index; | - |
557 | HB_Error error = HB_GSUB_Select_Script(face->gsub, tag, &script_index); | - |
558 | if (error) { evaluated: error yes Evaluation Count:2279 | yes Evaluation Count:640 |
| 640-2279 |
559 | if (1) ; else printf("could not select script %d in GSub table: %d", (int)script, error); partially evaluated: 1 yes Evaluation Count:2279 | no Evaluation Count:0 |
executed: ; Execution Count:2279 never executed: printf("could not select script %d in GSub table: %d", (int)script, error); | 0-2279 |
560 | error = HB_GSUB_Select_Script(face->gsub, ( ( (HB_UInt)'D' << 24 ) | ( (HB_UInt)'F' << 16 ) | ( (HB_UInt)'L' << 8 ) | (HB_UInt)'T' ), &script_index); | - |
561 | if (error) evaluated: error yes Evaluation Count:224 | yes Evaluation Count:2055 |
| 224-2055 |
562 | return false; executed: return false; Execution Count:224 | 224 |
563 | } executed: } Execution Count:2055 | 2055 |
564 | } executed: } Execution Count:2695 | 2695 |
565 | | - |
566 | if (requirements & RequiresGpos) { partially evaluated: requirements & RequiresGpos no Evaluation Count:0 | yes Evaluation Count:3668 |
| 0-3668 |
567 | if (!face->gpos) never evaluated: !face->gpos | 0 |
568 | return false; never executed: return false; | 0 |
569 | | - |
570 | HB_UShort script_index; | - |
571 | HB_Error error = HB_GPOS_Select_Script(face->gpos, script, &script_index); | - |
572 | if (error) { | 0 |
573 | if (1) ; else printf("could not select script in gpos table: %d", error); never executed: printf("could not select script in gpos table: %d", error); | 0 |
574 | error = HB_GPOS_Select_Script(face->gpos, ( ( (HB_UInt)'D' << 24 ) | ( (HB_UInt)'F' << 16 ) | ( (HB_UInt)'L' << 8 ) | (HB_UInt)'T' ), &script_index); | - |
575 | if (error) | 0 |
576 | return false; never executed: return false; | 0 |
577 | } | 0 |
578 | | - |
579 | } | 0 |
580 | return true; executed: return true; Execution Count:3668 | 3668 |
581 | } | - |
582 | | - |
583 | static HB_Stream getTableStream(void *font, HB_GetFontTableFunc tableFunc, HB_Tag tag) | - |
584 | { | - |
585 | HB_Error error; | - |
586 | HB_UInt length = 0; | - |
587 | HB_Stream stream = 0; | - |
588 | | - |
589 | if (!font) partially evaluated: !font no Evaluation Count:0 | yes Evaluation Count:654 |
| 0-654 |
590 | return 0; never executed: return 0; | 0 |
591 | | - |
592 | error = tableFunc(font, tag, 0, &length); | - |
593 | if (error) evaluated: error yes Evaluation Count:240 | yes Evaluation Count:414 |
| 240-414 |
594 | return 0; executed: return 0; Execution Count:240 | 240 |
595 | stream = (HB_Stream)malloc(sizeof(HB_StreamRec)); | - |
596 | if (!stream) partially evaluated: !stream no Evaluation Count:0 | yes Evaluation Count:414 |
| 0-414 |
597 | return 0; never executed: return 0; | 0 |
598 | stream->base = (HB_Byte*)malloc(length); | - |
599 | if (!stream->base) { partially evaluated: !stream->base no Evaluation Count:0 | yes Evaluation Count:414 |
| 0-414 |
600 | free(stream); | - |
601 | return 0; never executed: return 0; | 0 |
602 | } | - |
603 | error = tableFunc(font, tag, stream->base, &length); | - |
604 | if (error) { partially evaluated: error no Evaluation Count:0 | yes Evaluation Count:414 |
| 0-414 |
605 | _hb_close_stream(stream); | - |
606 | return 0; never executed: return 0; | 0 |
607 | } | - |
608 | stream->size = length; | - |
609 | stream->pos = 0; | - |
610 | stream->cursor = __null; | - |
611 | return stream; executed: return stream; Execution Count:414 | 414 |
612 | } | - |
613 | | - |
614 | HB_Face HB_AllocFace(void *font, HB_GetFontTableFunc tableFunc) | - |
615 | { | - |
616 | HB_Face face = (HB_Face )malloc(sizeof(HB_FaceRec)); | - |
617 | if (!face) partially evaluated: !face no Evaluation Count:0 | yes Evaluation Count:1887 |
| 0-1887 |
618 | return 0; never executed: return 0; | 0 |
619 | | - |
620 | face->isSymbolFont = false; | - |
621 | face->gdef = 0; | - |
622 | face->gpos = 0; | - |
623 | face->gsub = 0; | - |
624 | face->current_script = HB_ScriptCount; | - |
625 | face->current_flags = HB_ShaperFlag_Default; | - |
626 | face->has_opentype_kerning = false; | - |
627 | face->tmpAttributes = 0; | - |
628 | face->tmpLogClusters = 0; | - |
629 | face->glyphs_substituted = false; | - |
630 | face->buffer = 0; | - |
631 | face->font_for_init = font; | - |
632 | face->get_font_table_func = tableFunc; | - |
633 | | - |
634 | return face; executed: return face; Execution Count:1887 | 1887 |
635 | } | - |
636 | | - |
637 | HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc) | - |
638 | { | - |
639 | HB_Face face = HB_AllocFace(font, tableFunc); | - |
640 | if (face) | 0 |
641 | face = HB_LoadFace(face); never executed: face = HB_LoadFace(face); | 0 |
642 | return face; never executed: return face; | 0 |
643 | } | - |
644 | | - |
645 | HB_Face HB_LoadFace(HB_Face face) | - |
646 | { | - |
647 | void *font = face->font_for_init; | - |
648 | if (!font) partially evaluated: !font no Evaluation Count:0 | yes Evaluation Count:218 |
| 0-218 |
649 | return face; never executed: return face; | 0 |
650 | | - |
651 | HB_GetFontTableFunc tableFunc = face->get_font_table_func; | - |
652 | | - |
653 | face->get_font_table_func = 0; | - |
654 | face->font_for_init = 0; | - |
655 | | - |
656 | HB_Error error = HB_Err_Ok; | - |
657 | HB_Stream stream; | - |
658 | HB_Stream gdefStream; | - |
659 | | - |
660 | gdefStream = getTableStream(font, tableFunc, ( ( (HB_UInt)'G' << 24 ) | ( (HB_UInt)'D' << 16 ) | ( (HB_UInt)'E' << 8 ) | (HB_UInt)'F' )); | - |
661 | error = HB_Err_Not_Covered; | - |
662 | if (!gdefStream || (error = HB_Load_GDEF_Table(gdefStream, &face->gdef))) { evaluated: !gdefStream yes Evaluation Count:82 | yes Evaluation Count:136 |
partially evaluated: (error = HB_Load_GDEF_Table(gdefStream, &face->gdef)) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
663 | | - |
664 | face->gdef = 0; | - |
665 | } executed: } Execution Count:82 | 82 |
666 | | - |
667 | | - |
668 | stream = getTableStream(font, tableFunc, ( ( (HB_UInt)'G' << 24 ) | ( (HB_UInt)'S' << 16 ) | ( (HB_UInt)'U' << 8 ) | (HB_UInt)'B' )); | - |
669 | error = HB_Err_Not_Covered; | - |
670 | if (!stream || (error = HB_Load_GSUB_Table(stream, &face->gsub, face->gdef, gdefStream))) { evaluated: !stream yes Evaluation Count:79 | yes Evaluation Count:139 |
partially evaluated: (error = HB_Load_GSUB_Table(stream, &face->gsub, face->gdef, gdefStream)) no Evaluation Count:0 | yes Evaluation Count:139 |
| 0-139 |
671 | face->gsub = 0; | - |
672 | if (error != HB_Err_Not_Covered) { partially evaluated: error != HB_Err_Not_Covered no Evaluation Count:0 | yes Evaluation Count:79 |
| 0-79 |
673 | | - |
674 | } else { | 0 |
675 | | - |
676 | } executed: } Execution Count:79 | 79 |
677 | } | - |
678 | _hb_close_stream(stream); | - |
679 | | - |
680 | stream = getTableStream(font, tableFunc, ( ( (HB_UInt)'G' << 24 ) | ( (HB_UInt)'P' << 16 ) | ( (HB_UInt)'O' << 8 ) | (HB_UInt)'S' )); | - |
681 | error = HB_Err_Not_Covered; | - |
682 | if (!stream || (error = HB_Load_GPOS_Table(stream, &face->gpos, face->gdef, gdefStream))) { evaluated: !stream yes Evaluation Count:79 | yes Evaluation Count:139 |
partially evaluated: (error = HB_Load_GPOS_Table(stream, &face->gpos, face->gdef, gdefStream)) no Evaluation Count:0 | yes Evaluation Count:139 |
| 0-139 |
683 | face->gpos = 0; | - |
684 | if (1) ; else printf("error loading gpos table: %d", error); partially evaluated: 1 yes Evaluation Count:79 | no Evaluation Count:0 |
executed: ; Execution Count:79 never executed: printf("error loading gpos table: %d", error); | 0-79 |
685 | } | - |
686 | _hb_close_stream(stream); | - |
687 | | - |
688 | _hb_close_stream(gdefStream); | - |
689 | | - |
690 | for (unsigned int i = 0; i < HB_ScriptCount; ++i) evaluated: i < HB_ScriptCount yes Evaluation Count:6104 | yes Evaluation Count:218 |
| 218-6104 |
691 | face->supported_scripts[i] = checkScript(face, i); executed: face->supported_scripts[i] = checkScript(face, i); Execution Count:6104 | 6104 |
692 | | - |
693 | if (hb_buffer_new(&face->buffer) != HB_Err_Ok) { partially evaluated: hb_buffer_new(&face->buffer) != HB_Err_Ok no Evaluation Count:0 | yes Evaluation Count:218 |
| 0-218 |
694 | HB_FreeFace(face); | - |
695 | return 0; never executed: return 0; | 0 |
696 | } | - |
697 | | - |
698 | return face; executed: return face; Execution Count:218 | 218 |
699 | } | - |
700 | | - |
701 | void HB_FreeFace(HB_Face face) | - |
702 | { | - |
703 | if (!face) evaluated: !face yes Evaluation Count:2536 | yes Evaluation Count:1877 |
| 1877-2536 |
704 | return; executed: return; Execution Count:2536 | 2536 |
705 | if (face->gpos) evaluated: face->gpos yes Evaluation Count:132 | yes Evaluation Count:1745 |
| 132-1745 |
706 | HB_Done_GPOS_Table(face->gpos); executed: HB_Done_GPOS_Table(face->gpos); Execution Count:132 | 132 |
707 | if (face->gsub) evaluated: face->gsub yes Evaluation Count:132 | yes Evaluation Count:1745 |
| 132-1745 |
708 | HB_Done_GSUB_Table(face->gsub); executed: HB_Done_GSUB_Table(face->gsub); Execution Count:132 | 132 |
709 | if (face->gdef) evaluated: face->gdef yes Evaluation Count:129 | yes Evaluation Count:1748 |
| 129-1748 |
710 | HB_Done_GDEF_Table(face->gdef); executed: HB_Done_GDEF_Table(face->gdef); Execution Count:129 | 129 |
711 | if (face->buffer) evaluated: face->buffer yes Evaluation Count:208 | yes Evaluation Count:1669 |
| 208-1669 |
712 | hb_buffer_free(face->buffer); executed: hb_buffer_free(face->buffer); Execution Count:208 | 208 |
713 | if (face->tmpAttributes) evaluated: face->tmpAttributes yes Evaluation Count:132 | yes Evaluation Count:1745 |
| 132-1745 |
714 | free(face->tmpAttributes); executed: free(face->tmpAttributes); Execution Count:132 | 132 |
715 | if (face->tmpLogClusters) evaluated: face->tmpLogClusters yes Evaluation Count:132 | yes Evaluation Count:1745 |
| 132-1745 |
716 | free(face->tmpLogClusters); executed: free(face->tmpLogClusters); Execution Count:132 | 132 |
717 | free(face); | - |
718 | } executed: } Execution Count:1877 | 1877 |
719 | | - |
720 | | - |
721 | HB_Bool HB_SelectScript(HB_ShaperItem *shaper_item, const HB_OpenTypeFeature *features) | - |
722 | { | - |
723 | HB_Script script = shaper_item->item.script; | - |
724 | | - |
725 | HB_Face face = shaper_item->face; | - |
726 | if (face->current_script == script && face->current_flags == shaper_item->shaperFlags) evaluated: face->current_script == script yes Evaluation Count:247852 | yes Evaluation Count:539 |
partially evaluated: face->current_flags == shaper_item->shaperFlags yes Evaluation Count:247852 | no Evaluation Count:0 |
| 0-247852 |
727 | return shaper_item->face->supported_scripts[script] ? true : false; executed: return shaper_item->face->supported_scripts[script] ? true : false; Execution Count:247852 | 247852 |
728 | | - |
729 | face->current_script = script; | - |
730 | face->current_flags = shaper_item->shaperFlags; | - |
731 | | - |
732 | if (!shaper_item->face->supported_scripts[script]) evaluated: !shaper_item->face->supported_scripts[script] yes Evaluation Count:79 | yes Evaluation Count:460 |
| 79-460 |
733 | return false; executed: return false; Execution Count:79 | 79 |
734 | | - |
735 | ((script < HB_ScriptCount) ? static_cast<void> (0) : __assert_fail ("script < HB_ScriptCount", "../3rdparty/harfbuzz/src/harfbuzz-shaper.cpp", 789, __PRETTY_FUNCTION__)); | - |
736 | | - |
737 | unsigned int tag = ot_scripts[script].tag; | - |
738 | | - |
739 | if (face->gsub && features) { partially evaluated: face->gsub yes Evaluation Count:460 | no Evaluation Count:0 |
partially evaluated: features yes Evaluation Count:460 | no Evaluation Count:0 |
| 0-460 |
740 | HB_GSUB_Clear_Features(face->gsub); | - |
741 | HB_UShort script_index; | - |
742 | HB_Error error = HB_GSUB_Select_Script(face->gsub, tag, &script_index); | - |
743 | if (!error) { evaluated: !error yes Evaluation Count:459 | yes Evaluation Count:1 |
| 1-459 |
744 | if (1) ; else printf("script %s has script index %d", tag_to_string(script), script_index); executed: ; Execution Count:459 never executed: printf("script %s has script index %d", tag_to_string(script), script_index); partially evaluated: 1 yes Evaluation Count:459 | no Evaluation Count:0 |
| 0-459 |
745 | while (features->tag) { evaluated: features->tag yes Evaluation Count:1205 | yes Evaluation Count:459 |
| 459-1205 |
746 | HB_UShort feature_index; | - |
747 | error = HB_GSUB_Select_Feature(face->gsub, features->tag, script_index, 0xffff, &feature_index); | - |
748 | if (!error) { evaluated: !error yes Evaluation Count:759 | yes Evaluation Count:446 |
| 446-759 |
749 | if (1) ; else printf(" adding feature %s", tag_to_string(features->tag)); executed: ; Execution Count:759 never executed: printf(" adding feature %s", tag_to_string(features->tag)); partially evaluated: 1 yes Evaluation Count:759 | no Evaluation Count:0 |
| 0-759 |
750 | HB_GSUB_Add_Feature(face->gsub, feature_index, features->property); | - |
751 | } executed: } Execution Count:759 | 759 |
752 | ++features; | - |
753 | } executed: } Execution Count:1205 | 1205 |
754 | } executed: } Execution Count:459 | 459 |
755 | } executed: } Execution Count:460 | 460 |
756 | | - |
757 | | - |
758 | face->has_opentype_kerning = false; | - |
759 | | - |
760 | if (face->gpos) { partially evaluated: face->gpos yes Evaluation Count:460 | no Evaluation Count:0 |
| 0-460 |
761 | HB_GPOS_Clear_Features(face->gpos); | - |
762 | HB_UShort script_index; | - |
763 | HB_Error error = HB_GPOS_Select_Script(face->gpos, tag, &script_index); | - |
764 | if (!error) { evaluated: !error yes Evaluation Count:459 | yes Evaluation Count:1 |
| 1-459 |
765 | HB_UInt *feature_tag_list_buffer; | - |
766 | error = HB_GPOS_Query_Features(face->gpos, script_index, 0xffff, &feature_tag_list_buffer); | - |
767 | if (!error) { partially evaluated: !error yes Evaluation Count:459 | no Evaluation Count:0 |
| 0-459 |
768 | HB_UInt *feature_tag_list = feature_tag_list_buffer; | - |
769 | while (*feature_tag_list) { evaluated: *feature_tag_list yes Evaluation Count:1259 | yes Evaluation Count:459 |
| 459-1259 |
770 | HB_UShort feature_index; | - |
771 | bool skip = false; | - |
772 | if (*feature_tag_list == ( ( (HB_UInt)'k' << 24 ) | ( (HB_UInt)'e' << 16 ) | ( (HB_UInt)'r' << 8 ) | (HB_UInt)'n' )) { evaluated: *feature_tag_list == ( ( (HB_UInt)'k' << 24 ) | ( (HB_UInt)'e' << 16 ) | ( (HB_UInt)'r' << 8 ) | (HB_UInt)'n' ) yes Evaluation Count:452 | yes Evaluation Count:807 |
| 452-807 |
773 | if (face->current_flags & HB_ShaperFlag_NoKerning) partially evaluated: face->current_flags & HB_ShaperFlag_NoKerning no Evaluation Count:0 | yes Evaluation Count:452 |
| 0-452 |
774 | skip = true; never executed: skip = true; | 0 |
775 | else | - |
776 | face->has_opentype_kerning = true; executed: face->has_opentype_kerning = true; Execution Count:452 | 452 |
777 | } | - |
778 | features = disabled_features; | - |
779 | while (features->tag) { evaluated: features->tag yes Evaluation Count:7554 | yes Evaluation Count:1259 |
| 1259-7554 |
780 | if (*feature_tag_list == features->tag) { partially evaluated: *feature_tag_list == features->tag no Evaluation Count:0 | yes Evaluation Count:7554 |
| 0-7554 |
781 | skip = true; | - |
782 | break; | 0 |
783 | } | - |
784 | ++features; | - |
785 | } executed: } Execution Count:7554 | 7554 |
786 | | - |
787 | if (!face->has_opentype_kerning && evaluated: !face->has_opentype_kerning yes Evaluation Count:11 | yes Evaluation Count:1248 |
| 11-1248 |
788 | *feature_tag_list == ( ( (HB_UInt)'p' << 24 ) | ( (HB_UInt)'a' << 16 ) | ( (HB_UInt)'l' << 8 ) | (HB_UInt)'t' )) partially evaluated: *feature_tag_list == ( ( (HB_UInt)'p' << 24 ) | ( (HB_UInt)'a' << 16 ) | ( (HB_UInt)'l' << 8 ) | (HB_UInt)'t' ) no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
789 | skip = true; never executed: skip = true; | 0 |
790 | | - |
791 | if (skip) { partially evaluated: skip no Evaluation Count:0 | yes Evaluation Count:1259 |
| 0-1259 |
792 | ++feature_tag_list; | - |
793 | continue; never executed: continue; | 0 |
794 | } | - |
795 | error = HB_GPOS_Select_Feature(face->gpos, *feature_tag_list, script_index, 0xffff, &feature_index); | - |
796 | if (!error) partially evaluated: !error yes Evaluation Count:1259 | no Evaluation Count:0 |
| 0-1259 |
797 | HB_GPOS_Add_Feature(face->gpos, feature_index, 0x80000000); executed: HB_GPOS_Add_Feature(face->gpos, feature_index, 0x80000000); Execution Count:1259 | 1259 |
798 | ++feature_tag_list; | - |
799 | } executed: } Execution Count:1259 | 1259 |
800 | do { if ( (feature_tag_list_buffer) ) { _hb_free( feature_tag_list_buffer ); feature_tag_list_buffer = __null; } } while (0); executed: } Execution Count:459 executed: } Execution Count:459 partially evaluated: (feature_tag_list_buffer) yes Evaluation Count:459 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:459 |
| 0-459 |
801 | } executed: } Execution Count:459 | 459 |
802 | } executed: } Execution Count:459 | 459 |
803 | } executed: } Execution Count:460 | 460 |
804 | | - |
805 | return true; executed: return true; Execution Count:460 | 460 |
806 | } | - |
807 | | - |
808 | static HB_Bool containsSurrogates(HB_ShaperItem *item) | - |
809 | { | - |
810 | for (hb_uint32 i=item->item.pos; i<item->item.pos+item->item.length; ++i) { evaluated: i<item->item.pos+item->item.length yes Evaluation Count:3122810 | yes Evaluation Count:248113 |
| 248113-3122810 |
811 | HB_UChar16 ucs = item->string[i]; | - |
812 | if ( (((ucs) & 0xfc00) == 0xd800) || (((ucs) & 0xfc00) == 0xdc00) ) partially evaluated: (((ucs) & 0xfc00) == 0xd800) no Evaluation Count:0 | yes Evaluation Count:3122810 |
partially evaluated: (((ucs) & 0xfc00) == 0xdc00) no Evaluation Count:0 | yes Evaluation Count:3122810 |
| 0-3122810 |
813 | return true; never executed: return true; | 0 |
814 | } executed: } Execution Count:3122810 | 3122810 |
815 | | - |
816 | return false; executed: return false; Execution Count:248113 | 248113 |
817 | } | - |
818 | | - |
819 | HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties) | - |
820 | { | - |
821 | HB_GlyphAttributes *tmpAttributes; | - |
822 | unsigned int *tmpLogClusters; | - |
823 | | - |
824 | HB_Face face = item->face; | - |
825 | | - |
826 | face->length = item->num_glyphs; | - |
827 | | - |
828 | hb_buffer_clear(face->buffer); | - |
829 | | - |
830 | tmpAttributes = (HB_GlyphAttributes *) realloc(face->tmpAttributes, face->length*sizeof(HB_GlyphAttributes)); | - |
831 | if (!tmpAttributes) partially evaluated: !tmpAttributes no Evaluation Count:0 | yes Evaluation Count:248113 |
| 0-248113 |
832 | return false; never executed: return false; | 0 |
833 | face->tmpAttributes = tmpAttributes; | - |
834 | | - |
835 | tmpLogClusters = (unsigned int *) realloc(face->tmpLogClusters, face->length*sizeof(unsigned int)); | - |
836 | if (!tmpLogClusters) partially evaluated: !tmpLogClusters no Evaluation Count:0 | yes Evaluation Count:248113 |
| 0-248113 |
837 | return false; never executed: return false; | 0 |
838 | face->tmpLogClusters = tmpLogClusters; | - |
839 | | - |
840 | for (int i = 0; i < face->length; ++i) { evaluated: i < face->length yes Evaluation Count:3326586 | yes Evaluation Count:248113 |
| 248113-3326586 |
841 | hb_buffer_add_glyph(face->buffer, item->glyphs[i], properties ? properties[i] : 0, i); | - |
842 | face->tmpAttributes[i] = item->attributes[i]; | - |
843 | face->tmpLogClusters[i] = item->log_clusters[i]; | - |
844 | } executed: } Execution Count:3326586 | 3326586 |
845 | face->glyphs_substituted = false; | - |
846 | if (face->gsub && !containsSurrogates(item)) { partially evaluated: face->gsub yes Evaluation Count:248113 | no Evaluation Count:0 |
partially evaluated: !containsSurrogates(item) yes Evaluation Count:248113 | no Evaluation Count:0 |
| 0-248113 |
847 | unsigned int error = HB_GSUB_Apply_String(face->gsub, face->buffer); | - |
848 | if (error && error != HB_Err_Not_Covered) evaluated: error yes Evaluation Count:238199 | yes Evaluation Count:9914 |
partially evaluated: error != HB_Err_Not_Covered no Evaluation Count:0 | yes Evaluation Count:238199 |
| 0-238199 |
849 | return false; never executed: return false; | 0 |
850 | face->glyphs_substituted = (error != HB_Err_Not_Covered); | - |
851 | } executed: } Execution Count:248113 | 248113 |
852 | return true; executed: return true; Execution Count:248113 | 248113 |
853 | } | - |
854 | | - |
855 | HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool doLogClusters) | - |
856 | { | - |
857 | HB_Face face = item->face; | - |
858 | | - |
859 | bool glyphs_positioned = false; | - |
860 | if (face->gpos) { partially evaluated: face->gpos yes Evaluation Count:248113 | no Evaluation Count:0 |
| 0-248113 |
861 | if (face->buffer->positions) evaluated: face->buffer->positions yes Evaluation Count:247974 | yes Evaluation Count:139 |
| 139-247974 |
862 | memset(face->buffer->positions, 0, face->buffer->in_length*sizeof(HB_PositionRec)); executed: memset(face->buffer->positions, 0, face->buffer->in_length*sizeof(HB_PositionRec)); Execution Count:247974 | 247974 |
863 | | - |
864 | glyphs_positioned = HB_GPOS_Apply_String(item->font, face->gpos, face->current_flags, face->buffer, false, false) != HB_Err_Not_Covered; | - |
865 | } executed: } Execution Count:248113 | 248113 |
866 | | - |
867 | if (!face->glyphs_substituted && !glyphs_positioned) { evaluated: !face->glyphs_substituted yes Evaluation Count:238199 | yes Evaluation Count:9914 |
evaluated: !glyphs_positioned yes Evaluation Count:162580 | yes Evaluation Count:75619 |
| 9914-238199 |
868 | HB_HeuristicPosition(item); | - |
869 | return true; executed: return true; Execution Count:162580 | 162580 |
870 | } | - |
871 | | - |
872 | | - |
873 | if (availableGlyphs < (int)face->buffer->in_length) { partially evaluated: availableGlyphs < (int)face->buffer->in_length no Evaluation Count:0 | yes Evaluation Count:85533 |
| 0-85533 |
874 | item->num_glyphs = face->buffer->in_length; | - |
875 | return false; never executed: return false; | 0 |
876 | } | - |
877 | | - |
878 | HB_Glyph *glyphs = item->glyphs; | - |
879 | HB_GlyphAttributes *attributes = item->attributes; | - |
880 | | - |
881 | for (unsigned int i = 0; i < face->buffer->in_length; ++i) { evaluated: i < face->buffer->in_length yes Evaluation Count:2709980 | yes Evaluation Count:85533 |
| 85533-2709980 |
882 | glyphs[i] = face->buffer->in_string[i].gindex; | - |
883 | attributes[i] = face->tmpAttributes[face->buffer->in_string[i].cluster]; | - |
884 | if (i && face->buffer->in_string[i].cluster == face->buffer->in_string[i-1].cluster) evaluated: i yes Evaluation Count:2624447 | yes Evaluation Count:85533 |
partially evaluated: face->buffer->in_string[i].cluster == face->buffer->in_string[i-1].cluster no Evaluation Count:0 | yes Evaluation Count:2624447 |
| 0-2624447 |
885 | attributes[i].clusterStart = false; never executed: attributes[i].clusterStart = false; | 0 |
886 | } executed: } Execution Count:2709980 | 2709980 |
887 | item->num_glyphs = face->buffer->in_length; | - |
888 | | - |
889 | if (doLogClusters && face->glyphs_substituted) { partially evaluated: doLogClusters yes Evaluation Count:85533 | no Evaluation Count:0 |
evaluated: face->glyphs_substituted yes Evaluation Count:9914 | yes Evaluation Count:75619 |
| 0-85533 |
890 | | - |
891 | unsigned short *logClusters = item->log_clusters; | - |
892 | int clusterStart = 0; | - |
893 | int oldCi = 0; | - |
894 | | - |
895 | | - |
896 | for (unsigned int i = 0; i < face->buffer->in_length; ++i) { evaluated: i < face->buffer->in_length yes Evaluation Count:136804 | yes Evaluation Count:9914 |
| 9914-136804 |
897 | int ci = face->buffer->in_string[i].cluster; | - |
898 | | - |
899 | | - |
900 | if (!attributes[i].mark && attributes[i].clusterStart && ci != oldCi) { partially evaluated: !attributes[i].mark yes Evaluation Count:136804 | no Evaluation Count:0 |
partially evaluated: attributes[i].clusterStart yes Evaluation Count:136804 | no Evaluation Count:0 |
evaluated: ci != oldCi yes Evaluation Count:126890 | yes Evaluation Count:9914 |
| 0-136804 |
901 | for (int j = oldCi; j < ci; j++) evaluated: j < ci yes Evaluation Count:136838 | yes Evaluation Count:126890 |
| 126890-136838 |
902 | logClusters[j] = clusterStart; executed: logClusters[j] = clusterStart; Execution Count:136838 | 136838 |
903 | clusterStart = i; | - |
904 | oldCi = ci; | - |
905 | } executed: } Execution Count:126890 | 126890 |
906 | } executed: } Execution Count:136804 | 136804 |
907 | for (int j = oldCi; j < face->length; j++) evaluated: j < face->length yes Evaluation Count:9984 | yes Evaluation Count:9914 |
| 9914-9984 |
908 | logClusters[j] = clusterStart; executed: logClusters[j] = clusterStart; Execution Count:9984 | 9984 |
909 | } executed: } Execution Count:9914 | 9914 |
910 | | - |
911 | | - |
912 | | - |
913 | | - |
914 | | - |
915 | if (glyphs_positioned) { evaluated: glyphs_positioned yes Evaluation Count:85387 | yes Evaluation Count:146 |
| 146-85387 |
916 | item->font->klass->getGlyphAdvances(item->font, item->glyphs, item->num_glyphs, item->advances, item->face->current_flags);; | - |
917 | HB_Position positions = face->buffer->positions; | - |
918 | HB_Fixed *advances = item->advances; | - |
919 | | - |
920 | | - |
921 | for (unsigned int i = 0; i < face->buffer->in_length; i++) { evaluated: i < face->buffer->in_length yes Evaluation Count:2709329 | yes Evaluation Count:85387 |
| 85387-2709329 |
922 | | - |
923 | | - |
924 | | - |
925 | | - |
926 | | - |
927 | | - |
928 | HB_Fixed adjustment = positions[i].x_advance; | - |
929 | | - |
930 | if (!(face->current_flags & HB_ShaperFlag_UseDesignMetrics)) partially evaluated: !(face->current_flags & HB_ShaperFlag_UseDesignMetrics) yes Evaluation Count:2709329 | no Evaluation Count:0 |
| 0-2709329 |
931 | adjustment = (((adjustment)+32) & -64); executed: adjustment = (((adjustment)+32) & -64); Execution Count:2709329 | 2709329 |
932 | | - |
933 | if (positions[i].new_advance) { partially evaluated: positions[i].new_advance no Evaluation Count:0 | yes Evaluation Count:2709329 |
| 0-2709329 |
934 | advances[i] = adjustment; | - |
935 | } else { | 0 |
936 | advances[i] += adjustment; | - |
937 | } executed: } Execution Count:2709329 | 2709329 |
938 | | - |
939 | int back = 0; | - |
940 | HB_FixedPoint *offsets = item->offsets; | - |
941 | offsets[i].x = positions[i].x_pos; | - |
942 | offsets[i].y = positions[i].y_pos; | - |
943 | while (positions[i - back].back) { evaluated: positions[i - back].back yes Evaluation Count:1224 | yes Evaluation Count:2709329 |
| 1224-2709329 |
944 | back += positions[i - back].back; | - |
945 | offsets[i].x += positions[i - back].x_pos; | - |
946 | offsets[i].y += positions[i - back].y_pos; | - |
947 | } executed: } Execution Count:1224 | 1224 |
948 | offsets[i].y = -offsets[i].y; | - |
949 | | - |
950 | if (item->item.bidiLevel % 2) { evaluated: item->item.bidiLevel % 2 yes Evaluation Count:28 | yes Evaluation Count:2709301 |
| 28-2709301 |
951 | | - |
952 | back = positions[i].back; | - |
953 | while (back--) partially evaluated: back-- no Evaluation Count:0 | yes Evaluation Count:28 |
| 0-28 |
954 | offsets[i].x -= advances[i-back]; never executed: offsets[i].x -= advances[i-back]; | 0 |
955 | } else { executed: } Execution Count:28 | 28 |
956 | back = 0; | - |
957 | while (positions[i - back].back) { evaluated: positions[i - back].back yes Evaluation Count:1224 | yes Evaluation Count:2709301 |
| 1224-2709301 |
958 | back += positions[i - back].back; | - |
959 | offsets[i].x -= advances[i-back]; | - |
960 | } executed: } Execution Count:1224 | 1224 |
961 | } executed: } Execution Count:2709301 | 2709301 |
962 | | - |
963 | | - |
964 | } | - |
965 | item->kerning_applied = face->has_opentype_kerning; | - |
966 | } else { executed: } Execution Count:85387 | 85387 |
967 | HB_HeuristicPosition(item); | - |
968 | } executed: } Execution Count:146 | 146 |
969 | return true; executed: return true; Execution Count:85533 | 85533 |
970 | } | - |
971 | | - |
972 | | - |
973 | HB_Bool HB_ShapeItem(HB_ShaperItem *shaper_item) | - |
974 | { | - |
975 | HB_Bool result = false; | - |
976 | if (shaper_item->num_glyphs < shaper_item->item.length) { partially evaluated: shaper_item->num_glyphs < shaper_item->item.length no Evaluation Count:0 | yes Evaluation Count:248442 |
| 0-248442 |
977 | shaper_item->num_glyphs = shaper_item->item.length; | - |
978 | return false; never executed: return false; | 0 |
979 | } | - |
980 | ((shaper_item->item.script < HB_ScriptCount) ? static_cast<void> (0) : __assert_fail ("shaper_item->item.script < HB_ScriptCount", "../3rdparty/harfbuzz/src/harfbuzz-shaper.cpp", 1098, __PRETTY_FUNCTION__)); | - |
981 | result = HB_ScriptEngines[shaper_item->item.script].shape(shaper_item); | - |
982 | shaper_item->glyphIndicesPresent = false; | - |
983 | return result; executed: return result; Execution Count:248442 | 248442 |
984 | } | - |
985 | | - |
| | |