Line | Source Code | Coverage |
---|
1 | /* | - |
2 | * Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies) | - |
3 | * | - |
4 | * This is part of HarfBuzz, an OpenType Layout engine library. | - |
5 | * | - |
6 | * Permission is hereby granted, without written agreement and without | - |
7 | * license or royalty fees, to use, copy, modify, and distribute this | - |
8 | * software and its documentation for any purpose, provided that the | - |
9 | * above copyright notice and the following two paragraphs appear in | - |
10 | * all copies of this software. | - |
11 | * | - |
12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR | - |
13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES | - |
14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN | - |
15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | - |
16 | * DAMAGE. | - |
17 | * | - |
18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, | - |
19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | - |
20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | - |
21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO | - |
22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | - |
23 | */ | - |
24 | | - |
25 | #include "harfbuzz-shaper.h" | - |
26 | #include "harfbuzz-shaper-private.h" | - |
27 | | - |
28 | #include "harfbuzz-stream-private.h" | - |
29 | #include <assert.h> | - |
30 | #include <stdio.h> | - |
31 | | - |
32 | #define HB_MIN(a, b) ((a) < (b) ? (a) : (b)) | - |
33 | #define HB_MAX(a, b) ((a) > (b) ? (a) : (b)) | - |
34 | | - |
35 | // -------------------------------------------------------------------------------------------------------------------------------------------- | - |
36 | // | - |
37 | // Basic processing | - |
38 | // | - |
39 | // -------------------------------------------------------------------------------------------------------------------------------------------- | - |
40 | | - |
41 | static inline void positionCluster(HB_ShaperItem *item, int gfrom, int glast) | - |
42 | { | - |
43 | int nmarks = glast - gfrom; executed (the execution status of this line is deduced): int nmarks = glast - gfrom; | - |
44 | assert(nmarks > 0); executed (the execution status of this line is deduced): ((nmarks > 0) ? static_cast<void> (0) : __assert_fail ("nmarks > 0", "../3rdparty/harfbuzz/src/harfbuzz-shaper.cpp", 44, __PRETTY_FUNCTION__)); | - |
45 | | - |
46 | HB_Glyph *glyphs = item->glyphs; executed (the execution status of this line is deduced): HB_Glyph *glyphs = item->glyphs; | - |
47 | HB_GlyphAttributes *attributes = item->attributes; executed (the execution status of this line is deduced): HB_GlyphAttributes *attributes = item->attributes; | - |
48 | | - |
49 | HB_GlyphMetrics baseMetrics; executed (the execution status of this line is deduced): HB_GlyphMetrics baseMetrics; | - |
50 | item->font->klass->getGlyphMetrics(item->font, glyphs[gfrom], &baseMetrics); executed (the execution status of this line is deduced): item->font->klass->getGlyphMetrics(item->font, glyphs[gfrom], &baseMetrics); | - |
51 | | - |
52 | 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 |
53 | && (-baseMetrics.y) > baseMetrics.height) never evaluated: (-baseMetrics.y) > baseMetrics.height | 0 |
54 | // we need to attach below the baseline, because of the hebrew iud. | - |
55 | baseMetrics.height = -baseMetrics.y; never executed: baseMetrics.height = -baseMetrics.y; | 0 |
56 | | - |
57 | // qDebug("---> positionCluster: cluster from %d to %d", gfrom, glast); | - |
58 | // qDebug("baseInfo: %f/%f (%f/%f) off=%f/%f", baseInfo.x, baseInfo.y, baseInfo.width, baseInfo.height, baseInfo.xoff, baseInfo.yoff); | - |
59 | | - |
60 | HB_Fixed size = item->font->klass->getFontMetric(item->font, HB_FontAscent) / 10; executed (the execution status of this line is deduced): HB_Fixed size = item->font->klass->getFontMetric(item->font, HB_FontAscent) / 10; | - |
61 | HB_Fixed offsetBase = HB_FIXED_CONSTANT(1) + (size - HB_FIXED_CONSTANT(4)) / 4; executed (the execution status of this line is deduced): HB_Fixed offsetBase = ((1) * 64) + (size - ((4) * 64)) / 4; | - |
62 | if (size > HB_FIXED_CONSTANT(4)) partially evaluated: size > ((4) * 64) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
63 | offsetBase += HB_FIXED_CONSTANT(4); never executed: offsetBase += ((4) * 64); | 0 |
64 | else | - |
65 | offsetBase += size; executed: offsetBase += size; Execution Count:1 | 1 |
66 | //qreal offsetBase = (size - 4) / 4 + qMin<qreal>(size, 4) + 1; | - |
67 | // qDebug("offset = %f", offsetBase); | - |
68 | | - |
69 | // To fix some Thai character heights check for two above glyphs | - |
70 | 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 |
71 | attributes[gfrom+1].combiningClass == HB_Combining_AboveLeft || never evaluated: attributes[gfrom+1].combiningClass == HB_Combining_AboveLeft | 0 |
72 | attributes[gfrom+1].combiningClass == HB_Combining_Above)) never evaluated: attributes[gfrom+1].combiningClass == HB_Combining_Above | 0 |
73 | if (attributes[gfrom+2].combiningClass == 23 || never evaluated: attributes[gfrom+2].combiningClass == 23 | 0 |
74 | attributes[gfrom+2].combiningClass == 24 || never evaluated: attributes[gfrom+2].combiningClass == 24 | 0 |
75 | attributes[gfrom+2].combiningClass == 25 || never evaluated: attributes[gfrom+2].combiningClass == 25 | 0 |
76 | attributes[gfrom+2].combiningClass == 27 || never evaluated: attributes[gfrom+2].combiningClass == 27 | 0 |
77 | attributes[gfrom+2].combiningClass == 28 || never evaluated: attributes[gfrom+2].combiningClass == 28 | 0 |
78 | attributes[gfrom+2].combiningClass == 30 || never evaluated: attributes[gfrom+2].combiningClass == 30 | 0 |
79 | attributes[gfrom+2].combiningClass == 31 || never evaluated: attributes[gfrom+2].combiningClass == 31 | 0 |
80 | attributes[gfrom+2].combiningClass == 33 || never evaluated: attributes[gfrom+2].combiningClass == 33 | 0 |
81 | attributes[gfrom+2].combiningClass == 34 || never evaluated: attributes[gfrom+2].combiningClass == 34 | 0 |
82 | attributes[gfrom+2].combiningClass == 35 || never evaluated: attributes[gfrom+2].combiningClass == 35 | 0 |
83 | attributes[gfrom+2].combiningClass == 36 || never evaluated: attributes[gfrom+2].combiningClass == 36 | 0 |
84 | attributes[gfrom+2].combiningClass == 107 || never evaluated: attributes[gfrom+2].combiningClass == 107 | 0 |
85 | attributes[gfrom+2].combiningClass == 122) { never evaluated: attributes[gfrom+2].combiningClass == 122 | 0 |
86 | // Two above glyphs, check total height | - |
87 | int markTotalHeight = baseMetrics.height; never executed (the execution status of this line is deduced): int markTotalHeight = baseMetrics.height; | - |
88 | HB_GlyphMetrics markMetrics; never executed (the execution status of this line is deduced): HB_GlyphMetrics markMetrics; | - |
89 | item->font->klass->getGlyphMetrics(item->font, glyphs[gfrom+1], &markMetrics); never executed (the execution status of this line is deduced): item->font->klass->getGlyphMetrics(item->font, glyphs[gfrom+1], &markMetrics); | - |
90 | markTotalHeight += markMetrics.height; never executed (the execution status of this line is deduced): markTotalHeight += markMetrics.height; | - |
91 | item->font->klass->getGlyphMetrics(item->font, glyphs[gfrom+2], &markMetrics); never executed (the execution status of this line is deduced): item->font->klass->getGlyphMetrics(item->font, glyphs[gfrom+2], &markMetrics); | - |
92 | markTotalHeight += markMetrics.height; never executed (the execution status of this line is deduced): markTotalHeight += markMetrics.height; | - |
93 | if ((markTotalHeight + 2 * offsetBase) > (size * 10)) never evaluated: (markTotalHeight + 2 * offsetBase) > (size * 10) | 0 |
94 | offsetBase = ((size * 10) - markTotalHeight) / 2; // Use offset that just fits never executed: offsetBase = ((size * 10) - markTotalHeight) / 2; | 0 |
95 | } | 0 |
96 | | - |
97 | bool rightToLeft = item->item.bidiLevel % 2; executed (the execution status of this line is deduced): bool rightToLeft = item->item.bidiLevel % 2; | - |
98 | | - |
99 | int i; executed (the execution status of this line is deduced): int i; | - |
100 | unsigned char lastCmb = 0; executed (the execution status of this line is deduced): unsigned char lastCmb = 0; | - |
101 | HB_GlyphMetrics attachmentRect; executed (the execution status of this line is deduced): HB_GlyphMetrics attachmentRect; | - |
102 | memset(&attachmentRect, 0, sizeof(attachmentRect)); executed (the execution status of this line is deduced): memset(&attachmentRect, 0, sizeof(attachmentRect)); | - |
103 | | - |
104 | for(i = 1; i <= nmarks; i++) { evaluated: i <= nmarks yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
105 | HB_Glyph mark = glyphs[gfrom+i]; executed (the execution status of this line is deduced): HB_Glyph mark = glyphs[gfrom+i]; | - |
106 | HB_GlyphMetrics markMetrics; executed (the execution status of this line is deduced): HB_GlyphMetrics markMetrics; | - |
107 | item->font->klass->getGlyphMetrics(item->font, mark, &markMetrics); executed (the execution status of this line is deduced): item->font->klass->getGlyphMetrics(item->font, mark, &markMetrics); | - |
108 | HB_FixedPoint p; executed (the execution status of this line is deduced): HB_FixedPoint p; | - |
109 | p.x = p.y = 0; executed (the execution status of this line is deduced): p.x = p.y = 0; | - |
110 | // qDebug("markInfo: %f/%f (%f/%f) off=%f/%f", markInfo.x, markInfo.y, markInfo.width, markInfo.height, markInfo.xoff, markInfo.yoff); | - |
111 | | - |
112 | HB_Fixed offset = offsetBase; executed (the execution status of this line is deduced): HB_Fixed offset = offsetBase; | - |
113 | unsigned char cmb = attributes[gfrom+i].combiningClass; executed (the execution status of this line is deduced): unsigned char cmb = attributes[gfrom+i].combiningClass; | - |
114 | | - |
115 | // ### maybe the whole position determination should move down to heuristicSetGlyphAttributes. Would save some | - |
116 | // bits in the glyphAttributes structure. | - |
117 | if (cmb < 200) { partially evaluated: cmb < 200 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
118 | // fixed position classes. We approximate by mapping to one of the others. | - |
119 | // currently I added only the ones for arabic, hebrew, lao and thai. | - |
120 | | - |
121 | // for Lao and Thai marks with class 0, see below (heuristicSetGlyphAttributes) | - |
122 | | - |
123 | // add a bit more offset to arabic, a bit hacky | - |
124 | if (cmb >= 27 && cmb <= 36 && offset < 3) never evaluated: cmb >= 27 never evaluated: cmb <= 36 never evaluated: offset < 3 | 0 |
125 | offset +=1; never executed: offset +=1; | 0 |
126 | // below | - |
127 | if ((cmb >= 10 && cmb <= 18) || never evaluated: cmb >= 10 never evaluated: cmb <= 18 | 0 |
128 | cmb == 20 || cmb == 22 || never evaluated: cmb == 20 never evaluated: cmb == 22 | 0 |
129 | cmb == 29 || cmb == 32) never evaluated: cmb == 29 never evaluated: cmb == 32 | 0 |
130 | cmb = HB_Combining_Below; never executed: cmb = HB_Combining_Below; | 0 |
131 | // above | - |
132 | else if (cmb == 23 || cmb == 27 || cmb == 28 || never evaluated: cmb == 23 never evaluated: cmb == 27 never evaluated: cmb == 28 | 0 |
133 | 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 |
134 | cmb = HB_Combining_Above; never executed: cmb = HB_Combining_Above; | 0 |
135 | //below-right | - |
136 | else if (cmb == 9 || cmb == 103 || cmb == 118) never evaluated: cmb == 9 never evaluated: cmb == 103 never evaluated: cmb == 118 | 0 |
137 | cmb = HB_Combining_BelowRight; never executed: cmb = HB_Combining_BelowRight; | 0 |
138 | // above-right | - |
139 | else if (cmb == 24 || cmb == 107 || cmb == 122) never evaluated: cmb == 24 never evaluated: cmb == 107 never evaluated: cmb == 122 | 0 |
140 | cmb = HB_Combining_AboveRight; never executed: cmb = HB_Combining_AboveRight; | 0 |
141 | else if (cmb == 25) never evaluated: cmb == 25 | 0 |
142 | cmb = HB_Combining_AboveLeft; never executed: cmb = HB_Combining_AboveLeft; | 0 |
143 | // fixed: | - |
144 | // 19 21 | - |
145 | | - |
146 | } | - |
147 | | - |
148 | // combining marks of different class don't interact. Reset the rectangle. | - |
149 | if (cmb != lastCmb) { partially evaluated: cmb != lastCmb yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
150 | //qDebug("resetting rect"); | - |
151 | attachmentRect = baseMetrics; executed (the execution status of this line is deduced): attachmentRect = baseMetrics; | - |
152 | } executed: } Execution Count:1 | 1 |
153 | | - |
154 | switch(cmb) { | - |
155 | case HB_Combining_DoubleBelow: | - |
156 | // ### wrong in rtl context! | - |
157 | case HB_Combining_BelowLeft: | - |
158 | p.y += offset; never executed (the execution status of this line is deduced): p.y += offset; | - |
159 | case HB_Combining_BelowLeftAttached: code before this statement never executed: case HB_Combining_BelowLeftAttached: | 0 |
160 | p.x += attachmentRect.x - markMetrics.x; never executed (the execution status of this line is deduced): p.x += attachmentRect.x - markMetrics.x; | - |
161 | p.y += (attachmentRect.y + attachmentRect.height) - markMetrics.y; never executed (the execution status of this line is deduced): p.y += (attachmentRect.y + attachmentRect.height) - markMetrics.y; | - |
162 | break; | 0 |
163 | case HB_Combining_Below: | - |
164 | p.y += offset; executed (the execution status of this line is deduced): p.y += offset; | - |
165 | case HB_Combining_BelowAttached: code before this statement executed: case HB_Combining_BelowAttached: Execution Count:1 | 1 |
166 | p.x += attachmentRect.x - markMetrics.x; executed (the execution status of this line is deduced): p.x += attachmentRect.x - markMetrics.x; | - |
167 | p.y += (attachmentRect.y + attachmentRect.height) - markMetrics.y; executed (the execution status of this line is deduced): p.y += (attachmentRect.y + attachmentRect.height) - markMetrics.y; | - |
168 | | - |
169 | p.x += (attachmentRect.width - markMetrics.width) / 2; executed (the execution status of this line is deduced): p.x += (attachmentRect.width - markMetrics.width) / 2; | - |
170 | break; executed: break; Execution Count:1 | 1 |
171 | case HB_Combining_BelowRight: | - |
172 | p.y += offset; never executed (the execution status of this line is deduced): p.y += offset; | - |
173 | case HB_Combining_BelowRightAttached: code before this statement never executed: case HB_Combining_BelowRightAttached: | 0 |
174 | p.x += attachmentRect.x + attachmentRect.width - markMetrics.width - markMetrics.x; never executed (the execution status of this line is deduced): p.x += attachmentRect.x + attachmentRect.width - markMetrics.width - markMetrics.x; | - |
175 | p.y += attachmentRect.y + attachmentRect.height - markMetrics.y; never executed (the execution status of this line is deduced): p.y += attachmentRect.y + attachmentRect.height - markMetrics.y; | - |
176 | break; | 0 |
177 | case HB_Combining_Left: | - |
178 | p.x -= offset; never executed (the execution status of this line is deduced): p.x -= offset; | - |
179 | case HB_Combining_LeftAttached: | - |
180 | break; | 0 |
181 | case HB_Combining_Right: | - |
182 | p.x += offset; never executed (the execution status of this line is deduced): p.x += offset; | - |
183 | case HB_Combining_RightAttached: | - |
184 | break; | 0 |
185 | case HB_Combining_DoubleAbove: | - |
186 | // ### wrong in RTL context! | - |
187 | case HB_Combining_AboveLeft: | - |
188 | p.y -= offset; never executed (the execution status of this line is deduced): p.y -= offset; | - |
189 | case HB_Combining_AboveLeftAttached: code before this statement never executed: case HB_Combining_AboveLeftAttached: | 0 |
190 | p.x += attachmentRect.x - markMetrics.x; never executed (the execution status of this line is deduced): p.x += attachmentRect.x - markMetrics.x; | - |
191 | p.y += attachmentRect.y - markMetrics.y - markMetrics.height; never executed (the execution status of this line is deduced): p.y += attachmentRect.y - markMetrics.y - markMetrics.height; | - |
192 | break; | 0 |
193 | case HB_Combining_Above: | - |
194 | p.y -= offset; never executed (the execution status of this line is deduced): p.y -= offset; | - |
195 | case HB_Combining_AboveAttached: code before this statement never executed: case HB_Combining_AboveAttached: | 0 |
196 | p.x += attachmentRect.x - markMetrics.x; never executed (the execution status of this line is deduced): p.x += attachmentRect.x - markMetrics.x; | - |
197 | p.y += attachmentRect.y - markMetrics.y - markMetrics.height; never executed (the execution status of this line is deduced): p.y += attachmentRect.y - markMetrics.y - markMetrics.height; | - |
198 | | - |
199 | p.x += (attachmentRect.width - markMetrics.width) / 2; never executed (the execution status of this line is deduced): p.x += (attachmentRect.width - markMetrics.width) / 2; | - |
200 | break; | 0 |
201 | case HB_Combining_AboveRight: | - |
202 | p.y -= offset; never executed (the execution status of this line is deduced): p.y -= offset; | - |
203 | case HB_Combining_AboveRightAttached: code before this statement never executed: case HB_Combining_AboveRightAttached: | 0 |
204 | p.x += attachmentRect.x + attachmentRect.width - markMetrics.x - markMetrics.width; never executed (the execution status of this line is deduced): p.x += attachmentRect.x + attachmentRect.width - markMetrics.x - markMetrics.width; | - |
205 | p.y += attachmentRect.y - markMetrics.y - markMetrics.height; never executed (the execution status of this line is deduced): p.y += attachmentRect.y - markMetrics.y - markMetrics.height; | - |
206 | break; | 0 |
207 | | - |
208 | case HB_Combining_IotaSubscript: | - |
209 | default: | - |
210 | break; | 0 |
211 | } | - |
212 | // qDebug("char=%x combiningClass = %d offset=%f/%f", mark, cmb, p.x(), p.y()); | - |
213 | markMetrics.x += p.x; executed (the execution status of this line is deduced): markMetrics.x += p.x; | - |
214 | markMetrics.y += p.y; executed (the execution status of this line is deduced): markMetrics.y += p.y; | - |
215 | | - |
216 | HB_GlyphMetrics unitedAttachmentRect = attachmentRect; executed (the execution status of this line is deduced): HB_GlyphMetrics unitedAttachmentRect = attachmentRect; | - |
217 | unitedAttachmentRect.x = HB_MIN(attachmentRect.x, markMetrics.x); partially evaluated: (attachmentRect.x) < (markMetrics.x) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
218 | unitedAttachmentRect.y = HB_MIN(attachmentRect.y, markMetrics.y); partially evaluated: (attachmentRect.y) < (markMetrics.y) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
219 | unitedAttachmentRect.width = HB_MAX(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 |
220 | unitedAttachmentRect.height = HB_MAX(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 |
221 | attachmentRect = unitedAttachmentRect; executed (the execution status of this line is deduced): attachmentRect = unitedAttachmentRect; | - |
222 | | - |
223 | lastCmb = cmb; executed (the execution status of this line is deduced): lastCmb = cmb; | - |
224 | if (rightToLeft) { partially evaluated: rightToLeft no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
225 | item->offsets[gfrom+i].x = p.x; never executed (the execution status of this line is deduced): item->offsets[gfrom+i].x = p.x; | - |
226 | item->offsets[gfrom+i].y = p.y; never executed (the execution status of this line is deduced): item->offsets[gfrom+i].y = p.y; | - |
227 | } else { | 0 |
228 | item->offsets[gfrom+i].x = p.x - baseMetrics.xOffset; executed (the execution status of this line is deduced): item->offsets[gfrom+i].x = p.x - baseMetrics.xOffset; | - |
229 | item->offsets[gfrom+i].y = p.y - baseMetrics.yOffset; executed (the execution status of this line is deduced): item->offsets[gfrom+i].y = p.y - baseMetrics.yOffset; | - |
230 | } executed: } Execution Count:1 | 1 |
231 | item->advances[gfrom+i] = 0; executed (the execution status of this line is deduced): item->advances[gfrom+i] = 0; | - |
232 | } executed: } Execution Count:1 | 1 |
233 | } executed: } Execution Count:1 | 1 |
234 | | - |
235 | void HB_HeuristicPosition(HB_ShaperItem *item) | - |
236 | { | - |
237 | HB_GetGlyphAdvances(item); executed (the execution status of this line is deduced): item->font->klass->getGlyphAdvances(item->font, item->glyphs, item->num_glyphs, item->advances, item->face->current_flags);; | - |
238 | HB_GlyphAttributes *attributes = item->attributes; executed (the execution status of this line is deduced): HB_GlyphAttributes *attributes = item->attributes; | - |
239 | | - |
240 | int cEnd = -1; executed (the execution status of this line is deduced): int cEnd = -1; | - |
241 | int i = item->num_glyphs; executed (the execution status of this line is deduced): int i = item->num_glyphs; | - |
242 | while (i--) { evaluated: i-- yes Evaluation Count:609417 | yes Evaluation Count:163020 |
| 163020-609417 |
243 | 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 |
244 | cEnd = i; executed (the execution status of this line is deduced): cEnd = i; | - |
245 | } 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 |
246 | positionCluster(item, i, cEnd); executed (the execution status of this line is deduced): positionCluster(item, i, cEnd); | - |
247 | cEnd = -1; executed (the execution status of this line is deduced): cEnd = -1; | - |
248 | } executed: } Execution Count:1 | 1 |
249 | } | - |
250 | } executed: } Execution Count:163020 | 163020 |
251 | | - |
252 | // set the glyph attributes heuristically. Assumes a 1 to 1 relationship between chars and glyphs | - |
253 | // and no reordering. | - |
254 | // also computes logClusters heuristically | - |
255 | void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item) | - |
256 | { | - |
257 | const HB_UChar16 *uc = item->string + item->item.pos; executed (the execution status of this line is deduced): const HB_UChar16 *uc = item->string + item->item.pos; | - |
258 | hb_uint32 length = item->item.length; executed (the execution status of this line is deduced): hb_uint32 length = item->item.length; | - |
259 | | - |
260 | // ### zeroWidth and justification are missing here!!!!! | - |
261 | | - |
262 | assert(item->num_glyphs <= length); executed (the execution status of this line is deduced): ((item->num_glyphs <= length) ? static_cast<void> (0) : __assert_fail ("item->num_glyphs <= length", "../3rdparty/harfbuzz/src/harfbuzz-shaper.cpp", 262, __PRETTY_FUNCTION__)); | - |
263 | | - |
264 | // qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item->num_glyphs); | - |
265 | HB_GlyphAttributes *attributes = item->attributes; executed (the execution status of this line is deduced): HB_GlyphAttributes *attributes = item->attributes; | - |
266 | unsigned short *logClusters = item->log_clusters; executed (the execution status of this line is deduced): unsigned short *logClusters = item->log_clusters; | - |
267 | | - |
268 | hb_uint32 glyph_pos = 0; executed (the execution status of this line is deduced): hb_uint32 glyph_pos = 0; | - |
269 | hb_uint32 i; executed (the execution status of this line is deduced): hb_uint32 i; | - |
270 | for (i = 0; i < length; i++) { evaluated: i < length yes Evaluation Count:2916917 | yes Evaluation Count:248280 |
| 248280-2916917 |
271 | if (HB_IsHighSurrogate(uc[i]) && i < length - 1 partially evaluated: (((uc[i]) & 0xfc00) == 0xd800) no Evaluation Count:0 | yes Evaluation Count:2916917 |
never evaluated: i < length - 1 | 0-2916917 |
272 | && HB_IsLowSurrogate(uc[i + 1])) { never evaluated: (((uc[i + 1]) & 0xfc00) == 0xdc00) | 0 |
273 | logClusters[i] = glyph_pos; never executed (the execution status of this line is deduced): logClusters[i] = glyph_pos; | - |
274 | logClusters[++i] = glyph_pos; never executed (the execution status of this line is deduced): logClusters[++i] = glyph_pos; | - |
275 | } else { | 0 |
276 | logClusters[i] = glyph_pos; executed (the execution status of this line is deduced): logClusters[i] = glyph_pos; | - |
277 | } executed: } Execution Count:2916917 | 2916917 |
278 | ++glyph_pos; executed (the execution status of this line is deduced): ++glyph_pos; | - |
279 | } executed: } Execution Count:2916917 | 2916917 |
280 | assert(glyph_pos == item->num_glyphs); executed (the execution status of this line is deduced): ((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__)); | - |
281 | | - |
282 | // first char in a run is never (treated as) a mark | - |
283 | int cStart = 0; executed (the execution status of this line is deduced): int cStart = 0; | - |
284 | const bool symbolFont = item->face->isSymbolFont; executed (the execution status of this line is deduced): const bool symbolFont = item->face->isSymbolFont; | - |
285 | attributes[0].mark = false; executed (the execution status of this line is deduced): attributes[0].mark = false; | - |
286 | attributes[0].clusterStart = true; executed (the execution status of this line is deduced): attributes[0].clusterStart = true; | - |
287 | attributes[0].dontPrint = (!symbolFont && uc[0] == 0x00ad) || HB_IsControlChar(uc[0]); 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 |
288 | | - |
289 | int pos = 0; executed (the execution status of this line is deduced): int pos = 0; | - |
290 | HB_CharCategory lastCat; executed (the execution status of this line is deduced): HB_CharCategory lastCat; | - |
291 | int dummy; executed (the execution status of this line is deduced): int dummy; | - |
292 | HB_GetUnicodeCharProperties(uc[0], &lastCat, &dummy); executed (the execution status of this line is deduced): HB_GetUnicodeCharProperties(uc[0], &lastCat, &dummy); | - |
293 | for (i = 1; i < length; ++i) { evaluated: i < length yes Evaluation Count:2668637 | yes Evaluation Count:248280 |
| 248280-2668637 |
294 | if (logClusters[i] == pos) partially evaluated: logClusters[i] == pos no Evaluation Count:0 | yes Evaluation Count:2668637 |
| 0-2668637 |
295 | // same glyph | - |
296 | continue; never executed: continue; | 0 |
297 | ++pos; executed (the execution status of this line is deduced): ++pos; | - |
298 | while (pos < logClusters[i]) { partially evaluated: pos < logClusters[i] no Evaluation Count:0 | yes Evaluation Count:2668637 |
| 0-2668637 |
299 | attributes[pos] = attributes[pos-1]; never executed (the execution status of this line is deduced): attributes[pos] = attributes[pos-1]; | - |
300 | ++pos; never executed (the execution status of this line is deduced): ++pos; | - |
301 | } | 0 |
302 | // hide soft-hyphens by default | - |
303 | if ((!symbolFont && uc[i] == 0x00ad) || HB_IsControlChar(uc[i])) 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 |
304 | attributes[pos].dontPrint = true; executed: attributes[pos].dontPrint = true; Execution Count:18 | 18 |
305 | HB_CharCategory cat; executed (the execution status of this line is deduced): HB_CharCategory cat; | - |
306 | int cmb; executed (the execution status of this line is deduced): int cmb; | - |
307 | HB_GetUnicodeCharProperties(uc[i], &cat, &cmb); executed (the execution status of this line is deduced): HB_GetUnicodeCharProperties(uc[i], &cat, &cmb); | - |
308 | if (cat != HB_Mark_NonSpacing) { evaluated: cat != HB_Mark_NonSpacing yes Evaluation Count:2668636 | yes Evaluation Count:1 |
| 1-2668636 |
309 | attributes[pos].mark = false; executed (the execution status of this line is deduced): attributes[pos].mark = false; | - |
310 | attributes[pos].clusterStart = true; executed (the execution status of this line is deduced): attributes[pos].clusterStart = true; | - |
311 | attributes[pos].combiningClass = 0; executed (the execution status of this line is deduced): attributes[pos].combiningClass = 0; | - |
312 | cStart = logClusters[i]; executed (the execution status of this line is deduced): cStart = logClusters[i]; | - |
313 | } else { executed: } Execution Count:2668636 | 2668636 |
314 | if (cmb == 0) { partially evaluated: cmb == 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
315 | // Fix 0 combining classes | - |
316 | if ((uc[pos] & 0xff00) == 0x0e00) { never evaluated: (uc[pos] & 0xff00) == 0x0e00 | 0 |
317 | // thai or lao | - |
318 | if (uc[pos] == 0xe31 || never evaluated: uc[pos] == 0xe31 | 0 |
319 | uc[pos] == 0xe34 || never evaluated: uc[pos] == 0xe34 | 0 |
320 | uc[pos] == 0xe35 || never evaluated: uc[pos] == 0xe35 | 0 |
321 | uc[pos] == 0xe36 || never evaluated: uc[pos] == 0xe36 | 0 |
322 | uc[pos] == 0xe37 || never evaluated: uc[pos] == 0xe37 | 0 |
323 | uc[pos] == 0xe47 || never evaluated: uc[pos] == 0xe47 | 0 |
324 | uc[pos] == 0xe4c || never evaluated: uc[pos] == 0xe4c | 0 |
325 | uc[pos] == 0xe4d || never evaluated: uc[pos] == 0xe4d | 0 |
326 | uc[pos] == 0xe4e) { never evaluated: uc[pos] == 0xe4e | 0 |
327 | cmb = HB_Combining_AboveRight; never executed (the execution status of this line is deduced): cmb = HB_Combining_AboveRight; | - |
328 | } else if (uc[pos] == 0xeb1 || never executed: } never evaluated: uc[pos] == 0xeb1 | 0 |
329 | uc[pos] == 0xeb4 || never evaluated: uc[pos] == 0xeb4 | 0 |
330 | uc[pos] == 0xeb5 || never evaluated: uc[pos] == 0xeb5 | 0 |
331 | uc[pos] == 0xeb6 || never evaluated: uc[pos] == 0xeb6 | 0 |
332 | uc[pos] == 0xeb7 || never evaluated: uc[pos] == 0xeb7 | 0 |
333 | uc[pos] == 0xebb || never evaluated: uc[pos] == 0xebb | 0 |
334 | uc[pos] == 0xecc || never evaluated: uc[pos] == 0xecc | 0 |
335 | uc[pos] == 0xecd) { never evaluated: uc[pos] == 0xecd | 0 |
336 | cmb = HB_Combining_Above; never executed (the execution status of this line is deduced): cmb = HB_Combining_Above; | - |
337 | } else if (uc[pos] == 0xebc) { never executed: } never evaluated: uc[pos] == 0xebc | 0 |
338 | cmb = HB_Combining_Below; never executed (the execution status of this line is deduced): cmb = HB_Combining_Below; | - |
339 | } | 0 |
340 | } | - |
341 | } | 0 |
342 | | - |
343 | attributes[pos].mark = true; executed (the execution status of this line is deduced): attributes[pos].mark = true; | - |
344 | attributes[pos].clusterStart = false; executed (the execution status of this line is deduced): attributes[pos].clusterStart = false; | - |
345 | attributes[pos].combiningClass = cmb; executed (the execution status of this line is deduced): attributes[pos].combiningClass = cmb; | - |
346 | logClusters[i] = cStart; executed (the execution status of this line is deduced): logClusters[i] = cStart; | - |
347 | } executed: } Execution Count:1 | 1 |
348 | // one gets an inter character justification point if the current char is not a non spacing mark. | - |
349 | // as then the current char belongs to the last one and one gets a space justification point | - |
350 | // after the space char. | - |
351 | if (lastCat == HB_Separator_Space) evaluated: lastCat == HB_Separator_Space yes Evaluation Count:309775 | yes Evaluation Count:2358862 |
| 309775-2358862 |
352 | attributes[pos-1].justification = HB_Space; executed: attributes[pos-1].justification = HB_Space; Execution Count:309775 | 309775 |
353 | else if (cat != HB_Mark_NonSpacing) evaluated: cat != HB_Mark_NonSpacing yes Evaluation Count:2358861 | yes Evaluation Count:1 |
| 1-2358861 |
354 | attributes[pos-1].justification = HB_Character; executed: attributes[pos-1].justification = HB_Character; Execution Count:2358861 | 2358861 |
355 | else | - |
356 | attributes[pos-1].justification = HB_NoJustification; executed: attributes[pos-1].justification = HB_NoJustification; Execution Count:1 | 1 |
357 | | - |
358 | lastCat = cat; executed (the execution status of this line is deduced): lastCat = cat; | - |
359 | } executed: } Execution Count:2668637 | 2668637 |
360 | pos = logClusters[length-1]; executed (the execution status of this line is deduced): pos = logClusters[length-1]; | - |
361 | if (lastCat == HB_Separator_Space) evaluated: lastCat == HB_Separator_Space yes Evaluation Count:1597 | yes Evaluation Count:246683 |
| 1597-246683 |
362 | attributes[pos].justification = HB_Space; executed: attributes[pos].justification = HB_Space; Execution Count:1597 | 1597 |
363 | else | - |
364 | attributes[pos].justification = HB_Character; executed: attributes[pos].justification = HB_Character; Execution Count:246683 | 246683 |
365 | } | - |
366 | | - |
367 | #ifndef NO_OPENTYPE | - |
368 | static const HB_OpenTypeFeature basic_features[] = { | - |
369 | { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, | - |
370 | { HB_MAKE_TAG('l', 'i', 'g', 'a'), LigaProperty }, | - |
371 | { HB_MAKE_TAG('c', 'l', 'i', 'g'), CligProperty }, | - |
372 | {0, 0} | - |
373 | }; | - |
374 | | - |
375 | static const HB_OpenTypeFeature disabled_features[] = { | - |
376 | { HB_MAKE_TAG('c', 'p', 'c', 't'), PositioningProperties }, | - |
377 | { HB_MAKE_TAG('h', 'a', 'l', 't'), PositioningProperties }, | - |
378 | // TODO: we need to add certain HB_ShaperFlag for vertical | - |
379 | // writing mode to enable these vertical writing features: | - |
380 | { HB_MAKE_TAG('v', 'a', 'l', 't'), PositioningProperties }, | - |
381 | { HB_MAKE_TAG('v', 'h', 'a', 'l'), PositioningProperties }, | - |
382 | { HB_MAKE_TAG('v', 'k', 'r', 'n'), PositioningProperties }, | - |
383 | { HB_MAKE_TAG('v', 'p', 'a', 'l'), PositioningProperties }, | - |
384 | {0, 0} | - |
385 | }; | - |
386 | #endif | - |
387 | | - |
388 | HB_Bool HB_ConvertStringToGlyphIndices(HB_ShaperItem *shaper_item) | - |
389 | { | - |
390 | if (shaper_item->glyphIndicesPresent) { partially evaluated: shaper_item->glyphIndicesPresent yes Evaluation Count:248280 | no Evaluation Count:0 |
| 0-248280 |
391 | shaper_item->num_glyphs = shaper_item->initialGlyphCount; executed (the execution status of this line is deduced): shaper_item->num_glyphs = shaper_item->initialGlyphCount; | - |
392 | shaper_item->glyphIndicesPresent = false; executed (the execution status of this line is deduced): shaper_item->glyphIndicesPresent = false; | - |
393 | return true; executed: return true; Execution Count:248280 | 248280 |
394 | } | - |
395 | return shaper_item->font->klass 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 |
396 | ->convertStringToGlyphIndices(shaper_item->font, 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 |
397 | shaper_item->string + shaper_item->item.pos, shaper_item->item.length, 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 |
398 | shaper_item->glyphs, &shaper_item->num_glyphs, 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 |
399 | 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 |
400 | } | - |
401 | | - |
402 | HB_Bool HB_BasicShape(HB_ShaperItem *shaper_item) | - |
403 | { | - |
404 | #ifndef NO_OPENTYPE | - |
405 | const int availableGlyphs = shaper_item->num_glyphs; executed (the execution status of this line is deduced): const int availableGlyphs = shaper_item->num_glyphs; | - |
406 | #endif | - |
407 | | - |
408 | if (!HB_ConvertStringToGlyphIndices(shaper_item)) partially evaluated: !HB_ConvertStringToGlyphIndices(shaper_item) no Evaluation Count:0 | yes Evaluation Count:248109 |
| 0-248109 |
409 | return false; never executed: return false; | 0 |
410 | | - |
411 | HB_HeuristicSetGlyphAttributes(shaper_item); executed (the execution status of this line is deduced): HB_HeuristicSetGlyphAttributes(shaper_item); | - |
412 | | - |
413 | #ifndef NO_OPENTYPE | - |
414 | if (HB_SelectScript(shaper_item, basic_features)) { evaluated: HB_SelectScript(shaper_item, basic_features) yes Evaluation Count:247835 | yes Evaluation Count:274 |
| 274-247835 |
415 | HB_OpenTypeShape(shaper_item, /*properties*/0); executed (the execution status of this line is deduced): HB_OpenTypeShape(shaper_item, 0); | - |
416 | return HB_OpenTypePosition(shaper_item, availableGlyphs, /*doLogClusters*/true); executed: return HB_OpenTypePosition(shaper_item, availableGlyphs, true); Execution Count:247835 | 247835 |
417 | } | - |
418 | #endif | - |
419 | | - |
420 | HB_HeuristicPosition(shaper_item); executed (the execution status of this line is deduced): HB_HeuristicPosition(shaper_item); | - |
421 | return true; executed: return true; Execution Count:274 | 274 |
422 | } | - |
423 | | - |
424 | const HB_ScriptEngine HB_ScriptEngines[] = { | - |
425 | // Common | - |
426 | { HB_BasicShape, 0}, | - |
427 | // Greek | - |
428 | { HB_GreekShape, 0}, | - |
429 | // Cyrillic | - |
430 | { HB_BasicShape, 0}, | - |
431 | // Armenian | - |
432 | { HB_BasicShape, 0}, | - |
433 | // Hebrew | - |
434 | { HB_HebrewShape, 0 }, | - |
435 | // Arabic | - |
436 | { HB_ArabicShape, 0}, | - |
437 | // Syriac | - |
438 | { HB_ArabicShape, 0}, | - |
439 | // Thaana | - |
440 | { HB_BasicShape, 0 }, | - |
441 | // Devanagari | - |
442 | { HB_IndicShape, HB_IndicAttributes }, | - |
443 | // Bengali | - |
444 | { HB_IndicShape, HB_IndicAttributes }, | - |
445 | // Gurmukhi | - |
446 | { HB_IndicShape, HB_IndicAttributes }, | - |
447 | // Gujarati | - |
448 | { HB_IndicShape, HB_IndicAttributes }, | - |
449 | // Oriya | - |
450 | { HB_IndicShape, HB_IndicAttributes }, | - |
451 | // Tamil | - |
452 | { HB_IndicShape, HB_IndicAttributes }, | - |
453 | // Telugu | - |
454 | { HB_IndicShape, HB_IndicAttributes }, | - |
455 | // Kannada | - |
456 | { HB_IndicShape, HB_IndicAttributes }, | - |
457 | // Malayalam | - |
458 | { HB_IndicShape, HB_IndicAttributes }, | - |
459 | // Sinhala | - |
460 | { HB_IndicShape, HB_IndicAttributes }, | - |
461 | // Thai | - |
462 | { HB_ThaiShape, HB_ThaiAttributes }, | - |
463 | // Lao | - |
464 | { HB_BasicShape, 0 }, | - |
465 | // Tibetan | - |
466 | { HB_TibetanShape, HB_TibetanAttributes }, | - |
467 | // Myanmar | - |
468 | { HB_MyanmarShape, HB_MyanmarAttributes }, | - |
469 | // Georgian | - |
470 | { HB_BasicShape, 0 }, | - |
471 | // Hangul | - |
472 | { HB_HangulShape, 0 }, | - |
473 | // Ogham | - |
474 | { HB_BasicShape, 0 }, | - |
475 | // Runic | - |
476 | { HB_BasicShape, 0 }, | - |
477 | // Khmer | - |
478 | { HB_KhmerShape, HB_KhmerAttributes }, | - |
479 | // N'Ko | - |
480 | { HB_ArabicShape, 0} | - |
481 | }; | - |
482 | | - |
483 | void HB_GetTailoredCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, | - |
484 | const HB_ScriptItem *items, hb_uint32 numItems, | - |
485 | HB_CharAttributes *attributes) | - |
486 | { | - |
487 | if (stringLength == 0) partially evaluated: stringLength == 0 no Evaluation Count:0 | yes Evaluation Count:197626 |
| 0-197626 |
488 | return; | 0 |
489 | for (hb_uint32 i = 0; i < numItems; ++i) { evaluated: i < numItems yes Evaluation Count:176633 | yes Evaluation Count:197626 |
| 176633-197626 |
490 | HB_Script script = items[i].script; executed (the execution status of this line is deduced): HB_Script script = items[i].script; | - |
491 | if (script == HB_Script_Inherited) partially evaluated: script == HB_Script_Inherited no Evaluation Count:0 | yes Evaluation Count:176633 |
| 0-176633 |
492 | script = HB_Script_Common; never executed: script = HB_Script_Common; | 0 |
493 | HB_AttributeFunction attributeFunction = HB_ScriptEngines[script].charAttributes; executed (the execution status of this line is deduced): HB_AttributeFunction attributeFunction = HB_ScriptEngines[script].charAttributes; | - |
494 | if (!attributeFunction) evaluated: !attributeFunction yes Evaluation Count:176614 | yes Evaluation Count:19 |
| 19-176614 |
495 | continue; executed: continue; Execution Count:176614 | 176614 |
496 | attributeFunction(script, string, items[i].pos, items[i].length, attributes); executed (the execution status of this line is deduced): attributeFunction(script, string, items[i].pos, items[i].length, attributes); | - |
497 | } executed: } Execution Count:19 | 19 |
498 | } executed: } Execution Count:197626 | 197626 |
499 | | - |
500 | | - |
501 | static inline char *tag_to_string(HB_UInt tag) | - |
502 | { | - |
503 | static char string[5]; | - |
504 | string[0] = (tag >> 24)&0xff; never executed (the execution status of this line is deduced): string[0] = (tag >> 24)&0xff; | - |
505 | string[1] = (tag >> 16)&0xff; never executed (the execution status of this line is deduced): string[1] = (tag >> 16)&0xff; | - |
506 | string[2] = (tag >> 8)&0xff; never executed (the execution status of this line is deduced): string[2] = (tag >> 8)&0xff; | - |
507 | string[3] = tag&0xff; never executed (the execution status of this line is deduced): string[3] = tag&0xff; | - |
508 | string[4] = 0; never executed (the execution status of this line is deduced): string[4] = 0; | - |
509 | return string; never executed: return string; | 0 |
510 | } | - |
511 | | - |
512 | #ifdef OT_DEBUG | - |
513 | static void dump_string(HB_Buffer buffer) | - |
514 | { | - |
515 | for (uint i = 0; i < buffer->in_length; ++i) { | - |
516 | qDebug(" %x: cluster=%d", buffer->in_string[i].gindex, buffer->in_string[i].cluster); | - |
517 | } | - |
518 | } | - |
519 | #define DEBUG printf | - |
520 | #else | - |
521 | #define DEBUG if (1) ; else printf | - |
522 | #endif | - |
523 | | - |
524 | #define DefaultLangSys 0xffff | - |
525 | #define DefaultScript HB_MAKE_TAG('D', 'F', 'L', 'T') | - |
526 | | - |
527 | enum { | - |
528 | RequiresGsub = 1, | - |
529 | RequiresGpos = 2 | - |
530 | }; | - |
531 | | - |
532 | struct OTScripts { | - |
533 | unsigned int tag; | - |
534 | int flags; | - |
535 | }; | - |
536 | static const OTScripts ot_scripts [] = { | - |
537 | // Common | - |
538 | { HB_MAKE_TAG('l', 'a', 't', 'n'), 0 }, | - |
539 | // Greek | - |
540 | { HB_MAKE_TAG('g', 'r', 'e', 'k'), 0 }, | - |
541 | // Cyrillic | - |
542 | { HB_MAKE_TAG('c', 'y', 'r', 'l'), 0 }, | - |
543 | // Armenian | - |
544 | { HB_MAKE_TAG('a', 'r', 'm', 'n'), 0 }, | - |
545 | // Hebrew | - |
546 | { HB_MAKE_TAG('h', 'e', 'b', 'r'), 1 }, | - |
547 | // Arabic | - |
548 | { HB_MAKE_TAG('a', 'r', 'a', 'b'), 1 }, | - |
549 | // Syriac | - |
550 | { HB_MAKE_TAG('s', 'y', 'r', 'c'), 1 }, | - |
551 | // Thaana | - |
552 | { HB_MAKE_TAG('t', 'h', 'a', 'a'), 1 }, | - |
553 | // Devanagari | - |
554 | { HB_MAKE_TAG('d', 'e', 'v', 'a'), 1 }, | - |
555 | // Bengali | - |
556 | { HB_MAKE_TAG('b', 'e', 'n', 'g'), 1 }, | - |
557 | // Gurmukhi | - |
558 | { HB_MAKE_TAG('g', 'u', 'r', 'u'), 1 }, | - |
559 | // Gujarati | - |
560 | { HB_MAKE_TAG('g', 'u', 'j', 'r'), 1 }, | - |
561 | // Oriya | - |
562 | { HB_MAKE_TAG('o', 'r', 'y', 'a'), 1 }, | - |
563 | // Tamil | - |
564 | { HB_MAKE_TAG('t', 'a', 'm', 'l'), 1 }, | - |
565 | // Telugu | - |
566 | { HB_MAKE_TAG('t', 'e', 'l', 'u'), 1 }, | - |
567 | // Kannada | - |
568 | { HB_MAKE_TAG('k', 'n', 'd', 'a'), 1 }, | - |
569 | // Malayalam | - |
570 | { HB_MAKE_TAG('m', 'l', 'y', 'm'), 1 }, | - |
571 | // Sinhala | - |
572 | { HB_MAKE_TAG('s', 'i', 'n', 'h'), 1 }, | - |
573 | // Thai | - |
574 | { HB_MAKE_TAG('t', 'h', 'a', 'i'), 1 }, | - |
575 | // Lao | - |
576 | { HB_MAKE_TAG('l', 'a', 'o', ' '), 1 }, | - |
577 | // Tibetan | - |
578 | { HB_MAKE_TAG('t', 'i', 'b', 't'), 1 }, | - |
579 | // Myanmar | - |
580 | { HB_MAKE_TAG('m', 'y', 'm', 'r'), 1 }, | - |
581 | // Georgian | - |
582 | { HB_MAKE_TAG('g', 'e', 'o', 'r'), 0 }, | - |
583 | // Hangul | - |
584 | { HB_MAKE_TAG('h', 'a', 'n', 'g'), 1 }, | - |
585 | // Ogham | - |
586 | { HB_MAKE_TAG('o', 'g', 'a', 'm'), 0 }, | - |
587 | // Runic | - |
588 | { HB_MAKE_TAG('r', 'u', 'n', 'r'), 0 }, | - |
589 | // Khmer | - |
590 | { HB_MAKE_TAG('k', 'h', 'm', 'r'), 1 }, | - |
591 | // N'Ko | - |
592 | { HB_MAKE_TAG('n', 'k', 'o', ' '), 1 } | - |
593 | }; | - |
594 | enum { NumOTScripts = sizeof(ot_scripts)/sizeof(OTScripts) }; | - |
595 | | - |
596 | static HB_Bool checkScript(HB_Face face, int script) | - |
597 | { | - |
598 | assert(script < HB_ScriptCount); executed (the execution status of this line is deduced): ((script < HB_ScriptCount) ? static_cast<void> (0) : __assert_fail ("script < HB_ScriptCount", "../3rdparty/harfbuzz/src/harfbuzz-shaper.cpp", 598, __PRETTY_FUNCTION__)); | - |
599 | | - |
600 | 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 |
601 | return false; executed: return false; Execution Count:2212 | 2212 |
602 | | - |
603 | unsigned int tag = ot_scripts[script].tag; executed (the execution status of this line is deduced): unsigned int tag = ot_scripts[script].tag; | - |
604 | int requirements = ot_scripts[script].flags; executed (the execution status of this line is deduced): int requirements = ot_scripts[script].flags; | - |
605 | | - |
606 | if (requirements & RequiresGsub) { evaluated: requirements & RequiresGsub yes Evaluation Count:2919 | yes Evaluation Count:973 |
| 973-2919 |
607 | if (!face->gsub) partially evaluated: !face->gsub no Evaluation Count:0 | yes Evaluation Count:2919 |
| 0-2919 |
608 | return false; never executed: return false; | 0 |
609 | | - |
610 | HB_UShort script_index; executed (the execution status of this line is deduced): HB_UShort script_index; | - |
611 | HB_Error error = HB_GSUB_Select_Script(face->gsub, tag, &script_index); executed (the execution status of this line is deduced): HB_Error error = HB_GSUB_Select_Script(face->gsub, tag, &script_index); | - |
612 | if (error) { evaluated: error yes Evaluation Count:2279 | yes Evaluation Count:640 |
| 640-2279 |
613 | DEBUG("could not select script %d in GSub table: %d", (int)script, error); executed: ; Execution Count:2279 never executed: printf("could not select script %d in GSub table: %d", (int)script, error); partially evaluated: 1 yes Evaluation Count:2279 | no Evaluation Count:0 |
| 0-2279 |
614 | error = HB_GSUB_Select_Script(face->gsub, HB_MAKE_TAG('D', 'F', 'L', 'T'), &script_index); executed (the execution status of this line is deduced): error = HB_GSUB_Select_Script(face->gsub, ( ( (HB_UInt)'D' << 24 ) | ( (HB_UInt)'F' << 16 ) | ( (HB_UInt)'L' << 8 ) | (HB_UInt)'T' ), &script_index); | - |
615 | if (error) evaluated: error yes Evaluation Count:224 | yes Evaluation Count:2055 |
| 224-2055 |
616 | return false; executed: return false; Execution Count:224 | 224 |
617 | } executed: } Execution Count:2055 | 2055 |
618 | } executed: } Execution Count:2695 | 2695 |
619 | | - |
620 | if (requirements & RequiresGpos) { partially evaluated: requirements & RequiresGpos no Evaluation Count:0 | yes Evaluation Count:3668 |
| 0-3668 |
621 | if (!face->gpos) never evaluated: !face->gpos | 0 |
622 | return false; never executed: return false; | 0 |
623 | | - |
624 | HB_UShort script_index; never executed (the execution status of this line is deduced): HB_UShort script_index; | - |
625 | HB_Error error = HB_GPOS_Select_Script(face->gpos, script, &script_index); never executed (the execution status of this line is deduced): HB_Error error = HB_GPOS_Select_Script(face->gpos, script, &script_index); | - |
626 | if (error) { | 0 |
627 | DEBUG("could not select script in gpos table: %d", error); never executed: ; never executed: printf("could not select script in gpos table: %d", error); never evaluated: 1 | 0 |
628 | error = HB_GPOS_Select_Script(face->gpos, HB_MAKE_TAG('D', 'F', 'L', 'T'), &script_index); never executed (the execution status of this line is deduced): error = HB_GPOS_Select_Script(face->gpos, ( ( (HB_UInt)'D' << 24 ) | ( (HB_UInt)'F' << 16 ) | ( (HB_UInt)'L' << 8 ) | (HB_UInt)'T' ), &script_index); | - |
629 | if (error) | 0 |
630 | return false; never executed: return false; | 0 |
631 | } | 0 |
632 | | - |
633 | } | 0 |
634 | return true; executed: return true; Execution Count:3668 | 3668 |
635 | } | - |
636 | | - |
637 | static HB_Stream getTableStream(void *font, HB_GetFontTableFunc tableFunc, HB_Tag tag) | - |
638 | { | - |
639 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
640 | HB_UInt length = 0; executed (the execution status of this line is deduced): HB_UInt length = 0; | - |
641 | HB_Stream stream = 0; executed (the execution status of this line is deduced): HB_Stream stream = 0; | - |
642 | | - |
643 | if (!font) partially evaluated: !font no Evaluation Count:0 | yes Evaluation Count:654 |
| 0-654 |
644 | return 0; never executed: return 0; | 0 |
645 | | - |
646 | error = tableFunc(font, tag, 0, &length); executed (the execution status of this line is deduced): error = tableFunc(font, tag, 0, &length); | - |
647 | if (error) evaluated: error yes Evaluation Count:240 | yes Evaluation Count:414 |
| 240-414 |
648 | return 0; executed: return 0; Execution Count:240 | 240 |
649 | stream = (HB_Stream)malloc(sizeof(HB_StreamRec)); executed (the execution status of this line is deduced): stream = (HB_Stream)malloc(sizeof(HB_StreamRec)); | - |
650 | if (!stream) partially evaluated: !stream no Evaluation Count:0 | yes Evaluation Count:414 |
| 0-414 |
651 | return 0; never executed: return 0; | 0 |
652 | stream->base = (HB_Byte*)malloc(length); executed (the execution status of this line is deduced): stream->base = (HB_Byte*)malloc(length); | - |
653 | if (!stream->base) { partially evaluated: !stream->base no Evaluation Count:0 | yes Evaluation Count:414 |
| 0-414 |
654 | free(stream); never executed (the execution status of this line is deduced): free(stream); | - |
655 | return 0; never executed: return 0; | 0 |
656 | } | - |
657 | error = tableFunc(font, tag, stream->base, &length); executed (the execution status of this line is deduced): error = tableFunc(font, tag, stream->base, &length); | - |
658 | if (error) { partially evaluated: error no Evaluation Count:0 | yes Evaluation Count:414 |
| 0-414 |
659 | _hb_close_stream(stream); never executed (the execution status of this line is deduced): _hb_close_stream(stream); | - |
660 | return 0; never executed: return 0; | 0 |
661 | } | - |
662 | stream->size = length; executed (the execution status of this line is deduced): stream->size = length; | - |
663 | stream->pos = 0; executed (the execution status of this line is deduced): stream->pos = 0; | - |
664 | stream->cursor = NULL; executed (the execution status of this line is deduced): stream->cursor = __null; | - |
665 | return stream; executed: return stream; Execution Count:414 | 414 |
666 | } | - |
667 | | - |
668 | HB_Face HB_AllocFace(void *font, HB_GetFontTableFunc tableFunc) | - |
669 | { | - |
670 | HB_Face face = (HB_Face )malloc(sizeof(HB_FaceRec)); executed (the execution status of this line is deduced): HB_Face face = (HB_Face )malloc(sizeof(HB_FaceRec)); | - |
671 | if (!face) partially evaluated: !face no Evaluation Count:0 | yes Evaluation Count:1887 |
| 0-1887 |
672 | return 0; never executed: return 0; | 0 |
673 | | - |
674 | face->isSymbolFont = false; executed (the execution status of this line is deduced): face->isSymbolFont = false; | - |
675 | face->gdef = 0; executed (the execution status of this line is deduced): face->gdef = 0; | - |
676 | face->gpos = 0; executed (the execution status of this line is deduced): face->gpos = 0; | - |
677 | face->gsub = 0; executed (the execution status of this line is deduced): face->gsub = 0; | - |
678 | face->current_script = HB_ScriptCount; executed (the execution status of this line is deduced): face->current_script = HB_ScriptCount; | - |
679 | face->current_flags = HB_ShaperFlag_Default; executed (the execution status of this line is deduced): face->current_flags = HB_ShaperFlag_Default; | - |
680 | face->has_opentype_kerning = false; executed (the execution status of this line is deduced): face->has_opentype_kerning = false; | - |
681 | face->tmpAttributes = 0; executed (the execution status of this line is deduced): face->tmpAttributes = 0; | - |
682 | face->tmpLogClusters = 0; executed (the execution status of this line is deduced): face->tmpLogClusters = 0; | - |
683 | face->glyphs_substituted = false; executed (the execution status of this line is deduced): face->glyphs_substituted = false; | - |
684 | face->buffer = 0; executed (the execution status of this line is deduced): face->buffer = 0; | - |
685 | face->font_for_init = font; executed (the execution status of this line is deduced): face->font_for_init = font; | - |
686 | face->get_font_table_func = tableFunc; executed (the execution status of this line is deduced): face->get_font_table_func = tableFunc; | - |
687 | | - |
688 | return face; executed: return face; Execution Count:1887 | 1887 |
689 | } | - |
690 | | - |
691 | HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc) | - |
692 | { | - |
693 | HB_Face face = HB_AllocFace(font, tableFunc); never executed (the execution status of this line is deduced): HB_Face face = HB_AllocFace(font, tableFunc); | - |
694 | if (face) | 0 |
695 | face = HB_LoadFace(face); never executed: face = HB_LoadFace(face); | 0 |
696 | return face; never executed: return face; | 0 |
697 | } | - |
698 | | - |
699 | HB_Face HB_LoadFace(HB_Face face) | - |
700 | { | - |
701 | void *font = face->font_for_init; executed (the execution status of this line is deduced): void *font = face->font_for_init; | - |
702 | if (!font) partially evaluated: !font no Evaluation Count:0 | yes Evaluation Count:218 |
| 0-218 |
703 | return face; never executed: return face; | 0 |
704 | | - |
705 | HB_GetFontTableFunc tableFunc = face->get_font_table_func; executed (the execution status of this line is deduced): HB_GetFontTableFunc tableFunc = face->get_font_table_func; | - |
706 | | - |
707 | face->get_font_table_func = 0; executed (the execution status of this line is deduced): face->get_font_table_func = 0; | - |
708 | face->font_for_init = 0; executed (the execution status of this line is deduced): face->font_for_init = 0; | - |
709 | | - |
710 | HB_Error error = HB_Err_Ok; executed (the execution status of this line is deduced): HB_Error error = HB_Err_Ok; | - |
711 | HB_Stream stream; executed (the execution status of this line is deduced): HB_Stream stream; | - |
712 | HB_Stream gdefStream; executed (the execution status of this line is deduced): HB_Stream gdefStream; | - |
713 | | - |
714 | gdefStream = getTableStream(font, tableFunc, TTAG_GDEF); executed (the execution status of this line is deduced): gdefStream = getTableStream(font, tableFunc, ( ( (HB_UInt)'G' << 24 ) | ( (HB_UInt)'D' << 16 ) | ( (HB_UInt)'E' << 8 ) | (HB_UInt)'F' )); | - |
715 | error = HB_Err_Not_Covered; executed (the execution status of this line is deduced): error = HB_Err_Not_Covered; | - |
716 | 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 |
717 | //DEBUG("error loading gdef table: %d", error); | - |
718 | face->gdef = 0; executed (the execution status of this line is deduced): face->gdef = 0; | - |
719 | } executed: } Execution Count:82 | 82 |
720 | | - |
721 | //DEBUG() << "trying to load gsub table"; | - |
722 | stream = getTableStream(font, tableFunc, TTAG_GSUB); executed (the execution status of this line is deduced): stream = getTableStream(font, tableFunc, ( ( (HB_UInt)'G' << 24 ) | ( (HB_UInt)'S' << 16 ) | ( (HB_UInt)'U' << 8 ) | (HB_UInt)'B' )); | - |
723 | error = HB_Err_Not_Covered; executed (the execution status of this line is deduced): error = HB_Err_Not_Covered; | - |
724 | 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 |
725 | face->gsub = 0; executed (the execution status of this line is deduced): face->gsub = 0; | - |
726 | if (error != HB_Err_Not_Covered) { partially evaluated: error != HB_Err_Not_Covered no Evaluation Count:0 | yes Evaluation Count:79 |
| 0-79 |
727 | //DEBUG("error loading gsub table: %d", error); | - |
728 | } else { | 0 |
729 | //DEBUG("face doesn't have a gsub table"); | - |
730 | } executed: } Execution Count:79 | 79 |
731 | } | - |
732 | _hb_close_stream(stream); executed (the execution status of this line is deduced): _hb_close_stream(stream); | - |
733 | | - |
734 | stream = getTableStream(font, tableFunc, TTAG_GPOS); executed (the execution status of this line is deduced): stream = getTableStream(font, tableFunc, ( ( (HB_UInt)'G' << 24 ) | ( (HB_UInt)'P' << 16 ) | ( (HB_UInt)'O' << 8 ) | (HB_UInt)'S' )); | - |
735 | error = HB_Err_Not_Covered; executed (the execution status of this line is deduced): error = HB_Err_Not_Covered; | - |
736 | 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 |
737 | face->gpos = 0; executed (the execution status of this line is deduced): face->gpos = 0; | - |
738 | DEBUG("error loading gpos table: %d", error); executed: ; Execution Count:79 never executed: printf("error loading gpos table: %d", error); partially evaluated: 1 yes Evaluation Count:79 | no Evaluation Count:0 |
| 0-79 |
739 | } | - |
740 | _hb_close_stream(stream); executed (the execution status of this line is deduced): _hb_close_stream(stream); | - |
741 | | - |
742 | _hb_close_stream(gdefStream); executed (the execution status of this line is deduced): _hb_close_stream(gdefStream); | - |
743 | | - |
744 | for (unsigned int i = 0; i < HB_ScriptCount; ++i) evaluated: i < HB_ScriptCount yes Evaluation Count:6104 | yes Evaluation Count:218 |
| 218-6104 |
745 | face->supported_scripts[i] = checkScript(face, i); executed: face->supported_scripts[i] = checkScript(face, i); Execution Count:6104 | 6104 |
746 | | - |
747 | 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 |
748 | HB_FreeFace(face); never executed (the execution status of this line is deduced): HB_FreeFace(face); | - |
749 | return 0; never executed: return 0; | 0 |
750 | } | - |
751 | | - |
752 | return face; executed: return face; Execution Count:218 | 218 |
753 | } | - |
754 | | - |
755 | void HB_FreeFace(HB_Face face) | - |
756 | { | - |
757 | if (!face) evaluated: !face yes Evaluation Count:2536 | yes Evaluation Count:1877 |
| 1877-2536 |
758 | return; executed: return; Execution Count:2536 | 2536 |
759 | if (face->gpos) evaluated: face->gpos yes Evaluation Count:132 | yes Evaluation Count:1745 |
| 132-1745 |
760 | HB_Done_GPOS_Table(face->gpos); executed: HB_Done_GPOS_Table(face->gpos); Execution Count:132 | 132 |
761 | if (face->gsub) evaluated: face->gsub yes Evaluation Count:132 | yes Evaluation Count:1745 |
| 132-1745 |
762 | HB_Done_GSUB_Table(face->gsub); executed: HB_Done_GSUB_Table(face->gsub); Execution Count:132 | 132 |
763 | if (face->gdef) evaluated: face->gdef yes Evaluation Count:129 | yes Evaluation Count:1748 |
| 129-1748 |
764 | HB_Done_GDEF_Table(face->gdef); executed: HB_Done_GDEF_Table(face->gdef); Execution Count:129 | 129 |
765 | if (face->buffer) evaluated: face->buffer yes Evaluation Count:208 | yes Evaluation Count:1669 |
| 208-1669 |
766 | hb_buffer_free(face->buffer); executed: hb_buffer_free(face->buffer); Execution Count:208 | 208 |
767 | if (face->tmpAttributes) evaluated: face->tmpAttributes yes Evaluation Count:132 | yes Evaluation Count:1745 |
| 132-1745 |
768 | free(face->tmpAttributes); executed: free(face->tmpAttributes); Execution Count:132 | 132 |
769 | if (face->tmpLogClusters) evaluated: face->tmpLogClusters yes Evaluation Count:132 | yes Evaluation Count:1745 |
| 132-1745 |
770 | free(face->tmpLogClusters); executed: free(face->tmpLogClusters); Execution Count:132 | 132 |
771 | free(face); executed (the execution status of this line is deduced): free(face); | - |
772 | } executed: } Execution Count:1877 | 1877 |
773 | | - |
774 | #ifndef NO_OPENTYPE | - |
775 | HB_Bool HB_SelectScript(HB_ShaperItem *shaper_item, const HB_OpenTypeFeature *features) | - |
776 | { | - |
777 | HB_Script script = shaper_item->item.script; executed (the execution status of this line is deduced): HB_Script script = shaper_item->item.script; | - |
778 | | - |
779 | HB_Face face = shaper_item->face; executed (the execution status of this line is deduced): HB_Face face = shaper_item->face; | - |
780 | 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 |
781 | return shaper_item->face->supported_scripts[script] ? true : false; executed: return shaper_item->face->supported_scripts[script] ? true : false; Execution Count:247852 | 247852 |
782 | | - |
783 | face->current_script = script; executed (the execution status of this line is deduced): face->current_script = script; | - |
784 | face->current_flags = shaper_item->shaperFlags; executed (the execution status of this line is deduced): face->current_flags = shaper_item->shaperFlags; | - |
785 | | - |
786 | if (!shaper_item->face->supported_scripts[script]) evaluated: !shaper_item->face->supported_scripts[script] yes Evaluation Count:79 | yes Evaluation Count:460 |
| 79-460 |
787 | return false; executed: return false; Execution Count:79 | 79 |
788 | | - |
789 | assert(script < HB_ScriptCount); executed (the execution status of this line is deduced): ((script < HB_ScriptCount) ? static_cast<void> (0) : __assert_fail ("script < HB_ScriptCount", "../3rdparty/harfbuzz/src/harfbuzz-shaper.cpp", 789, __PRETTY_FUNCTION__)); | - |
790 | // find script in our list of supported scripts. | - |
791 | unsigned int tag = ot_scripts[script].tag; executed (the execution status of this line is deduced): unsigned int tag = ot_scripts[script].tag; | - |
792 | | - |
793 | 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 |
794 | #ifdef OT_DEBUG | - |
795 | { | - |
796 | HB_FeatureList featurelist = face->gsub->FeatureList; | - |
797 | int numfeatures = featurelist.FeatureCount; | - |
798 | DEBUG("gsub table has %d features", numfeatures); | - |
799 | for (int i = 0; i < numfeatures; i++) { | - |
800 | HB_FeatureRecord *r = featurelist.FeatureRecord + i; | - |
801 | DEBUG(" feature '%s'", tag_to_string(r->FeatureTag)); | - |
802 | } | - |
803 | } | - |
804 | #endif | - |
805 | HB_GSUB_Clear_Features(face->gsub); executed (the execution status of this line is deduced): HB_GSUB_Clear_Features(face->gsub); | - |
806 | HB_UShort script_index; executed (the execution status of this line is deduced): HB_UShort script_index; | - |
807 | HB_Error error = HB_GSUB_Select_Script(face->gsub, tag, &script_index); executed (the execution status of this line is deduced): HB_Error error = HB_GSUB_Select_Script(face->gsub, tag, &script_index); | - |
808 | if (!error) { evaluated: !error yes Evaluation Count:459 | yes Evaluation Count:1 |
| 1-459 |
809 | DEBUG("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 |
810 | while (features->tag) { evaluated: features->tag yes Evaluation Count:1205 | yes Evaluation Count:459 |
| 459-1205 |
811 | HB_UShort feature_index; executed (the execution status of this line is deduced): HB_UShort feature_index; | - |
812 | error = HB_GSUB_Select_Feature(face->gsub, features->tag, script_index, 0xffff, &feature_index); executed (the execution status of this line is deduced): error = HB_GSUB_Select_Feature(face->gsub, features->tag, script_index, 0xffff, &feature_index); | - |
813 | if (!error) { evaluated: !error yes Evaluation Count:759 | yes Evaluation Count:446 |
| 446-759 |
814 | DEBUG(" 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 |
815 | HB_GSUB_Add_Feature(face->gsub, feature_index, features->property); executed (the execution status of this line is deduced): HB_GSUB_Add_Feature(face->gsub, feature_index, features->property); | - |
816 | } executed: } Execution Count:759 | 759 |
817 | ++features; executed (the execution status of this line is deduced): ++features; | - |
818 | } executed: } Execution Count:1205 | 1205 |
819 | } executed: } Execution Count:459 | 459 |
820 | } executed: } Execution Count:460 | 460 |
821 | | - |
822 | // reset | - |
823 | face->has_opentype_kerning = false; executed (the execution status of this line is deduced): face->has_opentype_kerning = false; | - |
824 | | - |
825 | if (face->gpos) { partially evaluated: face->gpos yes Evaluation Count:460 | no Evaluation Count:0 |
| 0-460 |
826 | HB_GPOS_Clear_Features(face->gpos); executed (the execution status of this line is deduced): HB_GPOS_Clear_Features(face->gpos); | - |
827 | HB_UShort script_index; executed (the execution status of this line is deduced): HB_UShort script_index; | - |
828 | HB_Error error = HB_GPOS_Select_Script(face->gpos, tag, &script_index); executed (the execution status of this line is deduced): HB_Error error = HB_GPOS_Select_Script(face->gpos, tag, &script_index); | - |
829 | if (!error) { evaluated: !error yes Evaluation Count:459 | yes Evaluation Count:1 |
| 1-459 |
830 | #ifdef OT_DEBUG | - |
831 | { | - |
832 | HB_FeatureList featurelist = face->gpos->FeatureList; | - |
833 | int numfeatures = featurelist.FeatureCount; | - |
834 | DEBUG("gpos table has %d features", numfeatures); | - |
835 | for(int i = 0; i < numfeatures; i++) { | - |
836 | HB_FeatureRecord *r = featurelist.FeatureRecord + i; | - |
837 | HB_UShort feature_index; | - |
838 | HB_GPOS_Select_Feature(face->gpos, r->FeatureTag, script_index, 0xffff, &feature_index); | - |
839 | DEBUG(" feature '%s'", tag_to_string(r->FeatureTag)); | - |
840 | } | - |
841 | } | - |
842 | #endif | - |
843 | HB_UInt *feature_tag_list_buffer; executed (the execution status of this line is deduced): HB_UInt *feature_tag_list_buffer; | - |
844 | error = HB_GPOS_Query_Features(face->gpos, script_index, 0xffff, &feature_tag_list_buffer); executed (the execution status of this line is deduced): error = HB_GPOS_Query_Features(face->gpos, script_index, 0xffff, &feature_tag_list_buffer); | - |
845 | if (!error) { partially evaluated: !error yes Evaluation Count:459 | no Evaluation Count:0 |
| 0-459 |
846 | HB_UInt *feature_tag_list = feature_tag_list_buffer; executed (the execution status of this line is deduced): HB_UInt *feature_tag_list = feature_tag_list_buffer; | - |
847 | while (*feature_tag_list) { evaluated: *feature_tag_list yes Evaluation Count:1259 | yes Evaluation Count:459 |
| 459-1259 |
848 | HB_UShort feature_index; executed (the execution status of this line is deduced): HB_UShort feature_index; | - |
849 | bool skip = false; executed (the execution status of this line is deduced): bool skip = false; | - |
850 | if (*feature_tag_list == HB_MAKE_TAG('k', 'e', 'r', '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 |
851 | 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 |
852 | skip = true; never executed: skip = true; | 0 |
853 | else | - |
854 | face->has_opentype_kerning = true; executed: face->has_opentype_kerning = true; Execution Count:452 | 452 |
855 | } | - |
856 | features = disabled_features; executed (the execution status of this line is deduced): features = disabled_features; | - |
857 | while (features->tag) { evaluated: features->tag yes Evaluation Count:7554 | yes Evaluation Count:1259 |
| 1259-7554 |
858 | if (*feature_tag_list == features->tag) { partially evaluated: *feature_tag_list == features->tag no Evaluation Count:0 | yes Evaluation Count:7554 |
| 0-7554 |
859 | skip = true; never executed (the execution status of this line is deduced): skip = true; | - |
860 | break; | 0 |
861 | } | - |
862 | ++features; executed (the execution status of this line is deduced): ++features; | - |
863 | } executed: } Execution Count:7554 | 7554 |
864 | // 'palt' should be turned off by default unless 'kern' is on | - |
865 | if (!face->has_opentype_kerning && evaluated: !face->has_opentype_kerning yes Evaluation Count:11 | yes Evaluation Count:1248 |
| 11-1248 |
866 | *feature_tag_list == HB_MAKE_TAG('p', 'a', 'l', '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 |
867 | skip = true; never executed: skip = true; | 0 |
868 | | - |
869 | if (skip) { partially evaluated: skip no Evaluation Count:0 | yes Evaluation Count:1259 |
| 0-1259 |
870 | ++feature_tag_list; never executed (the execution status of this line is deduced): ++feature_tag_list; | - |
871 | continue; never executed: continue; | 0 |
872 | } | - |
873 | error = HB_GPOS_Select_Feature(face->gpos, *feature_tag_list, script_index, 0xffff, &feature_index); executed (the execution status of this line is deduced): error = HB_GPOS_Select_Feature(face->gpos, *feature_tag_list, script_index, 0xffff, &feature_index); | - |
874 | if (!error) partially evaluated: !error yes Evaluation Count:1259 | no Evaluation Count:0 |
| 0-1259 |
875 | HB_GPOS_Add_Feature(face->gpos, feature_index, PositioningProperties); executed: HB_GPOS_Add_Feature(face->gpos, feature_index, 0x80000000); Execution Count:1259 | 1259 |
876 | ++feature_tag_list; executed (the execution status of this line is deduced): ++feature_tag_list; | - |
877 | } executed: } Execution Count:1259 | 1259 |
878 | FREE(feature_tag_list_buffer); 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 |
879 | } executed: } Execution Count:459 | 459 |
880 | } executed: } Execution Count:459 | 459 |
881 | } executed: } Execution Count:460 | 460 |
882 | | - |
883 | return true; executed: return true; Execution Count:460 | 460 |
884 | } | - |
885 | | - |
886 | static HB_Bool containsSurrogates(HB_ShaperItem *item) | - |
887 | { | - |
888 | 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 |
889 | HB_UChar16 ucs = item->string[i]; executed (the execution status of this line is deduced): HB_UChar16 ucs = item->string[i]; | - |
890 | if ( HB_IsHighSurrogate(ucs) || HB_IsLowSurrogate(ucs) ) 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 |
891 | return true; never executed: return true; | 0 |
892 | } executed: } Execution Count:3122810 | 3122810 |
893 | | - |
894 | return false; executed: return false; Execution Count:248113 | 248113 |
895 | } | - |
896 | | - |
897 | HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties) | - |
898 | { | - |
899 | HB_GlyphAttributes *tmpAttributes; executed (the execution status of this line is deduced): HB_GlyphAttributes *tmpAttributes; | - |
900 | unsigned int *tmpLogClusters; executed (the execution status of this line is deduced): unsigned int *tmpLogClusters; | - |
901 | | - |
902 | HB_Face face = item->face; executed (the execution status of this line is deduced): HB_Face face = item->face; | - |
903 | | - |
904 | face->length = item->num_glyphs; executed (the execution status of this line is deduced): face->length = item->num_glyphs; | - |
905 | | - |
906 | hb_buffer_clear(face->buffer); executed (the execution status of this line is deduced): hb_buffer_clear(face->buffer); | - |
907 | | - |
908 | tmpAttributes = (HB_GlyphAttributes *) realloc(face->tmpAttributes, face->length*sizeof(HB_GlyphAttributes)); executed (the execution status of this line is deduced): tmpAttributes = (HB_GlyphAttributes *) realloc(face->tmpAttributes, face->length*sizeof(HB_GlyphAttributes)); | - |
909 | if (!tmpAttributes) partially evaluated: !tmpAttributes no Evaluation Count:0 | yes Evaluation Count:248113 |
| 0-248113 |
910 | return false; never executed: return false; | 0 |
911 | face->tmpAttributes = tmpAttributes; executed (the execution status of this line is deduced): face->tmpAttributes = tmpAttributes; | - |
912 | | - |
913 | tmpLogClusters = (unsigned int *) realloc(face->tmpLogClusters, face->length*sizeof(unsigned int)); executed (the execution status of this line is deduced): tmpLogClusters = (unsigned int *) realloc(face->tmpLogClusters, face->length*sizeof(unsigned int)); | - |
914 | if (!tmpLogClusters) partially evaluated: !tmpLogClusters no Evaluation Count:0 | yes Evaluation Count:248113 |
| 0-248113 |
915 | return false; never executed: return false; | 0 |
916 | face->tmpLogClusters = tmpLogClusters; executed (the execution status of this line is deduced): face->tmpLogClusters = tmpLogClusters; | - |
917 | | - |
918 | for (int i = 0; i < face->length; ++i) { evaluated: i < face->length yes Evaluation Count:3326586 | yes Evaluation Count:248113 |
| 248113-3326586 |
919 | hb_buffer_add_glyph(face->buffer, item->glyphs[i], properties ? properties[i] : 0, i); executed (the execution status of this line is deduced): hb_buffer_add_glyph(face->buffer, item->glyphs[i], properties ? properties[i] : 0, i); | - |
920 | face->tmpAttributes[i] = item->attributes[i]; executed (the execution status of this line is deduced): face->tmpAttributes[i] = item->attributes[i]; | - |
921 | face->tmpLogClusters[i] = item->log_clusters[i]; executed (the execution status of this line is deduced): face->tmpLogClusters[i] = item->log_clusters[i]; | - |
922 | } executed: } Execution Count:3326586 | 3326586 |
923 | | - |
924 | #ifdef OT_DEBUG | - |
925 | DEBUG("-----------------------------------------"); | - |
926 | // DEBUG("log clusters before shaping:"); | - |
927 | // for (int j = 0; j < length; j++) | - |
928 | // DEBUG(" log[%d] = %d", j, item->log_clusters[j]); | - |
929 | DEBUG("original glyphs: %p", item->glyphs); | - |
930 | for (int i = 0; i < length; ++i) | - |
931 | DEBUG(" glyph=%4x", hb_buffer->in_string[i].gindex); | - |
932 | // dump_string(hb_buffer); | - |
933 | #endif | - |
934 | | - |
935 | face->glyphs_substituted = false; executed (the execution status of this line is deduced): face->glyphs_substituted = false; | - |
936 | 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 |
937 | unsigned int error = HB_GSUB_Apply_String(face->gsub, face->buffer); executed (the execution status of this line is deduced): unsigned int error = HB_GSUB_Apply_String(face->gsub, face->buffer); | - |
938 | 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 |
939 | return false; never executed: return false; | 0 |
940 | face->glyphs_substituted = (error != HB_Err_Not_Covered); executed (the execution status of this line is deduced): face->glyphs_substituted = (error != HB_Err_Not_Covered); | - |
941 | } executed: } Execution Count:248113 | 248113 |
942 | | - |
943 | #ifdef OT_DEBUG | - |
944 | // DEBUG("log clusters before shaping:"); | - |
945 | // for (int j = 0; j < length; j++) | - |
946 | // DEBUG(" log[%d] = %d", j, item->log_clusters[j]); | - |
947 | DEBUG("shaped glyphs:"); | - |
948 | for (int i = 0; i < length; ++i) | - |
949 | DEBUG(" glyph=%4x", hb_buffer->in_string[i].gindex); | - |
950 | DEBUG("-----------------------------------------"); | - |
951 | // dump_string(hb_buffer); | - |
952 | #endif | - |
953 | | - |
954 | return true; executed: return true; Execution Count:248113 | 248113 |
955 | } | - |
956 | | - |
957 | HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool doLogClusters) | - |
958 | { | - |
959 | HB_Face face = item->face; executed (the execution status of this line is deduced): HB_Face face = item->face; | - |
960 | | - |
961 | bool glyphs_positioned = false; executed (the execution status of this line is deduced): bool glyphs_positioned = false; | - |
962 | if (face->gpos) { partially evaluated: face->gpos yes Evaluation Count:248113 | no Evaluation Count:0 |
| 0-248113 |
963 | if (face->buffer->positions) evaluated: face->buffer->positions yes Evaluation Count:247974 | yes Evaluation Count:139 |
| 139-247974 |
964 | 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 |
965 | // #### check that passing "false,false" is correct | - |
966 | glyphs_positioned = HB_GPOS_Apply_String(item->font, face->gpos, face->current_flags, face->buffer, false, false) != HB_Err_Not_Covered; executed (the execution status of this line is deduced): glyphs_positioned = HB_GPOS_Apply_String(item->font, face->gpos, face->current_flags, face->buffer, false, false) != HB_Err_Not_Covered; | - |
967 | } executed: } Execution Count:248113 | 248113 |
968 | | - |
969 | 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 |
970 | HB_HeuristicPosition(item); executed (the execution status of this line is deduced): HB_HeuristicPosition(item); | - |
971 | return true; // nothing to do for us executed: return true; Execution Count:162580 | 162580 |
972 | } | - |
973 | | - |
974 | // make sure we have enough space to write everything back | - |
975 | 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 |
976 | item->num_glyphs = face->buffer->in_length; never executed (the execution status of this line is deduced): item->num_glyphs = face->buffer->in_length; | - |
977 | return false; never executed: return false; | 0 |
978 | } | - |
979 | | - |
980 | HB_Glyph *glyphs = item->glyphs; executed (the execution status of this line is deduced): HB_Glyph *glyphs = item->glyphs; | - |
981 | HB_GlyphAttributes *attributes = item->attributes; executed (the execution status of this line is deduced): HB_GlyphAttributes *attributes = item->attributes; | - |
982 | | - |
983 | 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 |
984 | glyphs[i] = face->buffer->in_string[i].gindex; executed (the execution status of this line is deduced): glyphs[i] = face->buffer->in_string[i].gindex; | - |
985 | attributes[i] = face->tmpAttributes[face->buffer->in_string[i].cluster]; executed (the execution status of this line is deduced): attributes[i] = face->tmpAttributes[face->buffer->in_string[i].cluster]; | - |
986 | 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 |
987 | attributes[i].clusterStart = false; never executed: attributes[i].clusterStart = false; | 0 |
988 | } executed: } Execution Count:2709980 | 2709980 |
989 | item->num_glyphs = face->buffer->in_length; executed (the execution status of this line is deduced): item->num_glyphs = face->buffer->in_length; | - |
990 | | - |
991 | 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 |
992 | // we can't do this for indic, as we pass the stuf in syllables and it's easier to do it in the shaper. | - |
993 | unsigned short *logClusters = item->log_clusters; executed (the execution status of this line is deduced): unsigned short *logClusters = item->log_clusters; | - |
994 | int clusterStart = 0; executed (the execution status of this line is deduced): int clusterStart = 0; | - |
995 | int oldCi = 0; executed (the execution status of this line is deduced): int oldCi = 0; | - |
996 | // #### the reconstruction of the logclusters currently does not work if the original string | - |
997 | // contains surrogate pairs | - |
998 | 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 |
999 | int ci = face->buffer->in_string[i].cluster; executed (the execution status of this line is deduced): int ci = face->buffer->in_string[i].cluster; | - |
1000 | // DEBUG(" ci[%d] = %d mark=%d, cmb=%d, cs=%d", | - |
1001 | // i, ci, glyphAttributes[i].mark, glyphAttributes[i].combiningClass, glyphAttributes[i].clusterStart); | - |
1002 | 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 |
1003 | for (int j = oldCi; j < ci; j++) evaluated: j < ci yes Evaluation Count:136838 | yes Evaluation Count:126890 |
| 126890-136838 |
1004 | logClusters[j] = clusterStart; executed: logClusters[j] = clusterStart; Execution Count:136838 | 136838 |
1005 | clusterStart = i; executed (the execution status of this line is deduced): clusterStart = i; | - |
1006 | oldCi = ci; executed (the execution status of this line is deduced): oldCi = ci; | - |
1007 | } executed: } Execution Count:126890 | 126890 |
1008 | } executed: } Execution Count:136804 | 136804 |
1009 | for (int j = oldCi; j < face->length; j++) evaluated: j < face->length yes Evaluation Count:9984 | yes Evaluation Count:9914 |
| 9914-9984 |
1010 | logClusters[j] = clusterStart; executed: logClusters[j] = clusterStart; Execution Count:9984 | 9984 |
1011 | } executed: } Execution Count:9914 | 9914 |
1012 | | - |
1013 | // calulate the advances for the shaped glyphs | - |
1014 | // DEBUG("unpositioned: "); | - |
1015 | | - |
1016 | // positioning code: | - |
1017 | if (glyphs_positioned) { evaluated: glyphs_positioned yes Evaluation Count:85387 | yes Evaluation Count:146 |
| 146-85387 |
1018 | HB_GetGlyphAdvances(item); executed (the execution status of this line is deduced): item->font->klass->getGlyphAdvances(item->font, item->glyphs, item->num_glyphs, item->advances, item->face->current_flags);; | - |
1019 | HB_Position positions = face->buffer->positions; executed (the execution status of this line is deduced): HB_Position positions = face->buffer->positions; | - |
1020 | HB_Fixed *advances = item->advances; executed (the execution status of this line is deduced): HB_Fixed *advances = item->advances; | - |
1021 | | - |
1022 | // DEBUG("positioned glyphs:"); | - |
1023 | 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 |
1024 | // DEBUG(" %d:\t orig advance: (%d/%d)\tadv=(%d/%d)\tpos=(%d/%d)\tback=%d\tnew_advance=%d", i, | - |
1025 | // glyphs[i].advance.x.toInt(), glyphs[i].advance.y.toInt(), | - |
1026 | // (int)(positions[i].x_advance >> 6), (int)(positions[i].y_advance >> 6), | - |
1027 | // (int)(positions[i].x_pos >> 6), (int)(positions[i].y_pos >> 6), | - |
1028 | // positions[i].back, positions[i].new_advance); | - |
1029 | | - |
1030 | HB_Fixed adjustment = positions[i].x_advance; executed (the execution status of this line is deduced): HB_Fixed adjustment = positions[i].x_advance; | - |
1031 | | - |
1032 | 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 |
1033 | adjustment = HB_FIXED_ROUND(adjustment); executed: adjustment = (((adjustment)+32) & -64); Execution Count:2709329 | 2709329 |
1034 | | - |
1035 | if (positions[i].new_advance) { partially evaluated: positions[i].new_advance no Evaluation Count:0 | yes Evaluation Count:2709329 |
| 0-2709329 |
1036 | advances[i] = adjustment; never executed (the execution status of this line is deduced): advances[i] = adjustment; | - |
1037 | } else { | 0 |
1038 | advances[i] += adjustment; executed (the execution status of this line is deduced): advances[i] += adjustment; | - |
1039 | } executed: } Execution Count:2709329 | 2709329 |
1040 | | - |
1041 | int back = 0; executed (the execution status of this line is deduced): int back = 0; | - |
1042 | HB_FixedPoint *offsets = item->offsets; executed (the execution status of this line is deduced): HB_FixedPoint *offsets = item->offsets; | - |
1043 | offsets[i].x = positions[i].x_pos; executed (the execution status of this line is deduced): offsets[i].x = positions[i].x_pos; | - |
1044 | offsets[i].y = positions[i].y_pos; executed (the execution status of this line is deduced): offsets[i].y = positions[i].y_pos; | - |
1045 | while (positions[i - back].back) { evaluated: positions[i - back].back yes Evaluation Count:1224 | yes Evaluation Count:2709329 |
| 1224-2709329 |
1046 | back += positions[i - back].back; executed (the execution status of this line is deduced): back += positions[i - back].back; | - |
1047 | offsets[i].x += positions[i - back].x_pos; executed (the execution status of this line is deduced): offsets[i].x += positions[i - back].x_pos; | - |
1048 | offsets[i].y += positions[i - back].y_pos; executed (the execution status of this line is deduced): offsets[i].y += positions[i - back].y_pos; | - |
1049 | } executed: } Execution Count:1224 | 1224 |
1050 | offsets[i].y = -offsets[i].y; executed (the execution status of this line is deduced): offsets[i].y = -offsets[i].y; | - |
1051 | | - |
1052 | if (item->item.bidiLevel % 2) { evaluated: item->item.bidiLevel % 2 yes Evaluation Count:28 | yes Evaluation Count:2709301 |
| 28-2709301 |
1053 | // ### may need to go back multiple glyphs like in ltr | - |
1054 | back = positions[i].back; executed (the execution status of this line is deduced): back = positions[i].back; | - |
1055 | while (back--) partially evaluated: back-- no Evaluation Count:0 | yes Evaluation Count:28 |
| 0-28 |
1056 | offsets[i].x -= advances[i-back]; never executed: offsets[i].x -= advances[i-back]; | 0 |
1057 | } else { executed: } Execution Count:28 | 28 |
1058 | back = 0; executed (the execution status of this line is deduced): back = 0; | - |
1059 | while (positions[i - back].back) { evaluated: positions[i - back].back yes Evaluation Count:1224 | yes Evaluation Count:2709301 |
| 1224-2709301 |
1060 | back += positions[i - back].back; executed (the execution status of this line is deduced): back += positions[i - back].back; | - |
1061 | offsets[i].x -= advances[i-back]; executed (the execution status of this line is deduced): offsets[i].x -= advances[i-back]; | - |
1062 | } executed: } Execution Count:1224 | 1224 |
1063 | } executed: } Execution Count:2709301 | 2709301 |
1064 | // DEBUG(" ->\tadv=%d\tpos=(%d/%d)", | - |
1065 | // glyphs[i].advance.x.toInt(), glyphs[i].offset.x.toInt(), glyphs[i].offset.y.toInt()); | - |
1066 | } | - |
1067 | item->kerning_applied = face->has_opentype_kerning; executed (the execution status of this line is deduced): item->kerning_applied = face->has_opentype_kerning; | - |
1068 | } else { executed: } Execution Count:85387 | 85387 |
1069 | HB_HeuristicPosition(item); executed (the execution status of this line is deduced): HB_HeuristicPosition(item); | - |
1070 | } executed: } Execution Count:146 | 146 |
1071 | | - |
1072 | #ifdef OT_DEBUG | - |
1073 | if (doLogClusters) { | - |
1074 | DEBUG("log clusters after shaping:\n"); | - |
1075 | for (unsigned int j = 0; j < item->item.length; j++) | - |
1076 | DEBUG(" log[%d] = %d\n", j, item->log_clusters[j]); | - |
1077 | } | - |
1078 | DEBUG("final glyphs:\n"); | - |
1079 | for (unsigned int i = 0; i < item->num_glyphs; ++i) | - |
1080 | DEBUG(" glyph=%4x char_index=%d mark: %d cmp: %d, clusterStart: %d advance=%d offset=%d/%d\n", | - |
1081 | glyphs[i], face->buffer->in_string[i].cluster, attributes[i].mark, | - |
1082 | attributes[i].combiningClass, attributes[i].clusterStart, | - |
1083 | item->advances[i] >> 6, | - |
1084 | item->offsets[i].x >> 6, item->offsets[i].y >> 6); | - |
1085 | DEBUG("-----------------------------------------\n"); | - |
1086 | #endif | - |
1087 | return true; executed: return true; Execution Count:85533 | 85533 |
1088 | } | - |
1089 | #endif // NO_OPENTYPE | - |
1090 | | - |
1091 | HB_Bool HB_ShapeItem(HB_ShaperItem *shaper_item) | - |
1092 | { | - |
1093 | HB_Bool result = false; executed (the execution status of this line is deduced): HB_Bool result = false; | - |
1094 | 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 |
1095 | shaper_item->num_glyphs = shaper_item->item.length; never executed (the execution status of this line is deduced): shaper_item->num_glyphs = shaper_item->item.length; | - |
1096 | return false; never executed: return false; | 0 |
1097 | } | - |
1098 | assert(shaper_item->item.script < HB_ScriptCount); executed (the execution status of this line is deduced): ((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__)); | - |
1099 | result = HB_ScriptEngines[shaper_item->item.script].shape(shaper_item); executed (the execution status of this line is deduced): result = HB_ScriptEngines[shaper_item->item.script].shape(shaper_item); | - |
1100 | shaper_item->glyphIndicesPresent = false; executed (the execution status of this line is deduced): shaper_item->glyphIndicesPresent = false; | - |
1101 | return result; executed: return result; Execution Count:248442 | 248442 |
1102 | } | - |
1103 | | - |
1104 | | - |
| | |