Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | #include <qdebug.h> | - |
43 | #include <private/qfontengine_p.h> | - |
44 | | - |
45 | #include "qbitmap.h" | - |
46 | #include "qpainter.h" | - |
47 | #include "qpainterpath.h" | - |
48 | #include "qvarlengtharray.h" | - |
49 | #include <qmath.h> | - |
50 | #include <qendian.h> | - |
51 | #include <private/qharfbuzz_p.h> | - |
52 | | - |
53 | QT_BEGIN_NAMESPACE | - |
54 | | - |
55 | static inline bool qtransform_equals_no_translate(const QTransform &a, const QTransform &b) | - |
56 | { | - |
57 | if (a.type() <= QTransform::TxTranslate && b.type() <= QTransform::TxTranslate) { partially evaluated: a.type() <= QTransform::TxTranslate yes Evaluation Count:7 | no Evaluation Count:0 |
partially evaluated: b.type() <= QTransform::TxTranslate yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
58 | return true; executed: return true; Execution Count:7 | 7 |
59 | } else { | - |
60 | // We always use paths for perspective text anyway, so no | - |
61 | // point in checking the full matrix... | - |
62 | Q_ASSERT(a.type() < QTransform::TxProject); never executed (the execution status of this line is deduced): qt_noop(); | - |
63 | Q_ASSERT(b.type() < QTransform::TxProject); never executed (the execution status of this line is deduced): qt_noop(); | - |
64 | | - |
65 | return a.m11() == b.m11() never executed: return a.m11() == b.m11() && a.m12() == b.m12() && a.m21() == b.m21() && a.m22() == b.m22(); | 0 |
66 | && a.m12() == b.m12() never executed: return a.m11() == b.m11() && a.m12() == b.m12() && a.m21() == b.m21() && a.m22() == b.m22(); | 0 |
67 | && a.m21() == b.m21() never executed: return a.m11() == b.m11() && a.m12() == b.m12() && a.m21() == b.m21() && a.m22() == b.m22(); | 0 |
68 | && a.m22() == b.m22(); never executed: return a.m11() == b.m11() && a.m12() == b.m12() && a.m21() == b.m21() && a.m22() == b.m22(); | 0 |
69 | } | - |
70 | } | - |
71 | | - |
72 | // Harfbuzz helper functions | - |
73 | | - |
74 | static HB_Bool hb_stringToGlyphs(HB_Font font, const HB_UChar16 *string, hb_uint32 length, HB_Glyph *glyphs, hb_uint32 *numGlyphs, HB_Bool rightToLeft) | - |
75 | { | - |
76 | QFontEngine *fe = (QFontEngine *)font->userData; executed (the execution status of this line is deduced): QFontEngine *fe = (QFontEngine *)font->userData; | - |
77 | | - |
78 | QVarLengthGlyphLayoutArray qglyphs(*numGlyphs); executed (the execution status of this line is deduced): QVarLengthGlyphLayoutArray qglyphs(*numGlyphs); | - |
79 | | - |
80 | QFontEngine::ShaperFlags shaperFlags(QFontEngine::GlyphIndicesOnly); executed (the execution status of this line is deduced): QFontEngine::ShaperFlags shaperFlags(QFontEngine::GlyphIndicesOnly); | - |
81 | if (rightToLeft) partially evaluated: rightToLeft no Evaluation Count:0 | yes Evaluation Count:178 |
| 0-178 |
82 | shaperFlags |= QFontEngine::RightToLeft; never executed: shaperFlags |= QFontEngine::RightToLeft; | 0 |
83 | | - |
84 | int nGlyphs = *numGlyphs; executed (the execution status of this line is deduced): int nGlyphs = *numGlyphs; | - |
85 | bool result = fe->stringToCMap(reinterpret_cast<const QChar *>(string), length, &qglyphs, &nGlyphs, shaperFlags); executed (the execution status of this line is deduced): bool result = fe->stringToCMap(reinterpret_cast<const QChar *>(string), length, &qglyphs, &nGlyphs, shaperFlags); | - |
86 | *numGlyphs = nGlyphs; executed (the execution status of this line is deduced): *numGlyphs = nGlyphs; | - |
87 | if (!result) evaluated: !result yes Evaluation Count:51 | yes Evaluation Count:127 |
| 51-127 |
88 | return false; executed: return false; Execution Count:51 | 51 |
89 | | - |
90 | for (hb_uint32 i = 0; i < *numGlyphs; ++i) evaluated: i < *numGlyphs yes Evaluation Count:411847 | yes Evaluation Count:127 |
| 127-411847 |
91 | glyphs[i] = qglyphs.glyphs[i]; executed: glyphs[i] = qglyphs.glyphs[i]; Execution Count:411847 | 411847 |
92 | | - |
93 | return true; executed: return true; Execution Count:127 | 127 |
94 | } | - |
95 | | - |
96 | static void hb_getAdvances(HB_Font font, const HB_Glyph *glyphs, hb_uint32 numGlyphs, HB_Fixed *advances, int flags) | - |
97 | { | - |
98 | QFontEngine *fe = (QFontEngine *)font->userData; executed (the execution status of this line is deduced): QFontEngine *fe = (QFontEngine *)font->userData; | - |
99 | | - |
100 | QVarLengthGlyphLayoutArray qglyphs(numGlyphs); executed (the execution status of this line is deduced): QVarLengthGlyphLayoutArray qglyphs(numGlyphs); | - |
101 | | - |
102 | for (hb_uint32 i = 0; i < numGlyphs; ++i) evaluated: i < numGlyphs yes Evaluation Count:3306477 | yes Evaluation Count:247103 |
| 247103-3306477 |
103 | qglyphs.glyphs[i] = glyphs[i]; executed: qglyphs.glyphs[i] = glyphs[i]; Execution Count:3306477 | 3306477 |
104 | | - |
105 | fe->recalcAdvances(&qglyphs, (flags & HB_ShaperFlag_UseDesignMetrics) ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0)); executed (the execution status of this line is deduced): fe->recalcAdvances(&qglyphs, (flags & HB_ShaperFlag_UseDesignMetrics) ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0)); | - |
106 | | - |
107 | for (hb_uint32 i = 0; i < numGlyphs; ++i) evaluated: i < numGlyphs yes Evaluation Count:3306477 | yes Evaluation Count:247103 |
| 247103-3306477 |
108 | advances[i] = qglyphs.advances_x[i].value(); executed: advances[i] = qglyphs.advances_x[i].value(); Execution Count:3306477 | 3306477 |
109 | } executed: } Execution Count:247103 | 247103 |
110 | | - |
111 | static HB_Bool hb_canRender(HB_Font font, const HB_UChar16 *string, hb_uint32 length) | - |
112 | { | - |
113 | QFontEngine *fe = (QFontEngine *)font->userData; executed (the execution status of this line is deduced): QFontEngine *fe = (QFontEngine *)font->userData; | - |
114 | return fe->canRender(reinterpret_cast<const QChar *>(string), length); executed: return fe->canRender(reinterpret_cast<const QChar *>(string), length); Execution Count:4 | 4 |
115 | } | - |
116 | | - |
117 | static void hb_getGlyphMetrics(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics) | - |
118 | { | - |
119 | QFontEngine *fe = (QFontEngine *)font->userData; executed (the execution status of this line is deduced): QFontEngine *fe = (QFontEngine *)font->userData; | - |
120 | glyph_metrics_t m = fe->boundingBox(glyph); executed (the execution status of this line is deduced): glyph_metrics_t m = fe->boundingBox(glyph); | - |
121 | metrics->x = m.x.value(); executed (the execution status of this line is deduced): metrics->x = m.x.value(); | - |
122 | metrics->y = m.y.value(); executed (the execution status of this line is deduced): metrics->y = m.y.value(); | - |
123 | metrics->width = m.width.value(); executed (the execution status of this line is deduced): metrics->width = m.width.value(); | - |
124 | metrics->height = m.height.value(); executed (the execution status of this line is deduced): metrics->height = m.height.value(); | - |
125 | metrics->xOffset = m.xoff.value(); executed (the execution status of this line is deduced): metrics->xOffset = m.xoff.value(); | - |
126 | metrics->yOffset = m.yoff.value(); executed (the execution status of this line is deduced): metrics->yOffset = m.yoff.value(); | - |
127 | } executed: } Execution Count:2 | 2 |
128 | | - |
129 | static HB_Fixed hb_getFontMetric(HB_Font font, HB_FontMetric metric) | - |
130 | { | - |
131 | if (metric == HB_FontAscent) { partially evaluated: metric == HB_FontAscent yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
132 | QFontEngine *fe = (QFontEngine *)font->userData; executed (the execution status of this line is deduced): QFontEngine *fe = (QFontEngine *)font->userData; | - |
133 | return fe->ascent().value(); executed: return fe->ascent().value(); Execution Count:1 | 1 |
134 | } | - |
135 | return 0; never executed: return 0; | 0 |
136 | } | - |
137 | | - |
138 | HB_Error QFontEngine::getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints) | - |
139 | { | - |
140 | Q_UNUSED(glyph) never executed (the execution status of this line is deduced): (void)glyph; | - |
141 | Q_UNUSED(flags) never executed (the execution status of this line is deduced): (void)flags; | - |
142 | Q_UNUSED(point) never executed (the execution status of this line is deduced): (void)point; | - |
143 | Q_UNUSED(xpos) never executed (the execution status of this line is deduced): (void)xpos; | - |
144 | Q_UNUSED(ypos) never executed (the execution status of this line is deduced): (void)ypos; | - |
145 | Q_UNUSED(nPoints) never executed (the execution status of this line is deduced): (void)nPoints; | - |
146 | return HB_Err_Not_Covered; never executed: return HB_Err_Not_Covered; | 0 |
147 | } | - |
148 | | - |
149 | static HB_Error hb_getPointInOutline(HB_Font font, HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints) | - |
150 | { | - |
151 | QFontEngine *fe = (QFontEngine *)font->userData; never executed (the execution status of this line is deduced): QFontEngine *fe = (QFontEngine *)font->userData; | - |
152 | return fe->getPointInOutline(glyph, flags, point, xpos, ypos, nPoints); never executed: return fe->getPointInOutline(glyph, flags, point, xpos, ypos, nPoints); | 0 |
153 | } | - |
154 | | - |
155 | static const HB_FontClass hb_fontClass = { | - |
156 | hb_stringToGlyphs, hb_getAdvances, hb_canRender, hb_getPointInOutline, | - |
157 | hb_getGlyphMetrics, hb_getFontMetric | - |
158 | }; | - |
159 | | - |
160 | static HB_Error hb_getSFntTable(void *font, HB_Tag tableTag, HB_Byte *buffer, HB_UInt *length) | - |
161 | { | - |
162 | QFontEngine *fe = (QFontEngine *)font; executed (the execution status of this line is deduced): QFontEngine *fe = (QFontEngine *)font; | - |
163 | if (!fe->getSfntTableData(tableTag, buffer, length)) partially evaluated: !fe->getSfntTableData(tableTag, buffer, length) yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
164 | return HB_Err_Invalid_Argument; executed: return HB_Err_Invalid_Argument; Execution Count:6 | 6 |
165 | return HB_Err_Ok; never executed: return HB_Err_Ok; | 0 |
166 | } | - |
167 | | - |
168 | // QFontEngine | - |
169 | | - |
170 | QFontEngine::QFontEngine() | - |
171 | : QObject(), ref(0) | - |
172 | { | - |
173 | cache_count = 0; executed (the execution status of this line is deduced): cache_count = 0; | - |
174 | fsType = 0; executed (the execution status of this line is deduced): fsType = 0; | - |
175 | symbol = false; executed (the execution status of this line is deduced): symbol = false; | - |
176 | memset(&hbFont, 0, sizeof(hbFont)); executed (the execution status of this line is deduced): memset(&hbFont, 0, sizeof(hbFont)); | - |
177 | hbFont.klass = &hb_fontClass; executed (the execution status of this line is deduced): hbFont.klass = &hb_fontClass; | - |
178 | hbFont.userData = this; executed (the execution status of this line is deduced): hbFont.userData = this; | - |
179 | | - |
180 | hbFace = 0; executed (the execution status of this line is deduced): hbFace = 0; | - |
181 | glyphFormat = -1; executed (the execution status of this line is deduced): glyphFormat = -1; | - |
182 | m_subPixelPositionCount = 0; executed (the execution status of this line is deduced): m_subPixelPositionCount = 0; | - |
183 | } executed: } Execution Count:2570 | 2570 |
184 | | - |
185 | QFontEngine::~QFontEngine() | - |
186 | { | - |
187 | m_glyphCaches.clear(); executed (the execution status of this line is deduced): m_glyphCaches.clear(); | - |
188 | qHBFreeFace(hbFace); executed (the execution status of this line is deduced): qHBFreeFace(hbFace); | - |
189 | } executed: } Execution Count:2536 | 2536 |
190 | | - |
191 | QFixed QFontEngine::lineThickness() const | - |
192 | { | - |
193 | // ad hoc algorithm | - |
194 | int score = fontDef.weight * fontDef.pixelSize; never executed (the execution status of this line is deduced): int score = fontDef.weight * fontDef.pixelSize; | - |
195 | int lw = score / 700; never executed (the execution status of this line is deduced): int lw = score / 700; | - |
196 | | - |
197 | // looks better with thicker line for small pointsizes | - |
198 | if (lw < 2 && score >= 1050) lw = 2; never executed: lw = 2; never evaluated: lw < 2 never evaluated: score >= 1050 | 0 |
199 | if (lw == 0) lw = 1; never executed: lw = 1; never evaluated: lw == 0 | 0 |
200 | | - |
201 | return lw; never executed: return lw; | 0 |
202 | } | - |
203 | | - |
204 | QFixed QFontEngine::underlinePosition() const | - |
205 | { | - |
206 | return ((lineThickness() * 2) + 3) / 6; never executed: return ((lineThickness() * 2) + 3) / 6; | 0 |
207 | } | - |
208 | | - |
209 | HB_Font QFontEngine::harfbuzzFont() const | - |
210 | { | - |
211 | if (!hbFont.x_ppem) { evaluated: !hbFont.x_ppem yes Evaluation Count:2 | yes Evaluation Count:247085 |
| 2-247085 |
212 | QFixed emSquare = emSquareSize(); executed (the execution status of this line is deduced): QFixed emSquare = emSquareSize(); | - |
213 | hbFont.x_ppem = fontDef.pixelSize; executed (the execution status of this line is deduced): hbFont.x_ppem = fontDef.pixelSize; | - |
214 | hbFont.y_ppem = fontDef.pixelSize * fontDef.stretch / 100; executed (the execution status of this line is deduced): hbFont.y_ppem = fontDef.pixelSize * fontDef.stretch / 100; | - |
215 | hbFont.x_scale = (QFixed(hbFont.x_ppem * (1 << 16)) / emSquare).value(); executed (the execution status of this line is deduced): hbFont.x_scale = (QFixed(hbFont.x_ppem * (1 << 16)) / emSquare).value(); | - |
216 | hbFont.y_scale = (QFixed(hbFont.y_ppem * (1 << 16)) / emSquare).value(); executed (the execution status of this line is deduced): hbFont.y_scale = (QFixed(hbFont.y_ppem * (1 << 16)) / emSquare).value(); | - |
217 | } executed: } Execution Count:2 | 2 |
218 | return &hbFont; executed: return &hbFont; Execution Count:247087 | 247087 |
219 | } | - |
220 | | - |
221 | HB_Face QFontEngine::harfbuzzFace() const | - |
222 | { | - |
223 | if (!hbFace) { evaluated: !hbFace yes Evaluation Count:2 | yes Evaluation Count:247085 |
| 2-247085 |
224 | hbFace = qHBNewFace(const_cast<QFontEngine *>(this), hb_getSFntTable); executed (the execution status of this line is deduced): hbFace = qHBNewFace(const_cast<QFontEngine *>(this), hb_getSFntTable); | - |
225 | Q_CHECK_PTR(hbFace); executed (the execution status of this line is deduced): qt_noop(); | - |
226 | } executed: } Execution Count:2 | 2 |
227 | return hbFace; executed: return hbFace; Execution Count:247087 | 247087 |
228 | } | - |
229 | | - |
230 | HB_Face QFontEngine::initializedHarfbuzzFace() const | - |
231 | { | - |
232 | HB_Face face = harfbuzzFace(); executed (the execution status of this line is deduced): HB_Face face = harfbuzzFace(); | - |
233 | if (face != 0 && face->font_for_init != 0) partially evaluated: face != 0 yes Evaluation Count:247087 | no Evaluation Count:0 |
evaluated: face->font_for_init != 0 yes Evaluation Count:217 | yes Evaluation Count:246870 |
| 0-247087 |
234 | face = qHBLoadFace(face); executed: face = qHBLoadFace(face); Execution Count:217 | 217 |
235 | | - |
236 | return face; executed: return face; Execution Count:247087 | 247087 |
237 | } | - |
238 | | - |
239 | glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix) | - |
240 | { | - |
241 | glyph_metrics_t metrics = boundingBox(glyph); executed (the execution status of this line is deduced): glyph_metrics_t metrics = boundingBox(glyph); | - |
242 | | - |
243 | if (matrix.type() > QTransform::TxTranslate) { partially evaluated: matrix.type() > QTransform::TxTranslate no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
244 | return metrics.transformed(matrix); never executed: return metrics.transformed(matrix); | 0 |
245 | } | - |
246 | return metrics; executed: return metrics; Execution Count:1 | 1 |
247 | } | - |
248 | | - |
249 | QFixed QFontEngine::xHeight() const | - |
250 | { | - |
251 | QGlyphLayoutArray<8> glyphs; never executed (the execution status of this line is deduced): QGlyphLayoutArray<8> glyphs; | - |
252 | int nglyphs = 7; never executed (the execution status of this line is deduced): int nglyphs = 7; | - |
253 | QChar x((ushort)'x'); never executed (the execution status of this line is deduced): QChar x((ushort)'x'); | - |
254 | stringToCMap(&x, 1, &glyphs, &nglyphs, GlyphIndicesOnly); never executed (the execution status of this line is deduced): stringToCMap(&x, 1, &glyphs, &nglyphs, GlyphIndicesOnly); | - |
255 | | - |
256 | glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyphs.glyphs[0]); never executed (the execution status of this line is deduced): glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyphs.glyphs[0]); | - |
257 | return bb.height; never executed: return bb.height; | 0 |
258 | } | - |
259 | | - |
260 | QFixed QFontEngine::averageCharWidth() const | - |
261 | { | - |
262 | QGlyphLayoutArray<8> glyphs; never executed (the execution status of this line is deduced): QGlyphLayoutArray<8> glyphs; | - |
263 | int nglyphs = 7; never executed (the execution status of this line is deduced): int nglyphs = 7; | - |
264 | QChar x((ushort)'x'); never executed (the execution status of this line is deduced): QChar x((ushort)'x'); | - |
265 | stringToCMap(&x, 1, &glyphs, &nglyphs, GlyphIndicesOnly); never executed (the execution status of this line is deduced): stringToCMap(&x, 1, &glyphs, &nglyphs, GlyphIndicesOnly); | - |
266 | | - |
267 | glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyphs.glyphs[0]); never executed (the execution status of this line is deduced): glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyphs.glyphs[0]); | - |
268 | return bb.xoff; never executed: return bb.xoff; | 0 |
269 | } | - |
270 | | - |
271 | bool QFontEngine::supportsTransformations(const QTransform &transform) const | - |
272 | { | - |
273 | return (transform.type() >= QTransform::TxProject); executed: return (transform.type() >= QTransform::TxProject); Execution Count:23041 | 23041 |
274 | } | - |
275 | | - |
276 | void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags, | - |
277 | QVarLengthArray<glyph_t> &glyphs_out, QVarLengthArray<QFixedPoint> &positions) | - |
278 | { | - |
279 | QFixed xpos; executed (the execution status of this line is deduced): QFixed xpos; | - |
280 | QFixed ypos; executed (the execution status of this line is deduced): QFixed ypos; | - |
281 | | - |
282 | const bool transform = matrix.m11() != 1. evaluated: matrix.m11() != 1. yes Evaluation Count:129 | yes Evaluation Count:22911 |
| 129-22911 |
283 | || matrix.m12() != 0. partially evaluated: matrix.m12() != 0. no Evaluation Count:0 | yes Evaluation Count:22911 |
| 0-22911 |
284 | || matrix.m21() != 0. partially evaluated: matrix.m21() != 0. no Evaluation Count:0 | yes Evaluation Count:22911 |
| 0-22911 |
285 | || matrix.m22() != 1.; partially evaluated: matrix.m22() != 1. no Evaluation Count:0 | yes Evaluation Count:22911 |
| 0-22911 |
286 | if (!transform) { evaluated: !transform yes Evaluation Count:22911 | yes Evaluation Count:129 |
| 129-22911 |
287 | xpos = QFixed::fromReal(matrix.dx()); executed (the execution status of this line is deduced): xpos = QFixed::fromReal(matrix.dx()); | - |
288 | ypos = QFixed::fromReal(matrix.dy()); executed (the execution status of this line is deduced): ypos = QFixed::fromReal(matrix.dy()); | - |
289 | } executed: } Execution Count:22911 | 22911 |
290 | | - |
291 | int current = 0; executed (the execution status of this line is deduced): int current = 0; | - |
292 | if (flags & QTextItem::RightToLeft) { evaluated: flags & QTextItem::RightToLeft yes Evaluation Count:20 | yes Evaluation Count:23020 |
| 20-23020 |
293 | int i = glyphs.numGlyphs; executed (the execution status of this line is deduced): int i = glyphs.numGlyphs; | - |
294 | int totalKashidas = 0; executed (the execution status of this line is deduced): int totalKashidas = 0; | - |
295 | while(i--) { evaluated: i-- yes Evaluation Count:58 | yes Evaluation Count:20 |
| 20-58 |
296 | if (glyphs.attributes[i].dontPrint) partially evaluated: glyphs.attributes[i].dontPrint no Evaluation Count:0 | yes Evaluation Count:58 |
| 0-58 |
297 | continue; never executed: continue; | 0 |
298 | xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6); executed (the execution status of this line is deduced): xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6); | - |
299 | ypos += glyphs.advances_y[i]; executed (the execution status of this line is deduced): ypos += glyphs.advances_y[i]; | - |
300 | totalKashidas += glyphs.justifications[i].nKashidas; executed (the execution status of this line is deduced): totalKashidas += glyphs.justifications[i].nKashidas; | - |
301 | } executed: } Execution Count:58 | 58 |
302 | positions.resize(glyphs.numGlyphs+totalKashidas); executed (the execution status of this line is deduced): positions.resize(glyphs.numGlyphs+totalKashidas); | - |
303 | glyphs_out.resize(glyphs.numGlyphs+totalKashidas); executed (the execution status of this line is deduced): glyphs_out.resize(glyphs.numGlyphs+totalKashidas); | - |
304 | | - |
305 | i = 0; executed (the execution status of this line is deduced): i = 0; | - |
306 | while(i < glyphs.numGlyphs) { evaluated: i < glyphs.numGlyphs yes Evaluation Count:58 | yes Evaluation Count:20 |
| 20-58 |
307 | if (glyphs.attributes[i].dontPrint) { partially evaluated: glyphs.attributes[i].dontPrint no Evaluation Count:0 | yes Evaluation Count:58 |
| 0-58 |
308 | ++i; never executed (the execution status of this line is deduced): ++i; | - |
309 | continue; never executed: continue; | 0 |
310 | } | - |
311 | xpos -= glyphs.advances_x[i]; executed (the execution status of this line is deduced): xpos -= glyphs.advances_x[i]; | - |
312 | ypos -= glyphs.advances_y[i]; executed (the execution status of this line is deduced): ypos -= glyphs.advances_y[i]; | - |
313 | | - |
314 | QFixed gpos_x = xpos + glyphs.offsets[i].x; executed (the execution status of this line is deduced): QFixed gpos_x = xpos + glyphs.offsets[i].x; | - |
315 | QFixed gpos_y = ypos + glyphs.offsets[i].y; executed (the execution status of this line is deduced): QFixed gpos_y = ypos + glyphs.offsets[i].y; | - |
316 | if (transform) { partially evaluated: transform no Evaluation Count:0 | yes Evaluation Count:58 |
| 0-58 |
317 | QPointF gpos(gpos_x.toReal(), gpos_y.toReal()); never executed (the execution status of this line is deduced): QPointF gpos(gpos_x.toReal(), gpos_y.toReal()); | - |
318 | gpos = gpos * matrix; never executed (the execution status of this line is deduced): gpos = gpos * matrix; | - |
319 | gpos_x = QFixed::fromReal(gpos.x()); never executed (the execution status of this line is deduced): gpos_x = QFixed::fromReal(gpos.x()); | - |
320 | gpos_y = QFixed::fromReal(gpos.y()); never executed (the execution status of this line is deduced): gpos_y = QFixed::fromReal(gpos.y()); | - |
321 | } | 0 |
322 | positions[current].x = gpos_x; executed (the execution status of this line is deduced): positions[current].x = gpos_x; | - |
323 | positions[current].y = gpos_y; executed (the execution status of this line is deduced): positions[current].y = gpos_y; | - |
324 | glyphs_out[current] = glyphs.glyphs[i]; executed (the execution status of this line is deduced): glyphs_out[current] = glyphs.glyphs[i]; | - |
325 | ++current; executed (the execution status of this line is deduced): ++current; | - |
326 | if (glyphs.justifications[i].nKashidas) { partially evaluated: glyphs.justifications[i].nKashidas no Evaluation Count:0 | yes Evaluation Count:58 |
| 0-58 |
327 | QChar ch(0x640); // Kashida character never executed (the execution status of this line is deduced): QChar ch(0x640); | - |
328 | QGlyphLayoutArray<8> g; never executed (the execution status of this line is deduced): QGlyphLayoutArray<8> g; | - |
329 | int nglyphs = 7; never executed (the execution status of this line is deduced): int nglyphs = 7; | - |
330 | stringToCMap(&ch, 1, &g, &nglyphs, 0); never executed (the execution status of this line is deduced): stringToCMap(&ch, 1, &g, &nglyphs, 0); | - |
331 | for (uint k = 0; k < glyphs.justifications[i].nKashidas; ++k) { never evaluated: k < glyphs.justifications[i].nKashidas | 0 |
332 | xpos -= g.advances_x[0]; never executed (the execution status of this line is deduced): xpos -= g.advances_x[0]; | - |
333 | ypos -= g.advances_y[0]; never executed (the execution status of this line is deduced): ypos -= g.advances_y[0]; | - |
334 | | - |
335 | QFixed gpos_x = xpos + glyphs.offsets[i].x; never executed (the execution status of this line is deduced): QFixed gpos_x = xpos + glyphs.offsets[i].x; | - |
336 | QFixed gpos_y = ypos + glyphs.offsets[i].y; never executed (the execution status of this line is deduced): QFixed gpos_y = ypos + glyphs.offsets[i].y; | - |
337 | if (transform) { never evaluated: transform | 0 |
338 | QPointF gpos(gpos_x.toReal(), gpos_y.toReal()); never executed (the execution status of this line is deduced): QPointF gpos(gpos_x.toReal(), gpos_y.toReal()); | - |
339 | gpos = gpos * matrix; never executed (the execution status of this line is deduced): gpos = gpos * matrix; | - |
340 | gpos_x = QFixed::fromReal(gpos.x()); never executed (the execution status of this line is deduced): gpos_x = QFixed::fromReal(gpos.x()); | - |
341 | gpos_y = QFixed::fromReal(gpos.y()); never executed (the execution status of this line is deduced): gpos_y = QFixed::fromReal(gpos.y()); | - |
342 | } | 0 |
343 | positions[current].x = gpos_x; never executed (the execution status of this line is deduced): positions[current].x = gpos_x; | - |
344 | positions[current].y = gpos_y; never executed (the execution status of this line is deduced): positions[current].y = gpos_y; | - |
345 | glyphs_out[current] = g.glyphs[0]; never executed (the execution status of this line is deduced): glyphs_out[current] = g.glyphs[0]; | - |
346 | ++current; never executed (the execution status of this line is deduced): ++current; | - |
347 | } | 0 |
348 | } else { | 0 |
349 | xpos -= QFixed::fromFixed(glyphs.justifications[i].space_18d6); executed (the execution status of this line is deduced): xpos -= QFixed::fromFixed(glyphs.justifications[i].space_18d6); | - |
350 | } executed: } Execution Count:58 | 58 |
351 | ++i; executed (the execution status of this line is deduced): ++i; | - |
352 | } executed: } Execution Count:58 | 58 |
353 | } else { executed: } Execution Count:20 | 20 |
354 | positions.resize(glyphs.numGlyphs); executed (the execution status of this line is deduced): positions.resize(glyphs.numGlyphs); | - |
355 | glyphs_out.resize(glyphs.numGlyphs); executed (the execution status of this line is deduced): glyphs_out.resize(glyphs.numGlyphs); | - |
356 | int i = 0; executed (the execution status of this line is deduced): int i = 0; | - |
357 | if (!transform) { evaluated: !transform yes Evaluation Count:22891 | yes Evaluation Count:129 |
| 129-22891 |
358 | while (i < glyphs.numGlyphs) { evaluated: i < glyphs.numGlyphs yes Evaluation Count:141820 | yes Evaluation Count:22891 |
| 22891-141820 |
359 | if (!glyphs.attributes[i].dontPrint) { partially evaluated: !glyphs.attributes[i].dontPrint yes Evaluation Count:141820 | no Evaluation Count:0 |
| 0-141820 |
360 | positions[current].x = xpos + glyphs.offsets[i].x; executed (the execution status of this line is deduced): positions[current].x = xpos + glyphs.offsets[i].x; | - |
361 | positions[current].y = ypos + glyphs.offsets[i].y; executed (the execution status of this line is deduced): positions[current].y = ypos + glyphs.offsets[i].y; | - |
362 | glyphs_out[current] = glyphs.glyphs[i]; executed (the execution status of this line is deduced): glyphs_out[current] = glyphs.glyphs[i]; | - |
363 | xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6); executed (the execution status of this line is deduced): xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6); | - |
364 | ypos += glyphs.advances_y[i]; executed (the execution status of this line is deduced): ypos += glyphs.advances_y[i]; | - |
365 | ++current; executed (the execution status of this line is deduced): ++current; | - |
366 | } executed: } Execution Count:141820 | 141820 |
367 | ++i; executed (the execution status of this line is deduced): ++i; | - |
368 | } executed: } Execution Count:141820 | 141820 |
369 | } else { executed: } Execution Count:22891 | 22891 |
370 | while (i < glyphs.numGlyphs) { evaluated: i < glyphs.numGlyphs yes Evaluation Count:3782 | yes Evaluation Count:129 |
| 129-3782 |
371 | if (!glyphs.attributes[i].dontPrint) { partially evaluated: !glyphs.attributes[i].dontPrint yes Evaluation Count:3782 | no Evaluation Count:0 |
| 0-3782 |
372 | QFixed gpos_x = xpos + glyphs.offsets[i].x; executed (the execution status of this line is deduced): QFixed gpos_x = xpos + glyphs.offsets[i].x; | - |
373 | QFixed gpos_y = ypos + glyphs.offsets[i].y; executed (the execution status of this line is deduced): QFixed gpos_y = ypos + glyphs.offsets[i].y; | - |
374 | QPointF gpos(gpos_x.toReal(), gpos_y.toReal()); executed (the execution status of this line is deduced): QPointF gpos(gpos_x.toReal(), gpos_y.toReal()); | - |
375 | gpos = gpos * matrix; executed (the execution status of this line is deduced): gpos = gpos * matrix; | - |
376 | positions[current].x = QFixed::fromReal(gpos.x()); executed (the execution status of this line is deduced): positions[current].x = QFixed::fromReal(gpos.x()); | - |
377 | positions[current].y = QFixed::fromReal(gpos.y()); executed (the execution status of this line is deduced): positions[current].y = QFixed::fromReal(gpos.y()); | - |
378 | glyphs_out[current] = glyphs.glyphs[i]; executed (the execution status of this line is deduced): glyphs_out[current] = glyphs.glyphs[i]; | - |
379 | xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6); executed (the execution status of this line is deduced): xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6); | - |
380 | ypos += glyphs.advances_y[i]; executed (the execution status of this line is deduced): ypos += glyphs.advances_y[i]; | - |
381 | ++current; executed (the execution status of this line is deduced): ++current; | - |
382 | } executed: } Execution Count:3782 | 3782 |
383 | ++i; executed (the execution status of this line is deduced): ++i; | - |
384 | } executed: } Execution Count:3782 | 3782 |
385 | } executed: } Execution Count:129 | 129 |
386 | } | - |
387 | positions.resize(current); executed (the execution status of this line is deduced): positions.resize(current); | - |
388 | glyphs_out.resize(current); executed (the execution status of this line is deduced): glyphs_out.resize(current); | - |
389 | Q_ASSERT(positions.size() == glyphs_out.size()); executed (the execution status of this line is deduced): qt_noop(); | - |
390 | } executed: } Execution Count:23040 | 23040 |
391 | | - |
392 | void QFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing) | - |
393 | { | - |
394 | glyph_metrics_t gi = boundingBox(glyph); executed (the execution status of this line is deduced): glyph_metrics_t gi = boundingBox(glyph); | - |
395 | bool isValid = gi.isValid(); executed (the execution status of this line is deduced): bool isValid = gi.isValid(); | - |
396 | if (leftBearing != 0) partially evaluated: leftBearing != 0 no Evaluation Count:0 | yes Evaluation Count:261656 |
| 0-261656 |
397 | *leftBearing = isValid ? gi.x.toReal() : 0.0; never executed: *leftBearing = isValid ? gi.x.toReal() : 0.0; never evaluated: isValid | 0 |
398 | if (rightBearing != 0) partially evaluated: rightBearing != 0 yes Evaluation Count:261656 | no Evaluation Count:0 |
| 0-261656 |
399 | *rightBearing = isValid ? (gi.xoff - gi.x - gi.width).toReal() : 0.0; executed: *rightBearing = isValid ? (gi.xoff - gi.x - gi.width).toReal() : 0.0; Execution Count:261656 partially evaluated: isValid yes Evaluation Count:261656 | no Evaluation Count:0 |
| 0-261656 |
400 | } executed: } Execution Count:261656 | 261656 |
401 | | - |
402 | glyph_metrics_t QFontEngine::tightBoundingBox(const QGlyphLayout &glyphs) | - |
403 | { | - |
404 | glyph_metrics_t overall; never executed (the execution status of this line is deduced): glyph_metrics_t overall; | - |
405 | | - |
406 | QFixed ymax = 0; never executed (the execution status of this line is deduced): QFixed ymax = 0; | - |
407 | QFixed xmax = 0; never executed (the execution status of this line is deduced): QFixed xmax = 0; | - |
408 | for (int i = 0; i < glyphs.numGlyphs; i++) { never evaluated: i < glyphs.numGlyphs | 0 |
409 | glyph_metrics_t bb = boundingBox(glyphs.glyphs[i]); never executed (the execution status of this line is deduced): glyph_metrics_t bb = boundingBox(glyphs.glyphs[i]); | - |
410 | QFixed x = overall.xoff + glyphs.offsets[i].x + bb.x; never executed (the execution status of this line is deduced): QFixed x = overall.xoff + glyphs.offsets[i].x + bb.x; | - |
411 | QFixed y = overall.yoff + glyphs.offsets[i].y + bb.y; never executed (the execution status of this line is deduced): QFixed y = overall.yoff + glyphs.offsets[i].y + bb.y; | - |
412 | overall.x = qMin(overall.x, x); never executed (the execution status of this line is deduced): overall.x = qMin(overall.x, x); | - |
413 | overall.y = qMin(overall.y, y); never executed (the execution status of this line is deduced): overall.y = qMin(overall.y, y); | - |
414 | xmax = qMax(xmax, x + bb.width); never executed (the execution status of this line is deduced): xmax = qMax(xmax, x + bb.width); | - |
415 | ymax = qMax(ymax, y + bb.height); never executed (the execution status of this line is deduced): ymax = qMax(ymax, y + bb.height); | - |
416 | overall.xoff += bb.xoff; never executed (the execution status of this line is deduced): overall.xoff += bb.xoff; | - |
417 | overall.yoff += bb.yoff; never executed (the execution status of this line is deduced): overall.yoff += bb.yoff; | - |
418 | } | 0 |
419 | overall.height = qMax(overall.height, ymax - overall.y); never executed (the execution status of this line is deduced): overall.height = qMax(overall.height, ymax - overall.y); | - |
420 | overall.width = xmax - overall.x; never executed (the execution status of this line is deduced): overall.width = xmax - overall.x; | - |
421 | | - |
422 | return overall; never executed: return overall; | 0 |
423 | } | - |
424 | | - |
425 | | - |
426 | void QFontEngine::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, | - |
427 | QTextItem::RenderFlags flags) | - |
428 | { | - |
429 | if (!glyphs.numGlyphs) never evaluated: !glyphs.numGlyphs | 0 |
430 | return; | 0 |
431 | | - |
432 | QVarLengthArray<QFixedPoint> positions; never executed (the execution status of this line is deduced): QVarLengthArray<QFixedPoint> positions; | - |
433 | QVarLengthArray<glyph_t> positioned_glyphs; never executed (the execution status of this line is deduced): QVarLengthArray<glyph_t> positioned_glyphs; | - |
434 | QTransform matrix = QTransform::fromTranslate(x, y); never executed (the execution status of this line is deduced): QTransform matrix = QTransform::fromTranslate(x, y); | - |
435 | getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions); never executed (the execution status of this line is deduced): getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions); | - |
436 | addGlyphsToPath(positioned_glyphs.data(), positions.data(), positioned_glyphs.size(), path, flags); never executed (the execution status of this line is deduced): addGlyphsToPath(positioned_glyphs.data(), positions.data(), positioned_glyphs.size(), path, flags); | - |
437 | } | 0 |
438 | | - |
439 | #define GRID(x, y) grid[(y)*(w+1) + (x)] | - |
440 | #define SET(x, y) (*(image_data + (y)*bpl + ((x) >> 3)) & (0x80 >> ((x) & 7))) | - |
441 | | - |
442 | enum { EdgeRight = 0x1, | - |
443 | EdgeDown = 0x2, | - |
444 | EdgeLeft = 0x4, | - |
445 | EdgeUp = 0x8 | - |
446 | }; | - |
447 | | - |
448 | static void collectSingleContour(qreal x0, qreal y0, uint *grid, int x, int y, int w, int h, QPainterPath *path) | - |
449 | { | - |
450 | Q_UNUSED(h); never executed (the execution status of this line is deduced): (void)h;; | - |
451 | | - |
452 | path->moveTo(x + x0, y + y0); never executed (the execution status of this line is deduced): path->moveTo(x + x0, y + y0); | - |
453 | while (GRID(x, y)) { never evaluated: grid[(y)*(w+1) + (x)] | 0 |
454 | if (GRID(x, y) & EdgeRight) { never evaluated: grid[(y)*(w+1) + (x)] & EdgeRight | 0 |
455 | while (GRID(x, y) & EdgeRight) { never evaluated: grid[(y)*(w+1) + (x)] & EdgeRight | 0 |
456 | GRID(x, y) &= ~EdgeRight; never executed (the execution status of this line is deduced): grid[(y)*(w+1) + (x)] &= ~EdgeRight; | - |
457 | ++x; never executed (the execution status of this line is deduced): ++x; | - |
458 | } | 0 |
459 | Q_ASSERT(x <= w); never executed (the execution status of this line is deduced): qt_noop(); | - |
460 | path->lineTo(x + x0, y + y0); never executed (the execution status of this line is deduced): path->lineTo(x + x0, y + y0); | - |
461 | continue; never executed: continue; | 0 |
462 | } | - |
463 | if (GRID(x, y) & EdgeDown) { never evaluated: grid[(y)*(w+1) + (x)] & EdgeDown | 0 |
464 | while (GRID(x, y) & EdgeDown) { never evaluated: grid[(y)*(w+1) + (x)] & EdgeDown | 0 |
465 | GRID(x, y) &= ~EdgeDown; never executed (the execution status of this line is deduced): grid[(y)*(w+1) + (x)] &= ~EdgeDown; | - |
466 | ++y; never executed (the execution status of this line is deduced): ++y; | - |
467 | } | 0 |
468 | Q_ASSERT(y <= h); never executed (the execution status of this line is deduced): qt_noop(); | - |
469 | path->lineTo(x + x0, y + y0); never executed (the execution status of this line is deduced): path->lineTo(x + x0, y + y0); | - |
470 | continue; never executed: continue; | 0 |
471 | } | - |
472 | if (GRID(x, y) & EdgeLeft) { never evaluated: grid[(y)*(w+1) + (x)] & EdgeLeft | 0 |
473 | while (GRID(x, y) & EdgeLeft) { never evaluated: grid[(y)*(w+1) + (x)] & EdgeLeft | 0 |
474 | GRID(x, y) &= ~EdgeLeft; never executed (the execution status of this line is deduced): grid[(y)*(w+1) + (x)] &= ~EdgeLeft; | - |
475 | --x; never executed (the execution status of this line is deduced): --x; | - |
476 | } | 0 |
477 | Q_ASSERT(x >= 0); never executed (the execution status of this line is deduced): qt_noop(); | - |
478 | path->lineTo(x + x0, y + y0); never executed (the execution status of this line is deduced): path->lineTo(x + x0, y + y0); | - |
479 | continue; never executed: continue; | 0 |
480 | } | - |
481 | if (GRID(x, y) & EdgeUp) { never evaluated: grid[(y)*(w+1) + (x)] & EdgeUp | 0 |
482 | while (GRID(x, y) & EdgeUp) { never evaluated: grid[(y)*(w+1) + (x)] & EdgeUp | 0 |
483 | GRID(x, y) &= ~EdgeUp; never executed (the execution status of this line is deduced): grid[(y)*(w+1) + (x)] &= ~EdgeUp; | - |
484 | --y; never executed (the execution status of this line is deduced): --y; | - |
485 | } | 0 |
486 | Q_ASSERT(y >= 0); never executed (the execution status of this line is deduced): qt_noop(); | - |
487 | path->lineTo(x + x0, y + y0); never executed (the execution status of this line is deduced): path->lineTo(x + x0, y + y0); | - |
488 | continue; never executed: continue; | 0 |
489 | } | - |
490 | } | 0 |
491 | path->closeSubpath(); never executed (the execution status of this line is deduced): path->closeSubpath(); | - |
492 | } | 0 |
493 | | - |
494 | Q_GUI_EXPORT void qt_addBitmapToPath(qreal x0, qreal y0, const uchar *image_data, int bpl, int w, int h, QPainterPath *path) | - |
495 | { | - |
496 | uint *grid = new uint[(w+1)*(h+1)]; never executed (the execution status of this line is deduced): uint *grid = new uint[(w+1)*(h+1)]; | - |
497 | // set up edges | - |
498 | for (int y = 0; y <= h; ++y) { | 0 |
499 | for (int x = 0; x <= w; ++x) { | 0 |
500 | bool topLeft = (x == 0)|(y == 0) ? false : SET(x - 1, y - 1); never evaluated: (x == 0)|(y == 0) | 0 |
501 | bool topRight = (x == w)|(y == 0) ? false : SET(x, y - 1); never evaluated: (x == w)|(y == 0) | 0 |
502 | bool bottomLeft = (x == 0)|(y == h) ? false : SET(x - 1, y); never evaluated: (x == 0)|(y == h) | 0 |
503 | bool bottomRight = (x == w)|(y == h) ? false : SET(x, y); never evaluated: (x == w)|(y == h) | 0 |
504 | | - |
505 | GRID(x, y) = 0; never executed (the execution status of this line is deduced): grid[(y)*(w+1) + (x)] = 0; | - |
506 | if ((!topRight) & bottomRight) never evaluated: (!topRight) & bottomRight | 0 |
507 | GRID(x, y) |= EdgeRight; never executed: grid[(y)*(w+1) + (x)] |= EdgeRight; | 0 |
508 | if ((!bottomRight) & bottomLeft) never evaluated: (!bottomRight) & bottomLeft | 0 |
509 | GRID(x, y) |= EdgeDown; never executed: grid[(y)*(w+1) + (x)] |= EdgeDown; | 0 |
510 | if ((!bottomLeft) & topLeft) never evaluated: (!bottomLeft) & topLeft | 0 |
511 | GRID(x, y) |= EdgeLeft; never executed: grid[(y)*(w+1) + (x)] |= EdgeLeft; | 0 |
512 | if ((!topLeft) & topRight) never evaluated: (!topLeft) & topRight | 0 |
513 | GRID(x, y) |= EdgeUp; never executed: grid[(y)*(w+1) + (x)] |= EdgeUp; | 0 |
514 | } | 0 |
515 | } | 0 |
516 | | - |
517 | // collect edges | - |
518 | for (int y = 0; y < h; ++y) { | 0 |
519 | for (int x = 0; x < w; ++x) { | 0 |
520 | if (!GRID(x, y)) never evaluated: !grid[(y)*(w+1) + (x)] | 0 |
521 | continue; never executed: continue; | 0 |
522 | // found start of a contour, follow it | - |
523 | collectSingleContour(x0, y0, grid, x, y, w, h, path); never executed (the execution status of this line is deduced): collectSingleContour(x0, y0, grid, x, y, w, h, path); | - |
524 | } | 0 |
525 | } | 0 |
526 | delete [] grid; never executed (the execution status of this line is deduced): delete [] grid; | - |
527 | } | 0 |
528 | | - |
529 | #undef GRID | - |
530 | #undef SET | - |
531 | | - |
532 | | - |
533 | void QFontEngine::addBitmapFontToPath(qreal x, qreal y, const QGlyphLayout &glyphs, | - |
534 | QPainterPath *path, QTextItem::RenderFlags flags) | - |
535 | { | - |
536 | // TODO what to do with 'flags' ?? | - |
537 | Q_UNUSED(flags); never executed (the execution status of this line is deduced): (void)flags;; | - |
538 | QFixed advanceX = QFixed::fromReal(x); never executed (the execution status of this line is deduced): QFixed advanceX = QFixed::fromReal(x); | - |
539 | QFixed advanceY = QFixed::fromReal(y); never executed (the execution status of this line is deduced): QFixed advanceY = QFixed::fromReal(y); | - |
540 | for (int i=0; i < glyphs.numGlyphs; ++i) { never evaluated: i < glyphs.numGlyphs | 0 |
541 | glyph_metrics_t metrics = boundingBox(glyphs.glyphs[i]); never executed (the execution status of this line is deduced): glyph_metrics_t metrics = boundingBox(glyphs.glyphs[i]); | - |
542 | if (metrics.width.value() == 0 || metrics.height.value() == 0) { never evaluated: metrics.width.value() == 0 never evaluated: metrics.height.value() == 0 | 0 |
543 | advanceX += glyphs.advances_x[i]; never executed (the execution status of this line is deduced): advanceX += glyphs.advances_x[i]; | - |
544 | advanceY += glyphs.advances_y[i]; never executed (the execution status of this line is deduced): advanceY += glyphs.advances_y[i]; | - |
545 | continue; never executed: continue; | 0 |
546 | } | - |
547 | const QImage alphaMask = alphaMapForGlyph(glyphs.glyphs[i]); never executed (the execution status of this line is deduced): const QImage alphaMask = alphaMapForGlyph(glyphs.glyphs[i]); | - |
548 | | - |
549 | const int w = alphaMask.width(); never executed (the execution status of this line is deduced): const int w = alphaMask.width(); | - |
550 | const int h = alphaMask.height(); never executed (the execution status of this line is deduced): const int h = alphaMask.height(); | - |
551 | const int srcBpl = alphaMask.bytesPerLine(); never executed (the execution status of this line is deduced): const int srcBpl = alphaMask.bytesPerLine(); | - |
552 | QImage bitmap; never executed (the execution status of this line is deduced): QImage bitmap; | - |
553 | if (alphaMask.depth() == 1) { never evaluated: alphaMask.depth() == 1 | 0 |
554 | bitmap = alphaMask; never executed (the execution status of this line is deduced): bitmap = alphaMask; | - |
555 | } else { | 0 |
556 | bitmap = QImage(w, h, QImage::Format_Mono); never executed (the execution status of this line is deduced): bitmap = QImage(w, h, QImage::Format_Mono); | - |
557 | const uchar *imageData = alphaMask.bits(); never executed (the execution status of this line is deduced): const uchar *imageData = alphaMask.bits(); | - |
558 | const int destBpl = bitmap.bytesPerLine(); never executed (the execution status of this line is deduced): const int destBpl = bitmap.bytesPerLine(); | - |
559 | uchar *bitmapData = bitmap.bits(); never executed (the execution status of this line is deduced): uchar *bitmapData = bitmap.bits(); | - |
560 | | - |
561 | for (int yi = 0; yi < h; ++yi) { | 0 |
562 | const uchar *src = imageData + yi*srcBpl; never executed (the execution status of this line is deduced): const uchar *src = imageData + yi*srcBpl; | - |
563 | uchar *dst = bitmapData + yi*destBpl; never executed (the execution status of this line is deduced): uchar *dst = bitmapData + yi*destBpl; | - |
564 | for (int xi = 0; xi < w; ++xi) { | 0 |
565 | const int byte = xi / 8; never executed (the execution status of this line is deduced): const int byte = xi / 8; | - |
566 | const int bit = xi % 8; never executed (the execution status of this line is deduced): const int bit = xi % 8; | - |
567 | if (bit == 0) never evaluated: bit == 0 | 0 |
568 | dst[byte] = 0; never executed: dst[byte] = 0; | 0 |
569 | if (src[xi]) | 0 |
570 | dst[byte] |= 128 >> bit; never executed: dst[byte] |= 128 >> bit; | 0 |
571 | } | 0 |
572 | } | 0 |
573 | } | 0 |
574 | const uchar *bitmap_data = bitmap.bits(); never executed (the execution status of this line is deduced): const uchar *bitmap_data = bitmap.bits(); | - |
575 | QFixedPoint offset = glyphs.offsets[i]; never executed (the execution status of this line is deduced): QFixedPoint offset = glyphs.offsets[i]; | - |
576 | advanceX += offset.x; never executed (the execution status of this line is deduced): advanceX += offset.x; | - |
577 | advanceY += offset.y; never executed (the execution status of this line is deduced): advanceY += offset.y; | - |
578 | qt_addBitmapToPath((advanceX + metrics.x).toReal(), (advanceY + metrics.y).toReal(), bitmap_data, bitmap.bytesPerLine(), w, h, path); never executed (the execution status of this line is deduced): qt_addBitmapToPath((advanceX + metrics.x).toReal(), (advanceY + metrics.y).toReal(), bitmap_data, bitmap.bytesPerLine(), w, h, path); | - |
579 | advanceX += glyphs.advances_x[i]; never executed (the execution status of this line is deduced): advanceX += glyphs.advances_x[i]; | - |
580 | advanceY += glyphs.advances_y[i]; never executed (the execution status of this line is deduced): advanceY += glyphs.advances_y[i]; | - |
581 | } | 0 |
582 | } | 0 |
583 | | - |
584 | void QFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nGlyphs, | - |
585 | QPainterPath *path, QTextItem::RenderFlags flags) | - |
586 | { | - |
587 | qreal x = positions[0].x.toReal(); never executed (the execution status of this line is deduced): qreal x = positions[0].x.toReal(); | - |
588 | qreal y = positions[0].y.toReal(); never executed (the execution status of this line is deduced): qreal y = positions[0].y.toReal(); | - |
589 | QVarLengthGlyphLayoutArray g(nGlyphs); never executed (the execution status of this line is deduced): QVarLengthGlyphLayoutArray g(nGlyphs); | - |
590 | | - |
591 | for (int i = 0; i < nGlyphs; ++i) { never evaluated: i < nGlyphs | 0 |
592 | g.glyphs[i] = glyphs[i]; never executed (the execution status of this line is deduced): g.glyphs[i] = glyphs[i]; | - |
593 | if (i < nGlyphs - 1) { never evaluated: i < nGlyphs - 1 | 0 |
594 | g.advances_x[i] = positions[i+1].x - positions[i].x; never executed (the execution status of this line is deduced): g.advances_x[i] = positions[i+1].x - positions[i].x; | - |
595 | g.advances_y[i] = positions[i+1].y - positions[i].y; never executed (the execution status of this line is deduced): g.advances_y[i] = positions[i+1].y - positions[i].y; | - |
596 | } else { | 0 |
597 | g.advances_x[i] = QFixed::fromReal(maxCharWidth()); never executed (the execution status of this line is deduced): g.advances_x[i] = QFixed::fromReal(maxCharWidth()); | - |
598 | g.advances_y[i] = 0; never executed (the execution status of this line is deduced): g.advances_y[i] = 0; | - |
599 | } | 0 |
600 | } | - |
601 | | - |
602 | addBitmapFontToPath(x, y, g, path, flags); never executed (the execution status of this line is deduced): addBitmapFontToPath(x, y, g, path, flags); | - |
603 | } | 0 |
604 | | - |
605 | QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/) | - |
606 | { | - |
607 | // For font engines don't support subpixel positioning | - |
608 | return alphaMapForGlyph(glyph); never executed: return alphaMapForGlyph(glyph); | 0 |
609 | } | - |
610 | | - |
611 | QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t) | - |
612 | { | - |
613 | QImage i = alphaMapForGlyph(glyph); executed (the execution status of this line is deduced): QImage i = alphaMapForGlyph(glyph); | - |
614 | if (t.type() > QTransform::TxTranslate) partially evaluated: t.type() > QTransform::TxTranslate no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
615 | i = i.transformed(t).convertToFormat(QImage::Format_Indexed8); never executed: i = i.transformed(t).convertToFormat(QImage::Format_Indexed8); | 0 |
616 | Q_ASSERT(i.depth() <= 8); // To verify that transformed didn't change the format... executed (the execution status of this line is deduced): qt_noop(); | - |
617 | | - |
618 | return i; executed: return i; Execution Count:2 | 2 |
619 | } | - |
620 | | - |
621 | QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) | - |
622 | { | - |
623 | if (! supportsSubPixelPositions()) partially evaluated: ! supportsSubPixelPositions() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
624 | return alphaMapForGlyph(glyph, t); executed: return alphaMapForGlyph(glyph, t); Execution Count:2 | 2 |
625 | | - |
626 | QImage i = alphaMapForGlyph(glyph, subPixelPosition); never executed (the execution status of this line is deduced): QImage i = alphaMapForGlyph(glyph, subPixelPosition); | - |
627 | if (t.type() > QTransform::TxTranslate) never evaluated: t.type() > QTransform::TxTranslate | 0 |
628 | i = i.transformed(t).convertToFormat(QImage::Format_Indexed8); never executed: i = i.transformed(t).convertToFormat(QImage::Format_Indexed8); | 0 |
629 | Q_ASSERT(i.depth() <= 8); // To verify that transformed didn't change the format... never executed (the execution status of this line is deduced): qt_noop(); | - |
630 | | - |
631 | return i; never executed: return i; | 0 |
632 | } | - |
633 | | - |
634 | QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/, const QTransform &t) | - |
635 | { | - |
636 | QImage alphaMask = alphaMapForGlyph(glyph, t); never executed (the execution status of this line is deduced): QImage alphaMask = alphaMapForGlyph(glyph, t); | - |
637 | QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32); never executed (the execution status of this line is deduced): QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32); | - |
638 | | - |
639 | QVector<QRgb> colorTable = alphaMask.colorTable(); never executed (the execution status of this line is deduced): QVector<QRgb> colorTable = alphaMask.colorTable(); | - |
640 | for (int y=0; y<alphaMask.height(); ++y) { never evaluated: y<alphaMask.height() | 0 |
641 | uint *dst = (uint *) rgbMask.scanLine(y); never executed (the execution status of this line is deduced): uint *dst = (uint *) rgbMask.scanLine(y); | - |
642 | uchar *src = (uchar *) alphaMask.scanLine(y); never executed (the execution status of this line is deduced): uchar *src = (uchar *) alphaMask.scanLine(y); | - |
643 | for (int x=0; x<alphaMask.width(); ++x) { never evaluated: x<alphaMask.width() | 0 |
644 | int val = qAlpha(colorTable.at(src[x])); never executed (the execution status of this line is deduced): int val = qAlpha(colorTable.at(src[x])); | - |
645 | dst[x] = qRgb(val, val, val); never executed (the execution status of this line is deduced): dst[x] = qRgb(val, val, val); | - |
646 | } | 0 |
647 | } | 0 |
648 | | - |
649 | return rgbMask; never executed: return rgbMask; | 0 |
650 | } | - |
651 | | - |
652 | QFixed QFontEngine::subPixelPositionForX(QFixed x) const | - |
653 | { | - |
654 | if (m_subPixelPositionCount <= 1 || !supportsSubPixelPositions()) evaluated: m_subPixelPositionCount <= 1 yes Evaluation Count:24 | yes Evaluation Count:145074 |
partially evaluated: !supportsSubPixelPositions() yes Evaluation Count:145074 | no Evaluation Count:0 |
| 0-145074 |
655 | return QFixed(); executed: return QFixed(); Execution Count:145098 | 145098 |
656 | | - |
657 | QFixed subPixelPosition; never executed (the execution status of this line is deduced): QFixed subPixelPosition; | - |
658 | if (x != 0) { | 0 |
659 | subPixelPosition = x - x.floor(); never executed (the execution status of this line is deduced): subPixelPosition = x - x.floor(); | - |
660 | QFixed fraction = (subPixelPosition / QFixed::fromReal(1.0 / m_subPixelPositionCount)).floor(); never executed (the execution status of this line is deduced): QFixed fraction = (subPixelPosition / QFixed::fromReal(1.0 / m_subPixelPositionCount)).floor(); | - |
661 | | - |
662 | // Compensate for precision loss in fixed point to make sure we are always drawing at a subpixel position over | - |
663 | // the lower boundary for the selected rasterization by adding 1/64. | - |
664 | subPixelPosition = fraction / QFixed(m_subPixelPositionCount) + QFixed::fromReal(0.015625); never executed (the execution status of this line is deduced): subPixelPosition = fraction / QFixed(m_subPixelPositionCount) + QFixed::fromReal(0.015625); | - |
665 | } | 0 |
666 | return subPixelPosition; never executed: return subPixelPosition; | 0 |
667 | } | - |
668 | | - |
669 | QImage *QFontEngine::lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, | - |
670 | QFontEngine::GlyphFormat neededFormat, | - |
671 | const QTransform &t, QPoint *offset) | - |
672 | { | - |
673 | Q_ASSERT(currentlyLockedAlphaMap.isNull()); executed (the execution status of this line is deduced): qt_noop(); | - |
674 | if (neededFormat == Format_None) partially evaluated: neededFormat == Format_None no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
675 | neededFormat = Format_A32; never executed: neededFormat = Format_A32; | 0 |
676 | | - |
677 | if (neededFormat != Format_A32) partially evaluated: neededFormat != Format_A32 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
678 | currentlyLockedAlphaMap = alphaMapForGlyph(glyph, subPixelPosition, t); executed: currentlyLockedAlphaMap = alphaMapForGlyph(glyph, subPixelPosition, t); Execution Count:1 | 1 |
679 | else | - |
680 | currentlyLockedAlphaMap = alphaRGBMapForGlyph(glyph, subPixelPosition, t); never executed: currentlyLockedAlphaMap = alphaRGBMapForGlyph(glyph, subPixelPosition, t); | 0 |
681 | | - |
682 | if (offset != 0) partially evaluated: offset != 0 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
683 | *offset = QPoint(0, 0); executed: *offset = QPoint(0, 0); Execution Count:1 | 1 |
684 | | - |
685 | return ¤tlyLockedAlphaMap; executed: return ¤tlyLockedAlphaMap; Execution Count:1 | 1 |
686 | } | - |
687 | | - |
688 | void QFontEngine::unlockAlphaMapForGlyph() | - |
689 | { | - |
690 | Q_ASSERT(!currentlyLockedAlphaMap.isNull()); never executed (the execution status of this line is deduced): qt_noop(); | - |
691 | currentlyLockedAlphaMap = QImage(); never executed (the execution status of this line is deduced): currentlyLockedAlphaMap = QImage(); | - |
692 | } | 0 |
693 | | - |
694 | QImage QFontEngine::alphaMapForGlyph(glyph_t glyph) | - |
695 | { | - |
696 | glyph_metrics_t gm = boundingBox(glyph); executed (the execution status of this line is deduced): glyph_metrics_t gm = boundingBox(glyph); | - |
697 | int glyph_x = qFloor(gm.x.toReal()); executed (the execution status of this line is deduced): int glyph_x = qFloor(gm.x.toReal()); | - |
698 | int glyph_y = qFloor(gm.y.toReal()); executed (the execution status of this line is deduced): int glyph_y = qFloor(gm.y.toReal()); | - |
699 | int glyph_width = qCeil((gm.x + gm.width).toReal()) - glyph_x; executed (the execution status of this line is deduced): int glyph_width = qCeil((gm.x + gm.width).toReal()) - glyph_x; | - |
700 | int glyph_height = qCeil((gm.y + gm.height).toReal()) - glyph_y; executed (the execution status of this line is deduced): int glyph_height = qCeil((gm.y + gm.height).toReal()) - glyph_y; | - |
701 | | - |
702 | if (glyph_width <= 0 || glyph_height <= 0) partially evaluated: glyph_width <= 0 yes Evaluation Count:1 | no Evaluation Count:0 |
never evaluated: glyph_height <= 0 | 0-1 |
703 | return QImage(); executed: return QImage(); Execution Count:1 | 1 |
704 | QFixedPoint pt; never executed (the execution status of this line is deduced): QFixedPoint pt; | - |
705 | pt.x = -glyph_x; never executed (the execution status of this line is deduced): pt.x = -glyph_x; | - |
706 | pt.y = -glyph_y; // the baseline never executed (the execution status of this line is deduced): pt.y = -glyph_y; | - |
707 | QPainterPath path; never executed (the execution status of this line is deduced): QPainterPath path; | - |
708 | QImage im(glyph_width + 4, glyph_height, QImage::Format_ARGB32_Premultiplied); never executed (the execution status of this line is deduced): QImage im(glyph_width + 4, glyph_height, QImage::Format_ARGB32_Premultiplied); | - |
709 | im.fill(Qt::transparent); never executed (the execution status of this line is deduced): im.fill(Qt::transparent); | - |
710 | QPainter p(&im); never executed (the execution status of this line is deduced): QPainter p(&im); | - |
711 | p.setRenderHint(QPainter::Antialiasing); never executed (the execution status of this line is deduced): p.setRenderHint(QPainter::Antialiasing); | - |
712 | addGlyphsToPath(&glyph, &pt, 1, &path, 0); never executed (the execution status of this line is deduced): addGlyphsToPath(&glyph, &pt, 1, &path, 0); | - |
713 | p.setPen(Qt::NoPen); never executed (the execution status of this line is deduced): p.setPen(Qt::NoPen); | - |
714 | p.setBrush(Qt::black); never executed (the execution status of this line is deduced): p.setBrush(Qt::black); | - |
715 | p.drawPath(path); never executed (the execution status of this line is deduced): p.drawPath(path); | - |
716 | p.end(); never executed (the execution status of this line is deduced): p.end(); | - |
717 | | - |
718 | QImage indexed(im.width(), im.height(), QImage::Format_Indexed8); never executed (the execution status of this line is deduced): QImage indexed(im.width(), im.height(), QImage::Format_Indexed8); | - |
719 | QVector<QRgb> colors(256); never executed (the execution status of this line is deduced): QVector<QRgb> colors(256); | - |
720 | for (int i=0; i<256; ++i) | 0 |
721 | colors[i] = qRgba(0, 0, 0, i); never executed: colors[i] = qRgba(0, 0, 0, i); | 0 |
722 | indexed.setColorTable(colors); never executed (the execution status of this line is deduced): indexed.setColorTable(colors); | - |
723 | | - |
724 | for (int y=0; y<im.height(); ++y) { never evaluated: y<im.height() | 0 |
725 | uchar *dst = (uchar *) indexed.scanLine(y); never executed (the execution status of this line is deduced): uchar *dst = (uchar *) indexed.scanLine(y); | - |
726 | uint *src = (uint *) im.scanLine(y); never executed (the execution status of this line is deduced): uint *src = (uint *) im.scanLine(y); | - |
727 | for (int x=0; x<im.width(); ++x) never evaluated: x<im.width() | 0 |
728 | dst[x] = qAlpha(src[x]); never executed: dst[x] = qAlpha(src[x]); | 0 |
729 | } | 0 |
730 | | - |
731 | return indexed; never executed: return indexed; | 0 |
732 | } | - |
733 | | - |
734 | void QFontEngine::removeGlyphFromCache(glyph_t) | - |
735 | { | - |
736 | } | - |
737 | | - |
738 | QFontEngine::Properties QFontEngine::properties() const | - |
739 | { | - |
740 | Properties p; never executed (the execution status of this line is deduced): Properties p; | - |
741 | QByteArray psname = QFontEngine::convertToPostscriptFontFamilyName(fontDef.family.toUtf8()); never executed (the execution status of this line is deduced): QByteArray psname = QFontEngine::convertToPostscriptFontFamilyName(fontDef.family.toUtf8()); | - |
742 | psname += '-'; never executed (the execution status of this line is deduced): psname += '-'; | - |
743 | psname += QByteArray::number(fontDef.style); never executed (the execution status of this line is deduced): psname += QByteArray::number(fontDef.style); | - |
744 | psname += '-'; never executed (the execution status of this line is deduced): psname += '-'; | - |
745 | psname += QByteArray::number(fontDef.weight); never executed (the execution status of this line is deduced): psname += QByteArray::number(fontDef.weight); | - |
746 | | - |
747 | p.postscriptName = psname; never executed (the execution status of this line is deduced): p.postscriptName = psname; | - |
748 | p.ascent = ascent(); never executed (the execution status of this line is deduced): p.ascent = ascent(); | - |
749 | p.descent = descent(); never executed (the execution status of this line is deduced): p.descent = descent(); | - |
750 | p.leading = leading(); never executed (the execution status of this line is deduced): p.leading = leading(); | - |
751 | p.emSquare = p.ascent; never executed (the execution status of this line is deduced): p.emSquare = p.ascent; | - |
752 | p.boundingBox = QRectF(0, -p.ascent.toReal(), maxCharWidth(), (p.ascent + p.descent).toReal()); never executed (the execution status of this line is deduced): p.boundingBox = QRectF(0, -p.ascent.toReal(), maxCharWidth(), (p.ascent + p.descent).toReal()); | - |
753 | p.italicAngle = 0; never executed (the execution status of this line is deduced): p.italicAngle = 0; | - |
754 | p.capHeight = p.ascent; never executed (the execution status of this line is deduced): p.capHeight = p.ascent; | - |
755 | p.lineWidth = lineThickness(); never executed (the execution status of this line is deduced): p.lineWidth = lineThickness(); | - |
756 | return p; never executed: return p; | 0 |
757 | } | - |
758 | | - |
759 | void QFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) | - |
760 | { | - |
761 | *metrics = boundingBox(glyph); never executed (the execution status of this line is deduced): *metrics = boundingBox(glyph); | - |
762 | QFixedPoint p; never executed (the execution status of this line is deduced): QFixedPoint p; | - |
763 | p.x = 0; never executed (the execution status of this line is deduced): p.x = 0; | - |
764 | p.y = 0; never executed (the execution status of this line is deduced): p.y = 0; | - |
765 | addGlyphsToPath(&glyph, &p, 1, path, QFlag(0)); never executed (the execution status of this line is deduced): addGlyphsToPath(&glyph, &p, 1, path, QFlag(0)); | - |
766 | } | 0 |
767 | | - |
768 | QByteArray QFontEngine::getSfntTable(uint tag) const | - |
769 | { | - |
770 | QByteArray table; executed (the execution status of this line is deduced): QByteArray table; | - |
771 | uint len = 0; executed (the execution status of this line is deduced): uint len = 0; | - |
772 | if (!getSfntTableData(tag, 0, &len)) evaluated: !getSfntTableData(tag, 0, &len) yes Evaluation Count:87 | yes Evaluation Count:139 |
| 87-139 |
773 | return table; executed: return table; Execution Count:87 | 87 |
774 | if (!len) partially evaluated: !len no Evaluation Count:0 | yes Evaluation Count:139 |
| 0-139 |
775 | return table; never executed: return table; | 0 |
776 | table.resize(len); executed (the execution status of this line is deduced): table.resize(len); | - |
777 | if (!getSfntTableData(tag, reinterpret_cast<uchar *>(table.data()), &len)) partially evaluated: !getSfntTableData(tag, reinterpret_cast<uchar *>(table.data()), &len) no Evaluation Count:0 | yes Evaluation Count:139 |
| 0-139 |
778 | return QByteArray(); never executed: return QByteArray(); | 0 |
779 | return table; executed: return table; Execution Count:139 | 139 |
780 | } | - |
781 | | - |
782 | void QFontEngine::setGlyphCache(const void *key, QFontEngineGlyphCache *data) | - |
783 | { | - |
784 | Q_ASSERT(data); executed (the execution status of this line is deduced): qt_noop(); | - |
785 | | - |
786 | GlyphCacheEntry entry; executed (the execution status of this line is deduced): GlyphCacheEntry entry; | - |
787 | entry.context = key; executed (the execution status of this line is deduced): entry.context = key; | - |
788 | entry.cache = data; executed (the execution status of this line is deduced): entry.cache = data; | - |
789 | if (m_glyphCaches.contains(entry)) partially evaluated: m_glyphCaches.contains(entry) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
790 | return; | 0 |
791 | | - |
792 | // Limit the glyph caches to 4. This covers all 90 degree rotations and limits | - |
793 | // memory use when there is continuous or random rotation | - |
794 | if (m_glyphCaches.size() == 4) partially evaluated: m_glyphCaches.size() == 4 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
795 | m_glyphCaches.removeLast(); never executed: m_glyphCaches.removeLast(); | 0 |
796 | | - |
797 | m_glyphCaches.push_front(entry); executed (the execution status of this line is deduced): m_glyphCaches.push_front(entry); | - |
798 | | - |
799 | } executed: } Execution Count:1 | 1 |
800 | | - |
801 | QFontEngineGlyphCache *QFontEngine::glyphCache(const void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const | - |
802 | { | - |
803 | for (QLinkedList<GlyphCacheEntry>::const_iterator it = m_glyphCaches.constBegin(), end = m_glyphCaches.constEnd(); it != end; ++it) { evaluated: it != end yes Evaluation Count:7 | yes Evaluation Count:1 |
| 1-7 |
804 | QFontEngineGlyphCache *c = it->cache.data(); executed (the execution status of this line is deduced): QFontEngineGlyphCache *c = it->cache.data(); | - |
805 | if (key == it->context partially evaluated: key == it->context yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
806 | && type == c->cacheType() partially evaluated: type == c->cacheType() yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
807 | && qtransform_equals_no_translate(c->m_transform, transform)) { partially evaluated: qtransform_equals_no_translate(c->m_transform, transform) yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
808 | return c; executed: return c; Execution Count:7 | 7 |
809 | } | - |
810 | } | 0 |
811 | return 0; executed: return 0; Execution Count:1 | 1 |
812 | } | - |
813 | | - |
814 | static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs) | - |
815 | { | - |
816 | uint left_right = (left << 16) + right; executed (the execution status of this line is deduced): uint left_right = (left << 16) + right; | - |
817 | | - |
818 | left = 0, right = numPairs - 1; executed (the execution status of this line is deduced): left = 0, right = numPairs - 1; | - |
819 | while (left <= right) { evaluated: left <= right yes Evaluation Count:5132140 | yes Evaluation Count:444374 |
| 444374-5132140 |
820 | int middle = left + ( ( right - left ) >> 1 ); executed (the execution status of this line is deduced): int middle = left + ( ( right - left ) >> 1 ); | - |
821 | | - |
822 | if(pairs[middle].left_right == left_right) partially evaluated: pairs[middle].left_right == left_right no Evaluation Count:0 | yes Evaluation Count:5132140 |
| 0-5132140 |
823 | return pairs[middle].adjust; never executed: return pairs[middle].adjust; | 0 |
824 | | - |
825 | if (pairs[middle].left_right < left_right) evaluated: pairs[middle].left_right < left_right yes Evaluation Count:2076073 | yes Evaluation Count:3056067 |
| 2076073-3056067 |
826 | left = middle + 1; executed: left = middle + 1; Execution Count:2076073 | 2076073 |
827 | else | - |
828 | right = middle - 1; executed: right = middle - 1; Execution Count:3056067 | 3056067 |
829 | } | - |
830 | return 0; executed: return 0; Execution Count:444374 | 444374 |
831 | } | - |
832 | | - |
833 | void QFontEngine::doKerning(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const | - |
834 | { | - |
835 | int numPairs = kerning_pairs.size(); executed (the execution status of this line is deduced): int numPairs = kerning_pairs.size(); | - |
836 | if(!numPairs) evaluated: !numPairs yes Evaluation Count:341 | yes Evaluation Count:162481 |
| 341-162481 |
837 | return; executed: return; Execution Count:341 | 341 |
838 | | - |
839 | const KernPair *pairs = kerning_pairs.constData(); executed (the execution status of this line is deduced): const KernPair *pairs = kerning_pairs.constData(); | - |
840 | | - |
841 | if (flags & DesignMetrics) { partially evaluated: flags & DesignMetrics no Evaluation Count:0 | yes Evaluation Count:162481 |
| 0-162481 |
842 | for(int i = 0; i < glyphs->numGlyphs - 1; ++i) never evaluated: i < glyphs->numGlyphs - 1 | 0 |
843 | glyphs->advances_x[i] += kerning(glyphs->glyphs[i], glyphs->glyphs[i+1] , pairs, numPairs); never executed: glyphs->advances_x[i] += kerning(glyphs->glyphs[i], glyphs->glyphs[i+1] , pairs, numPairs); | 0 |
844 | } else { | 0 |
845 | for(int i = 0; i < glyphs->numGlyphs - 1; ++i) evaluated: i < glyphs->numGlyphs - 1 yes Evaluation Count:444374 | yes Evaluation Count:162481 |
| 162481-444374 |
846 | glyphs->advances_x[i] += qRound(kerning(glyphs->glyphs[i], glyphs->glyphs[i+1] , pairs, numPairs)); executed: glyphs->advances_x[i] += qRound(kerning(glyphs->glyphs[i], glyphs->glyphs[i+1] , pairs, numPairs)); Execution Count:444374 | 444374 |
847 | } executed: } Execution Count:162481 | 162481 |
848 | } | - |
849 | | - |
850 | void QFontEngine::loadKerningPairs(QFixed scalingFactor) | - |
851 | { | - |
852 | kerning_pairs.clear(); executed (the execution status of this line is deduced): kerning_pairs.clear(); | - |
853 | | - |
854 | QByteArray tab = getSfntTable(MAKE_TAG('k', 'e', 'r', 'n')); executed (the execution status of this line is deduced): QByteArray tab = getSfntTable(( (((quint32)('k')) << 24) | (((quint32)('e')) << 16) | (((quint32)('r')) << 8) | ((quint32)('n')) )); | - |
855 | if (tab.isEmpty()) evaluated: tab.isEmpty() yes Evaluation Count:87 | yes Evaluation Count:95 |
| 87-95 |
856 | return; executed: return; Execution Count:87 | 87 |
857 | | - |
858 | const uchar *table = reinterpret_cast<const uchar *>(tab.constData()); executed (the execution status of this line is deduced): const uchar *table = reinterpret_cast<const uchar *>(tab.constData()); | - |
859 | | - |
860 | unsigned short version = qFromBigEndian<quint16>(table); executed (the execution status of this line is deduced): unsigned short version = qFromBigEndian<quint16>(table); | - |
861 | if (version != 0) { partially evaluated: version != 0 no Evaluation Count:0 | yes Evaluation Count:95 |
| 0-95 |
862 | // qDebug("wrong version"); | - |
863 | return; | 0 |
864 | } | - |
865 | | - |
866 | unsigned short numTables = qFromBigEndian<quint16>(table + 2); executed (the execution status of this line is deduced): unsigned short numTables = qFromBigEndian<quint16>(table + 2); | - |
867 | { | - |
868 | int offset = 4; executed (the execution status of this line is deduced): int offset = 4; | - |
869 | for(int i = 0; i < numTables; ++i) { evaluated: i < numTables yes Evaluation Count:95 | yes Evaluation Count:95 |
| 95 |
870 | if (offset + 6 > tab.size()) { partially evaluated: offset + 6 > tab.size() no Evaluation Count:0 | yes Evaluation Count:95 |
| 0-95 |
871 | // qDebug("offset out of bounds"); | - |
872 | goto end; never executed: goto end; | 0 |
873 | } | - |
874 | const uchar *header = table + offset; executed (the execution status of this line is deduced): const uchar *header = table + offset; | - |
875 | | - |
876 | ushort version = qFromBigEndian<quint16>(header); executed (the execution status of this line is deduced): ushort version = qFromBigEndian<quint16>(header); | - |
877 | ushort length = qFromBigEndian<quint16>(header+2); executed (the execution status of this line is deduced): ushort length = qFromBigEndian<quint16>(header+2); | - |
878 | ushort coverage = qFromBigEndian<quint16>(header+4); executed (the execution status of this line is deduced): ushort coverage = qFromBigEndian<quint16>(header+4); | - |
879 | // qDebug("subtable: version=%d, coverage=%x",version, coverage); | - |
880 | if(version == 0 && coverage == 0x0001) { partially evaluated: version == 0 yes Evaluation Count:95 | no Evaluation Count:0 |
partially evaluated: coverage == 0x0001 yes Evaluation Count:95 | no Evaluation Count:0 |
| 0-95 |
881 | if (offset + length > tab.size()) { partially evaluated: offset + length > tab.size() no Evaluation Count:0 | yes Evaluation Count:95 |
| 0-95 |
882 | // qDebug("length ouf ot bounds"); | - |
883 | goto end; never executed: goto end; | 0 |
884 | } | - |
885 | const uchar *data = table + offset + 6; executed (the execution status of this line is deduced): const uchar *data = table + offset + 6; | - |
886 | | - |
887 | ushort nPairs = qFromBigEndian<quint16>(data); executed (the execution status of this line is deduced): ushort nPairs = qFromBigEndian<quint16>(data); | - |
888 | if(nPairs * 6 + 8 > length - 6) { partially evaluated: nPairs * 6 + 8 > length - 6 no Evaluation Count:0 | yes Evaluation Count:95 |
| 0-95 |
889 | // qDebug("corrupt table!"); | - |
890 | // corrupt table | - |
891 | goto end; never executed: goto end; | 0 |
892 | } | - |
893 | | - |
894 | int off = 8; executed (the execution status of this line is deduced): int off = 8; | - |
895 | for(int i = 0; i < nPairs; ++i) { evaluated: i < nPairs yes Evaluation Count:218475 | yes Evaluation Count:95 |
| 95-218475 |
896 | QFontEngine::KernPair p; executed (the execution status of this line is deduced): QFontEngine::KernPair p; | - |
897 | p.left_right = (((uint)qFromBigEndian<quint16>(data+off)) << 16) + qFromBigEndian<quint16>(data+off+2); executed (the execution status of this line is deduced): p.left_right = (((uint)qFromBigEndian<quint16>(data+off)) << 16) + qFromBigEndian<quint16>(data+off+2); | - |
898 | p.adjust = QFixed(((int)(short)qFromBigEndian<quint16>(data+off+4))) / scalingFactor; executed (the execution status of this line is deduced): p.adjust = QFixed(((int)(short)qFromBigEndian<quint16>(data+off+4))) / scalingFactor; | - |
899 | kerning_pairs.append(p); executed (the execution status of this line is deduced): kerning_pairs.append(p); | - |
900 | off += 6; executed (the execution status of this line is deduced): off += 6; | - |
901 | } executed: } Execution Count:218475 | 218475 |
902 | } executed: } Execution Count:95 | 95 |
903 | offset += length; executed (the execution status of this line is deduced): offset += length; | - |
904 | } executed: } Execution Count:95 | 95 |
905 | } | - |
906 | end: code before this statement executed: end: Execution Count:95 | 95 |
907 | qSort(kerning_pairs); executed (the execution status of this line is deduced): qSort(kerning_pairs); | - |
908 | // for (int i = 0; i < kerning_pairs.count(); ++i) | - |
909 | // qDebug() << 'i' << i << "left_right" << hex << kerning_pairs.at(i).left_right; | - |
910 | } executed: } Execution Count:95 | 95 |
911 | | - |
912 | | - |
913 | int QFontEngine::glyphCount() const | - |
914 | { | - |
915 | QByteArray maxpTable = getSfntTable(MAKE_TAG('m', 'a', 'x', 'p')); never executed (the execution status of this line is deduced): QByteArray maxpTable = getSfntTable(( (((quint32)('m')) << 24) | (((quint32)('a')) << 16) | (((quint32)('x')) << 8) | ((quint32)('p')) )); | - |
916 | if (maxpTable.size() < 6) never evaluated: maxpTable.size() < 6 | 0 |
917 | return 0; never executed: return 0; | 0 |
918 | return qFromBigEndian<quint16>(reinterpret_cast<const uchar *>(maxpTable.constData() + 4)); never executed: return qFromBigEndian<quint16>(reinterpret_cast<const uchar *>(maxpTable.constData() + 4)); | 0 |
919 | } | - |
920 | | - |
921 | const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize) | - |
922 | { | - |
923 | const uchar *header = table; never executed (the execution status of this line is deduced): const uchar *header = table; | - |
924 | if (tableSize < 4) never evaluated: tableSize < 4 | 0 |
925 | return 0; never executed: return 0; | 0 |
926 | | - |
927 | const uchar *endPtr = table + tableSize; never executed (the execution status of this line is deduced): const uchar *endPtr = table + tableSize; | - |
928 | | - |
929 | // version check | - |
930 | if (qFromBigEndian<quint16>(header) != 0) never evaluated: qFromBigEndian<quint16>(header) != 0 | 0 |
931 | return 0; never executed: return 0; | 0 |
932 | | - |
933 | unsigned short numTables = qFromBigEndian<quint16>(header + 2); never executed (the execution status of this line is deduced): unsigned short numTables = qFromBigEndian<quint16>(header + 2); | - |
934 | const uchar *maps = table + 4; never executed (the execution status of this line is deduced): const uchar *maps = table + 4; | - |
935 | if (maps + 8 * numTables > endPtr) never evaluated: maps + 8 * numTables > endPtr | 0 |
936 | return 0; never executed: return 0; | 0 |
937 | | - |
938 | enum { never executed (the execution status of this line is deduced): enum { | - |
939 | Invalid, never executed (the execution status of this line is deduced): Invalid, | - |
940 | AppleRoman, never executed (the execution status of this line is deduced): AppleRoman, | - |
941 | Symbol, never executed (the execution status of this line is deduced): Symbol, | - |
942 | Unicode11, never executed (the execution status of this line is deduced): Unicode11, | - |
943 | Unicode, never executed (the execution status of this line is deduced): Unicode, | - |
944 | MicrosoftUnicode, never executed (the execution status of this line is deduced): MicrosoftUnicode, | - |
945 | MicrosoftUnicodeExtended never executed (the execution status of this line is deduced): MicrosoftUnicodeExtended | - |
946 | }; never executed (the execution status of this line is deduced): }; | - |
947 | | - |
948 | int symbolTable = -1; never executed (the execution status of this line is deduced): int symbolTable = -1; | - |
949 | int tableToUse = -1; never executed (the execution status of this line is deduced): int tableToUse = -1; | - |
950 | int score = Invalid; never executed (the execution status of this line is deduced): int score = Invalid; | - |
951 | for (int n = 0; n < numTables; ++n) { never evaluated: n < numTables | 0 |
952 | const quint16 platformId = qFromBigEndian<quint16>(maps + 8 * n); never executed (the execution status of this line is deduced): const quint16 platformId = qFromBigEndian<quint16>(maps + 8 * n); | - |
953 | const quint16 platformSpecificId = qFromBigEndian<quint16>(maps + 8 * n + 2); never executed (the execution status of this line is deduced): const quint16 platformSpecificId = qFromBigEndian<quint16>(maps + 8 * n + 2); | - |
954 | switch (platformId) { | - |
955 | case 0: // Unicode | - |
956 | if (score < Unicode && never evaluated: score < Unicode | 0 |
957 | (platformSpecificId == 0 || never evaluated: platformSpecificId == 0 | 0 |
958 | platformSpecificId == 2 || never evaluated: platformSpecificId == 2 | 0 |
959 | platformSpecificId == 3)) { never evaluated: platformSpecificId == 3 | 0 |
960 | tableToUse = n; never executed (the execution status of this line is deduced): tableToUse = n; | - |
961 | score = Unicode; never executed (the execution status of this line is deduced): score = Unicode; | - |
962 | } else if (score < Unicode11 && platformSpecificId == 1) { never executed: } never evaluated: score < Unicode11 never evaluated: platformSpecificId == 1 | 0 |
963 | tableToUse = n; never executed (the execution status of this line is deduced): tableToUse = n; | - |
964 | score = Unicode11; never executed (the execution status of this line is deduced): score = Unicode11; | - |
965 | } | 0 |
966 | break; | 0 |
967 | case 1: // Apple | - |
968 | if (score < AppleRoman && platformSpecificId == 0) { // Apple Roman never evaluated: score < AppleRoman never evaluated: platformSpecificId == 0 | 0 |
969 | tableToUse = n; never executed (the execution status of this line is deduced): tableToUse = n; | - |
970 | score = AppleRoman; never executed (the execution status of this line is deduced): score = AppleRoman; | - |
971 | } | 0 |
972 | break; | 0 |
973 | case 3: // Microsoft | - |
974 | switch (platformSpecificId) { | - |
975 | case 0: | - |
976 | symbolTable = n; never executed (the execution status of this line is deduced): symbolTable = n; | - |
977 | if (score < Symbol) { never evaluated: score < Symbol | 0 |
978 | tableToUse = n; never executed (the execution status of this line is deduced): tableToUse = n; | - |
979 | score = Symbol; never executed (the execution status of this line is deduced): score = Symbol; | - |
980 | } | 0 |
981 | break; | 0 |
982 | case 1: | - |
983 | if (score < MicrosoftUnicode) { never evaluated: score < MicrosoftUnicode | 0 |
984 | tableToUse = n; never executed (the execution status of this line is deduced): tableToUse = n; | - |
985 | score = MicrosoftUnicode; never executed (the execution status of this line is deduced): score = MicrosoftUnicode; | - |
986 | } | 0 |
987 | break; | 0 |
988 | case 0xa: | - |
989 | if (score < MicrosoftUnicodeExtended) { never evaluated: score < MicrosoftUnicodeExtended | 0 |
990 | tableToUse = n; never executed (the execution status of this line is deduced): tableToUse = n; | - |
991 | score = MicrosoftUnicodeExtended; never executed (the execution status of this line is deduced): score = MicrosoftUnicodeExtended; | - |
992 | } | 0 |
993 | break; | 0 |
994 | default: | - |
995 | break; | 0 |
996 | } | - |
997 | default: | - |
998 | break; | 0 |
999 | } | - |
1000 | } | 0 |
1001 | if(tableToUse < 0) never evaluated: tableToUse < 0 | 0 |
1002 | return 0; never executed: return 0; | 0 |
1003 | | - |
1004 | resolveTable: code before this statement never executed: resolveTable: | 0 |
1005 | *isSymbolFont = (symbolTable > -1); never executed (the execution status of this line is deduced): *isSymbolFont = (symbolTable > -1); | - |
1006 | | - |
1007 | unsigned int unicode_table = qFromBigEndian<quint32>(maps + 8*tableToUse + 4); never executed (the execution status of this line is deduced): unsigned int unicode_table = qFromBigEndian<quint32>(maps + 8*tableToUse + 4); | - |
1008 | | - |
1009 | if (!unicode_table || unicode_table + 8 > tableSize) never evaluated: !unicode_table never evaluated: unicode_table + 8 > tableSize | 0 |
1010 | return 0; never executed: return 0; | 0 |
1011 | | - |
1012 | // get the header of the unicode table | - |
1013 | header = table + unicode_table; never executed (the execution status of this line is deduced): header = table + unicode_table; | - |
1014 | | - |
1015 | unsigned short format = qFromBigEndian<quint16>(header); never executed (the execution status of this line is deduced): unsigned short format = qFromBigEndian<quint16>(header); | - |
1016 | unsigned int length; never executed (the execution status of this line is deduced): unsigned int length; | - |
1017 | if(format < 8) never evaluated: format < 8 | 0 |
1018 | length = qFromBigEndian<quint16>(header + 2); never executed: length = qFromBigEndian<quint16>(header + 2); | 0 |
1019 | else | - |
1020 | length = qFromBigEndian<quint32>(header + 4); never executed: length = qFromBigEndian<quint32>(header + 4); | 0 |
1021 | | - |
1022 | if (table + unicode_table + length > endPtr) never evaluated: table + unicode_table + length > endPtr | 0 |
1023 | return 0; never executed: return 0; | 0 |
1024 | *cmapSize = length; never executed (the execution status of this line is deduced): *cmapSize = length; | - |
1025 | | - |
1026 | // To support symbol fonts that contain a unicode table for the symbol area | - |
1027 | // we check the cmap tables and fall back to symbol font unless that would | - |
1028 | // involve losing information from the unicode table | - |
1029 | if (symbolTable > -1 && ((score == Unicode) || (score == Unicode11))) { never evaluated: symbolTable > -1 never evaluated: (score == Unicode) never evaluated: (score == Unicode11) | 0 |
1030 | const uchar *selectedTable = table + unicode_table; never executed (the execution status of this line is deduced): const uchar *selectedTable = table + unicode_table; | - |
1031 | | - |
1032 | // Check that none of the latin1 range are in the unicode table | - |
1033 | bool unicodeTableHasLatin1 = false; never executed (the execution status of this line is deduced): bool unicodeTableHasLatin1 = false; | - |
1034 | for (int uc=0x00; uc<0x100; ++uc) { never evaluated: uc<0x100 | 0 |
1035 | if (getTrueTypeGlyphIndex(selectedTable, uc) != 0) { never evaluated: getTrueTypeGlyphIndex(selectedTable, uc) != 0 | 0 |
1036 | unicodeTableHasLatin1 = true; never executed (the execution status of this line is deduced): unicodeTableHasLatin1 = true; | - |
1037 | break; | 0 |
1038 | } | - |
1039 | } | 0 |
1040 | | - |
1041 | // Check that at least one symbol char is in the unicode table | - |
1042 | bool unicodeTableHasSymbols = false; never executed (the execution status of this line is deduced): bool unicodeTableHasSymbols = false; | - |
1043 | if (!unicodeTableHasLatin1) { never evaluated: !unicodeTableHasLatin1 | 0 |
1044 | for (int uc=0xf000; uc<0xf100; ++uc) { never evaluated: uc<0xf100 | 0 |
1045 | if (getTrueTypeGlyphIndex(selectedTable, uc) != 0) { never evaluated: getTrueTypeGlyphIndex(selectedTable, uc) != 0 | 0 |
1046 | unicodeTableHasSymbols = true; never executed (the execution status of this line is deduced): unicodeTableHasSymbols = true; | - |
1047 | break; | 0 |
1048 | } | - |
1049 | } | 0 |
1050 | } | 0 |
1051 | | - |
1052 | // Fall back to symbol table | - |
1053 | if (!unicodeTableHasLatin1 && unicodeTableHasSymbols) { never evaluated: !unicodeTableHasLatin1 never evaluated: unicodeTableHasSymbols | 0 |
1054 | tableToUse = symbolTable; never executed (the execution status of this line is deduced): tableToUse = symbolTable; | - |
1055 | score = Symbol; never executed (the execution status of this line is deduced): score = Symbol; | - |
1056 | goto resolveTable; never executed: goto resolveTable; | 0 |
1057 | } | - |
1058 | } | 0 |
1059 | | - |
1060 | return table + unicode_table; never executed: return table + unicode_table; | 0 |
1061 | } | - |
1062 | | - |
1063 | quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, uint unicode) | - |
1064 | { | - |
1065 | unsigned short format = qFromBigEndian<quint16>(cmap); never executed (the execution status of this line is deduced): unsigned short format = qFromBigEndian<quint16>(cmap); | - |
1066 | if (format == 0) { never evaluated: format == 0 | 0 |
1067 | if (unicode < 256) never evaluated: unicode < 256 | 0 |
1068 | return (int) *(cmap+6+unicode); never executed: return (int) *(cmap+6+unicode); | 0 |
1069 | } else if (format == 4) { never executed: } never evaluated: format == 4 | 0 |
1070 | /* some fonts come with invalid cmap tables, where the last segment | - |
1071 | specified end = start = rangeoffset = 0xffff, delta = 0x0001 | - |
1072 | Since 0xffff is never a valid Unicode char anyway, we just get rid of the issue | - |
1073 | by returning 0 for 0xffff | - |
1074 | */ | - |
1075 | if(unicode >= 0xffff) never evaluated: unicode >= 0xffff | 0 |
1076 | return 0; never executed: return 0; | 0 |
1077 | quint16 segCountX2 = qFromBigEndian<quint16>(cmap + 6); never executed (the execution status of this line is deduced): quint16 segCountX2 = qFromBigEndian<quint16>(cmap + 6); | - |
1078 | const unsigned char *ends = cmap + 14; never executed (the execution status of this line is deduced): const unsigned char *ends = cmap + 14; | - |
1079 | int i = 0; never executed (the execution status of this line is deduced): int i = 0; | - |
1080 | for (; i < segCountX2/2 && qFromBigEndian<quint16>(ends + 2*i) < unicode; i++) {} never executed: } never evaluated: i < segCountX2/2 never evaluated: qFromBigEndian<quint16>(ends + 2*i) < unicode | 0 |
1081 | | - |
1082 | const unsigned char *idx = ends + segCountX2 + 2 + 2*i; never executed (the execution status of this line is deduced): const unsigned char *idx = ends + segCountX2 + 2 + 2*i; | - |
1083 | quint16 startIndex = qFromBigEndian<quint16>(idx); never executed (the execution status of this line is deduced): quint16 startIndex = qFromBigEndian<quint16>(idx); | - |
1084 | | - |
1085 | if (startIndex > unicode) never evaluated: startIndex > unicode | 0 |
1086 | return 0; never executed: return 0; | 0 |
1087 | | - |
1088 | idx += segCountX2; never executed (the execution status of this line is deduced): idx += segCountX2; | - |
1089 | qint16 idDelta = (qint16)qFromBigEndian<quint16>(idx); never executed (the execution status of this line is deduced): qint16 idDelta = (qint16)qFromBigEndian<quint16>(idx); | - |
1090 | idx += segCountX2; never executed (the execution status of this line is deduced): idx += segCountX2; | - |
1091 | quint16 idRangeoffset_t = (quint16)qFromBigEndian<quint16>(idx); never executed (the execution status of this line is deduced): quint16 idRangeoffset_t = (quint16)qFromBigEndian<quint16>(idx); | - |
1092 | | - |
1093 | quint16 glyphIndex; never executed (the execution status of this line is deduced): quint16 glyphIndex; | - |
1094 | if (idRangeoffset_t) { never evaluated: idRangeoffset_t | 0 |
1095 | quint16 id = qFromBigEndian<quint16>(idRangeoffset_t + 2*(unicode - startIndex) + idx); never executed (the execution status of this line is deduced): quint16 id = qFromBigEndian<quint16>(idRangeoffset_t + 2*(unicode - startIndex) + idx); | - |
1096 | if (id) | 0 |
1097 | glyphIndex = (idDelta + id) % 0x10000; never executed: glyphIndex = (idDelta + id) % 0x10000; | 0 |
1098 | else | - |
1099 | glyphIndex = 0; never executed: glyphIndex = 0; | 0 |
1100 | } else { | - |
1101 | glyphIndex = (idDelta + unicode) % 0x10000; never executed (the execution status of this line is deduced): glyphIndex = (idDelta + unicode) % 0x10000; | - |
1102 | } | 0 |
1103 | return glyphIndex; never executed: return glyphIndex; | 0 |
1104 | } else if (format == 6) { never evaluated: format == 6 | 0 |
1105 | quint16 tableSize = qFromBigEndian<quint16>(cmap + 2); never executed (the execution status of this line is deduced): quint16 tableSize = qFromBigEndian<quint16>(cmap + 2); | - |
1106 | | - |
1107 | quint16 firstCode6 = qFromBigEndian<quint16>(cmap + 6); never executed (the execution status of this line is deduced): quint16 firstCode6 = qFromBigEndian<quint16>(cmap + 6); | - |
1108 | if (unicode < firstCode6) never evaluated: unicode < firstCode6 | 0 |
1109 | return 0; never executed: return 0; | 0 |
1110 | | - |
1111 | quint16 entryCount6 = qFromBigEndian<quint16>(cmap + 8); never executed (the execution status of this line is deduced): quint16 entryCount6 = qFromBigEndian<quint16>(cmap + 8); | - |
1112 | if (entryCount6 * 2 + 10 > tableSize) never evaluated: entryCount6 * 2 + 10 > tableSize | 0 |
1113 | return 0; never executed: return 0; | 0 |
1114 | | - |
1115 | quint16 sentinel6 = firstCode6 + entryCount6; never executed (the execution status of this line is deduced): quint16 sentinel6 = firstCode6 + entryCount6; | - |
1116 | if (unicode >= sentinel6) never evaluated: unicode >= sentinel6 | 0 |
1117 | return 0; never executed: return 0; | 0 |
1118 | | - |
1119 | quint16 entryIndex6 = unicode - firstCode6; never executed (the execution status of this line is deduced): quint16 entryIndex6 = unicode - firstCode6; | - |
1120 | return qFromBigEndian<quint16>(cmap + 10 + (entryIndex6 * 2)); never executed: return qFromBigEndian<quint16>(cmap + 10 + (entryIndex6 * 2)); | 0 |
1121 | } else if (format == 12) { never evaluated: format == 12 | 0 |
1122 | quint32 nGroups = qFromBigEndian<quint32>(cmap + 12); never executed (the execution status of this line is deduced): quint32 nGroups = qFromBigEndian<quint32>(cmap + 12); | - |
1123 | | - |
1124 | cmap += 16; // move to start of groups never executed (the execution status of this line is deduced): cmap += 16; | - |
1125 | | - |
1126 | int left = 0, right = nGroups - 1; never executed (the execution status of this line is deduced): int left = 0, right = nGroups - 1; | - |
1127 | while (left <= right) { never evaluated: left <= right | 0 |
1128 | int middle = left + ( ( right - left ) >> 1 ); never executed (the execution status of this line is deduced): int middle = left + ( ( right - left ) >> 1 ); | - |
1129 | | - |
1130 | quint32 startCharCode = qFromBigEndian<quint32>(cmap + 12*middle); never executed (the execution status of this line is deduced): quint32 startCharCode = qFromBigEndian<quint32>(cmap + 12*middle); | - |
1131 | if(unicode < startCharCode) never evaluated: unicode < startCharCode | 0 |
1132 | right = middle - 1; never executed: right = middle - 1; | 0 |
1133 | else { | - |
1134 | quint32 endCharCode = qFromBigEndian<quint32>(cmap + 12*middle + 4); never executed (the execution status of this line is deduced): quint32 endCharCode = qFromBigEndian<quint32>(cmap + 12*middle + 4); | - |
1135 | if(unicode <= endCharCode) never evaluated: unicode <= endCharCode | 0 |
1136 | return qFromBigEndian<quint32>(cmap + 12*middle + 8) + unicode - startCharCode; never executed: return qFromBigEndian<quint32>(cmap + 12*middle + 8) + unicode - startCharCode; | 0 |
1137 | left = middle + 1; never executed (the execution status of this line is deduced): left = middle + 1; | - |
1138 | } | 0 |
1139 | } | - |
1140 | } else { | 0 |
1141 | qDebug("cmap table of format %d not implemented", format); never executed (the execution status of this line is deduced): QMessageLogger("text/qfontengine.cpp", 1141, __PRETTY_FUNCTION__).debug("cmap table of format %d not implemented", format); | - |
1142 | } | 0 |
1143 | | - |
1144 | return 0; never executed: return 0; | 0 |
1145 | } | - |
1146 | | - |
1147 | QByteArray QFontEngine::convertToPostscriptFontFamilyName(const QByteArray &family) | - |
1148 | { | - |
1149 | QByteArray f = family; never executed (the execution status of this line is deduced): QByteArray f = family; | - |
1150 | f.replace(' ', ""); never executed (the execution status of this line is deduced): f.replace(' ', ""); | - |
1151 | f.replace('(', ""); never executed (the execution status of this line is deduced): f.replace('(', ""); | - |
1152 | f.replace(')', ""); never executed (the execution status of this line is deduced): f.replace(')', ""); | - |
1153 | f.replace('<', ""); never executed (the execution status of this line is deduced): f.replace('<', ""); | - |
1154 | f.replace('>', ""); never executed (the execution status of this line is deduced): f.replace('>', ""); | - |
1155 | f.replace('[', ""); never executed (the execution status of this line is deduced): f.replace('[', ""); | - |
1156 | f.replace(']', ""); never executed (the execution status of this line is deduced): f.replace(']', ""); | - |
1157 | f.replace('{', ""); never executed (the execution status of this line is deduced): f.replace('{', ""); | - |
1158 | f.replace('}', ""); never executed (the execution status of this line is deduced): f.replace('}', ""); | - |
1159 | f.replace('/', ""); never executed (the execution status of this line is deduced): f.replace('/', ""); | - |
1160 | f.replace('%', ""); never executed (the execution status of this line is deduced): f.replace('%', ""); | - |
1161 | return f; never executed: return f; | 0 |
1162 | } | - |
1163 | | - |
1164 | QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round) | - |
1165 | { | - |
1166 | if (glyphs.numGlyphs >= 1) { never evaluated: glyphs.numGlyphs >= 1 | 0 |
1167 | glyph_t glyph = glyphs.glyphs[glyphs.numGlyphs - 1]; never executed (the execution status of this line is deduced): glyph_t glyph = glyphs.glyphs[glyphs.numGlyphs - 1]; | - |
1168 | glyph_metrics_t gi = boundingBox(glyph); never executed (the execution status of this line is deduced): glyph_metrics_t gi = boundingBox(glyph); | - |
1169 | if (gi.isValid()) never evaluated: gi.isValid() | 0 |
1170 | return round ? QFixed(qRound(gi.xoff - gi.x - gi.width)) never executed: return round ? QFixed(qRound(gi.xoff - gi.x - gi.width)) : QFixed(gi.xoff - gi.x - gi.width); | 0 |
1171 | : QFixed(gi.xoff - gi.x - gi.width); never executed: return round ? QFixed(qRound(gi.xoff - gi.x - gi.width)) : QFixed(gi.xoff - gi.x - gi.width); | 0 |
1172 | } | 0 |
1173 | return 0; never executed: return 0; | 0 |
1174 | } | - |
1175 | | - |
1176 | // ------------------------------------------------------------------ | - |
1177 | // The box font engine | - |
1178 | // ------------------------------------------------------------------ | - |
1179 | | - |
1180 | QFontEngineBox::QFontEngineBox(int size) | - |
1181 | : _size(size) | - |
1182 | { | - |
1183 | cache_cost = sizeof(QFontEngineBox); executed (the execution status of this line is deduced): cache_cost = sizeof(QFontEngineBox); | - |
1184 | } executed: } Execution Count:4 | 4 |
1185 | | - |
1186 | QFontEngineBox::~QFontEngineBox() | - |
1187 | { | - |
1188 | } | - |
1189 | | - |
1190 | bool QFontEngineBox::stringToCMap(const QChar *, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const | - |
1191 | { | - |
1192 | if (*nglyphs < len) { partially evaluated: *nglyphs < len no Evaluation Count:0 | yes Evaluation Count:56 |
| 0-56 |
1193 | *nglyphs = len; never executed (the execution status of this line is deduced): *nglyphs = len; | - |
1194 | return false; never executed: return false; | 0 |
1195 | } | - |
1196 | | - |
1197 | memset(glyphs->glyphs, 0, len * sizeof(HB_Glyph)); executed (the execution status of this line is deduced): memset(glyphs->glyphs, 0, len * sizeof(HB_Glyph)); | - |
1198 | | - |
1199 | *nglyphs = len; executed (the execution status of this line is deduced): *nglyphs = len; | - |
1200 | glyphs->numGlyphs = len; executed (the execution status of this line is deduced): glyphs->numGlyphs = len; | - |
1201 | | - |
1202 | if (!(flags & GlyphIndicesOnly)) partially evaluated: !(flags & GlyphIndicesOnly) no Evaluation Count:0 | yes Evaluation Count:56 |
| 0-56 |
1203 | recalcAdvances(glyphs, flags); never executed: recalcAdvances(glyphs, flags); | 0 |
1204 | | - |
1205 | return true; executed: return true; Execution Count:56 | 56 |
1206 | } | - |
1207 | | - |
1208 | void QFontEngineBox::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags) const | - |
1209 | { | - |
1210 | for (int i = 0; i < glyphs->numGlyphs; i++) { evaluated: i < glyphs->numGlyphs yes Evaluation Count:124 | yes Evaluation Count:52 |
| 52-124 |
1211 | glyphs->advances_x[i] = _size; executed (the execution status of this line is deduced): glyphs->advances_x[i] = _size; | - |
1212 | glyphs->advances_y[i] = 0; executed (the execution status of this line is deduced): glyphs->advances_y[i] = 0; | - |
1213 | } executed: } Execution Count:124 | 124 |
1214 | } executed: } Execution Count:52 | 52 |
1215 | | - |
1216 | void QFontEngineBox::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) | - |
1217 | { | - |
1218 | if (!glyphs.numGlyphs) never evaluated: !glyphs.numGlyphs | 0 |
1219 | return; | 0 |
1220 | | - |
1221 | QVarLengthArray<QFixedPoint> positions; never executed (the execution status of this line is deduced): QVarLengthArray<QFixedPoint> positions; | - |
1222 | QVarLengthArray<glyph_t> positioned_glyphs; never executed (the execution status of this line is deduced): QVarLengthArray<glyph_t> positioned_glyphs; | - |
1223 | QTransform matrix = QTransform::fromTranslate(x, y - _size); never executed (the execution status of this line is deduced): QTransform matrix = QTransform::fromTranslate(x, y - _size); | - |
1224 | getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions); never executed (the execution status of this line is deduced): getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions); | - |
1225 | | - |
1226 | QSize s(_size - 3, _size - 3); never executed (the execution status of this line is deduced): QSize s(_size - 3, _size - 3); | - |
1227 | for (int k = 0; k < positions.size(); k++) never evaluated: k < positions.size() | 0 |
1228 | path->addRect(QRectF(positions[k].toPointF(), s)); never executed: path->addRect(QRectF(positions[k].toPointF(), s)); | 0 |
1229 | } | 0 |
1230 | | - |
1231 | glyph_metrics_t QFontEngineBox::boundingBox(const QGlyphLayout &glyphs) | - |
1232 | { | - |
1233 | glyph_metrics_t overall; never executed (the execution status of this line is deduced): glyph_metrics_t overall; | - |
1234 | overall.width = _size*glyphs.numGlyphs; never executed (the execution status of this line is deduced): overall.width = _size*glyphs.numGlyphs; | - |
1235 | overall.height = _size; never executed (the execution status of this line is deduced): overall.height = _size; | - |
1236 | overall.xoff = overall.width; never executed (the execution status of this line is deduced): overall.xoff = overall.width; | - |
1237 | return overall; never executed: return overall; | 0 |
1238 | } | - |
1239 | | - |
1240 | void QFontEngineBox::draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &ti) | - |
1241 | { | - |
1242 | if (!ti.glyphs.numGlyphs) never evaluated: !ti.glyphs.numGlyphs | 0 |
1243 | return; | 0 |
1244 | | - |
1245 | // any fixes here should probably also be done in QPaintEnginePrivate::drawBoxTextItem | - |
1246 | QSize s(_size - 3, _size - 3); never executed (the execution status of this line is deduced): QSize s(_size - 3, _size - 3); | - |
1247 | | - |
1248 | QVarLengthArray<QFixedPoint> positions; never executed (the execution status of this line is deduced): QVarLengthArray<QFixedPoint> positions; | - |
1249 | QVarLengthArray<glyph_t> glyphs; never executed (the execution status of this line is deduced): QVarLengthArray<glyph_t> glyphs; | - |
1250 | QTransform matrix = QTransform::fromTranslate(x, y - _size); never executed (the execution status of this line is deduced): QTransform matrix = QTransform::fromTranslate(x, y - _size); | - |
1251 | ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); never executed (the execution status of this line is deduced): ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); | - |
1252 | if (glyphs.size() == 0) never evaluated: glyphs.size() == 0 | 0 |
1253 | return; | 0 |
1254 | | - |
1255 | | - |
1256 | QPainter *painter = p->painter(); never executed (the execution status of this line is deduced): QPainter *painter = p->painter(); | - |
1257 | painter->save(); never executed (the execution status of this line is deduced): painter->save(); | - |
1258 | painter->setBrush(Qt::NoBrush); never executed (the execution status of this line is deduced): painter->setBrush(Qt::NoBrush); | - |
1259 | QPen pen = painter->pen(); never executed (the execution status of this line is deduced): QPen pen = painter->pen(); | - |
1260 | pen.setWidthF(lineThickness().toReal()); never executed (the execution status of this line is deduced): pen.setWidthF(lineThickness().toReal()); | - |
1261 | painter->setPen(pen); never executed (the execution status of this line is deduced): painter->setPen(pen); | - |
1262 | for (int k = 0; k < positions.size(); k++) never evaluated: k < positions.size() | 0 |
1263 | painter->drawRect(QRectF(positions[k].toPointF(), s)); never executed: painter->drawRect(QRectF(positions[k].toPointF(), s)); | 0 |
1264 | painter->restore(); never executed (the execution status of this line is deduced): painter->restore(); | - |
1265 | } | 0 |
1266 | | - |
1267 | glyph_metrics_t QFontEngineBox::boundingBox(glyph_t) | - |
1268 | { | - |
1269 | return glyph_metrics_t(0, -_size, _size, _size, _size, 0); executed: return glyph_metrics_t(0, -_size, _size, _size, _size, 0); Execution Count:9 | 9 |
1270 | } | - |
1271 | | - |
1272 | QFontEngine *QFontEngineBox::cloneWithSize(qreal pixelSize) const | - |
1273 | { | - |
1274 | QFontEngineBox *fe = new QFontEngineBox(pixelSize); never executed (the execution status of this line is deduced): QFontEngineBox *fe = new QFontEngineBox(pixelSize); | - |
1275 | return fe; never executed: return fe; | 0 |
1276 | } | - |
1277 | | - |
1278 | QFixed QFontEngineBox::ascent() const | - |
1279 | { | - |
1280 | return _size; executed: return _size; Execution Count:74 | 74 |
1281 | } | - |
1282 | | - |
1283 | QFixed QFontEngineBox::descent() const | - |
1284 | { | - |
1285 | return 0; executed: return 0; Execution Count:72 | 72 |
1286 | } | - |
1287 | | - |
1288 | QFixed QFontEngineBox::leading() const | - |
1289 | { | - |
1290 | QFixed l = _size * QFixed::fromReal(qreal(0.15)); executed (the execution status of this line is deduced): QFixed l = _size * QFixed::fromReal(qreal(0.15)); | - |
1291 | return l.ceil(); executed: return l.ceil(); Execution Count:76 | 76 |
1292 | } | - |
1293 | | - |
1294 | qreal QFontEngineBox::maxCharWidth() const | - |
1295 | { | - |
1296 | return _size; executed: return _size; Execution Count:1 | 1 |
1297 | } | - |
1298 | | - |
1299 | | - |
1300 | const char *QFontEngineBox::name() const | - |
1301 | { | - |
1302 | return "null"; never executed: return "null"; | 0 |
1303 | } | - |
1304 | | - |
1305 | bool QFontEngineBox::canRender(const QChar *, int) | - |
1306 | { | - |
1307 | return true; never executed: return true; | 0 |
1308 | } | - |
1309 | | - |
1310 | QFontEngine::Type QFontEngineBox::type() const | - |
1311 | { | - |
1312 | return Box; executed: return Box; Execution Count:84 | 84 |
1313 | } | - |
1314 | | - |
1315 | QImage QFontEngineBox::alphaMapForGlyph(glyph_t) | - |
1316 | { | - |
1317 | QImage image(_size, _size, QImage::Format_Indexed8); executed (the execution status of this line is deduced): QImage image(_size, _size, QImage::Format_Indexed8); | - |
1318 | QVector<QRgb> colors(256); executed (the execution status of this line is deduced): QVector<QRgb> colors(256); | - |
1319 | for (int i=0; i<256; ++i) evaluated: i<256 yes Evaluation Count:256 | yes Evaluation Count:1 |
| 1-256 |
1320 | colors[i] = qRgba(0, 0, 0, i); executed: colors[i] = qRgba(0, 0, 0, i); Execution Count:256 | 256 |
1321 | image.setColorTable(colors); executed (the execution status of this line is deduced): image.setColorTable(colors); | - |
1322 | image.fill(0); executed (the execution status of this line is deduced): image.fill(0); | - |
1323 | | - |
1324 | // can't use qpainter for index8; so use setPixel to draw our rectangle. | - |
1325 | for (int i=2; i <= _size-3; ++i) { evaluated: i <= _size-3 yes Evaluation Count:9 | yes Evaluation Count:1 |
| 1-9 |
1326 | image.setPixel(i, 2, 255); executed (the execution status of this line is deduced): image.setPixel(i, 2, 255); | - |
1327 | image.setPixel(i, _size-3, 255); executed (the execution status of this line is deduced): image.setPixel(i, _size-3, 255); | - |
1328 | image.setPixel(2, i, 255); executed (the execution status of this line is deduced): image.setPixel(2, i, 255); | - |
1329 | image.setPixel(_size-3, i, 255); executed (the execution status of this line is deduced): image.setPixel(_size-3, i, 255); | - |
1330 | } executed: } Execution Count:9 | 9 |
1331 | return image; executed: return image; Execution Count:1 | 1 |
1332 | } | - |
1333 | | - |
1334 | // ------------------------------------------------------------------ | - |
1335 | // Multi engine | - |
1336 | // ------------------------------------------------------------------ | - |
1337 | | - |
1338 | static inline uchar highByte(glyph_t glyph) | - |
1339 | { return glyph >> 24; } executed: return glyph >> 24; Execution Count:281126 | 281126 |
1340 | | - |
1341 | // strip high byte from glyph | - |
1342 | static inline glyph_t stripped(glyph_t glyph) | - |
1343 | { return glyph & 0x00ffffff; } executed: return glyph & 0x00ffffff; Execution Count:280246 | 280246 |
1344 | | - |
1345 | QFontEngineMulti::QFontEngineMulti(int engineCount) | - |
1346 | { | - |
1347 | engines.fill(0, engineCount); executed (the execution status of this line is deduced): engines.fill(0, engineCount); | - |
1348 | cache_cost = 0; executed (the execution status of this line is deduced): cache_cost = 0; | - |
1349 | } executed: } Execution Count:600 | 600 |
1350 | | - |
1351 | QFontEngineMulti::~QFontEngineMulti() | - |
1352 | { | - |
1353 | for (int i = 0; i < engines.size(); ++i) { evaluated: i < engines.size() yes Evaluation Count:51953 | yes Evaluation Count:590 |
| 590-51953 |
1354 | QFontEngine *fontEngine = engines.at(i); executed (the execution status of this line is deduced): QFontEngine *fontEngine = engines.at(i); | - |
1355 | if (fontEngine) { evaluated: fontEngine yes Evaluation Count:599 | yes Evaluation Count:51354 |
| 599-51354 |
1356 | fontEngine->ref.deref(); executed (the execution status of this line is deduced): fontEngine->ref.deref(); | - |
1357 | if (fontEngine->cache_count == 0 && fontEngine->ref.load() == 0) partially evaluated: fontEngine->cache_count == 0 no Evaluation Count:0 | yes Evaluation Count:599 |
never evaluated: fontEngine->ref.load() == 0 | 0-599 |
1358 | delete fontEngine; never executed: delete fontEngine; | 0 |
1359 | } executed: } Execution Count:599 | 599 |
1360 | } executed: } Execution Count:51953 | 51953 |
1361 | } executed: } Execution Count:590 | 590 |
1362 | | - |
1363 | bool QFontEngineMulti::stringToCMap(const QChar *str, int len, | - |
1364 | QGlyphLayout *glyphs, int *nglyphs, | - |
1365 | QFontEngine::ShaperFlags flags) const | - |
1366 | { | - |
1367 | if (!engine(0)->stringToCMap(str, len, glyphs, nglyphs, flags)) partially evaluated: !engine(0)->stringToCMap(str, len, glyphs, nglyphs, flags) no Evaluation Count:0 | yes Evaluation Count:249018 |
| 0-249018 |
1368 | return false; never executed: return false; | 0 |
1369 | | - |
1370 | const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried(); executed (the execution status of this line is deduced): const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried(); | - |
1371 | int glyph_pos = 0; executed (the execution status of this line is deduced): int glyph_pos = 0; | - |
1372 | for (int i = 0; i < len; ++i) { evaluated: i < len yes Evaluation Count:3114670 | yes Evaluation Count:249018 |
| 249018-3114670 |
1373 | bool surrogate = (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()); evaluated: str[i].isHighSurrogate() yes Evaluation Count:1 | yes Evaluation Count:3114669 |
partially evaluated: i < len-1 yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: str[i+1].isLowSurrogate() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-3114669 |
1374 | uint ucs4 = surrogate ? QChar::surrogateToUcs4(str[i], str[i+1]) : str[i].unicode(); evaluated: surrogate yes Evaluation Count:1 | yes Evaluation Count:3114669 |
| 1-3114669 |
1375 | if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) { evaluated: glyphs->glyphs[glyph_pos] == 0 yes Evaluation Count:10935 | yes Evaluation Count:3103735 |
evaluated: str[i].category() != QChar::Separator_Line yes Evaluation Count:120 | yes Evaluation Count:10815 |
| 120-3103735 |
1376 | QGlyphLayoutInstance tmp; executed (the execution status of this line is deduced): QGlyphLayoutInstance tmp; | - |
1377 | if (!(flags & GlyphIndicesOnly)) partially evaluated: !(flags & GlyphIndicesOnly) no Evaluation Count:0 | yes Evaluation Count:120 |
| 0-120 |
1378 | tmp = glyphs->instance(glyph_pos); never executed: tmp = glyphs->instance(glyph_pos); | 0 |
1379 | for (int x=1; x < engines.size(); ++x) { evaluated: x < engines.size() yes Evaluation Count:5377 | yes Evaluation Count:61 |
| 61-5377 |
1380 | if (engines.at(x) == 0 && !shouldLoadFontEngineForCharacter(x, ucs4)) evaluated: engines.at(x) == 0 yes Evaluation Count:5327 | yes Evaluation Count:50 |
evaluated: !shouldLoadFontEngineForCharacter(x, ucs4) yes Evaluation Count:5318 | yes Evaluation Count:9 |
| 9-5327 |
1381 | continue; executed: continue; Execution Count:5318 | 5318 |
1382 | | - |
1383 | QFontEngine *engine = engines.at(x); executed (the execution status of this line is deduced): QFontEngine *engine = engines.at(x); | - |
1384 | if (!engine) { evaluated: !engine yes Evaluation Count:9 | yes Evaluation Count:50 |
| 9-50 |
1385 | const_cast<QFontEngineMulti *>(this)->loadEngine(x); executed (the execution status of this line is deduced): const_cast<QFontEngineMulti *>(this)->loadEngine(x); | - |
1386 | engine = engines.at(x); executed (the execution status of this line is deduced): engine = engines.at(x); | - |
1387 | } executed: } Execution Count:9 | 9 |
1388 | Q_ASSERT(engine != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
1389 | if (engine->type() == Box) partially evaluated: engine->type() == Box no Evaluation Count:0 | yes Evaluation Count:59 |
| 0-59 |
1390 | continue; never executed: continue; | 0 |
1391 | | - |
1392 | if (!(flags & GlyphIndicesOnly)) { partially evaluated: !(flags & GlyphIndicesOnly) no Evaluation Count:0 | yes Evaluation Count:59 |
| 0-59 |
1393 | glyphs->advances_x[glyph_pos] = glyphs->advances_y[glyph_pos] = 0; never executed (the execution status of this line is deduced): glyphs->advances_x[glyph_pos] = glyphs->advances_y[glyph_pos] = 0; | - |
1394 | glyphs->offsets[glyph_pos] = QFixedPoint(); never executed (the execution status of this line is deduced): glyphs->offsets[glyph_pos] = QFixedPoint(); | - |
1395 | } | 0 |
1396 | int num = 2; executed (the execution status of this line is deduced): int num = 2; | - |
1397 | QGlyphLayout offs = glyphs->mid(glyph_pos, num); executed (the execution status of this line is deduced): QGlyphLayout offs = glyphs->mid(glyph_pos, num); | - |
1398 | engine->stringToCMap(str + i, surrogate ? 2 : 1, &offs, &num, flags); executed (the execution status of this line is deduced): engine->stringToCMap(str + i, surrogate ? 2 : 1, &offs, &num, flags); | - |
1399 | Q_ASSERT(num == 1); // surrogates only give 1 glyph executed (the execution status of this line is deduced): qt_noop(); | - |
1400 | if (glyphs->glyphs[glyph_pos]) { partially evaluated: glyphs->glyphs[glyph_pos] yes Evaluation Count:59 | no Evaluation Count:0 |
| 0-59 |
1401 | // set the high byte to indicate which engine the glyph came from | - |
1402 | glyphs->glyphs[glyph_pos] |= (x << 24); executed (the execution status of this line is deduced): glyphs->glyphs[glyph_pos] |= (x << 24); | - |
1403 | break; executed: break; Execution Count:59 | 59 |
1404 | } | - |
1405 | } | 0 |
1406 | | - |
1407 | // ensure we use metrics from the 1st font when we use the fallback image. | - |
1408 | if (!(flags & GlyphIndicesOnly) && !glyphs->glyphs[glyph_pos]) partially evaluated: !(flags & GlyphIndicesOnly) no Evaluation Count:0 | yes Evaluation Count:120 |
never evaluated: !glyphs->glyphs[glyph_pos] | 0-120 |
1409 | glyphs->setInstance(glyph_pos, tmp); never executed: glyphs->setInstance(glyph_pos, tmp); | 0 |
1410 | } executed: } Execution Count:120 | 120 |
1411 | | - |
1412 | if (surrogate) evaluated: surrogate yes Evaluation Count:1 | yes Evaluation Count:3114669 |
| 1-3114669 |
1413 | ++i; executed: ++i; Execution Count:1 | 1 |
1414 | ++glyph_pos; executed (the execution status of this line is deduced): ++glyph_pos; | - |
1415 | } executed: } Execution Count:3114670 | 3114670 |
1416 | | - |
1417 | *nglyphs = glyph_pos; executed (the execution status of this line is deduced): *nglyphs = glyph_pos; | - |
1418 | glyphs->numGlyphs = glyph_pos; executed (the execution status of this line is deduced): glyphs->numGlyphs = glyph_pos; | - |
1419 | | - |
1420 | return true; executed: return true; Execution Count:249018 | 249018 |
1421 | } | - |
1422 | | - |
1423 | bool QFontEngineMulti::shouldLoadFontEngineForCharacter(int at, uint ucs4) const | - |
1424 | { | - |
1425 | Q_UNUSED(at); never executed (the execution status of this line is deduced): (void)at;; | - |
1426 | Q_UNUSED(ucs4); never executed (the execution status of this line is deduced): (void)ucs4;; | - |
1427 | return true; never executed: return true; | 0 |
1428 | } | - |
1429 | | - |
1430 | glyph_metrics_t QFontEngineMulti::boundingBox(const QGlyphLayout &glyphs) | - |
1431 | { | - |
1432 | if (glyphs.numGlyphs <= 0) partially evaluated: glyphs.numGlyphs <= 0 no Evaluation Count:0 | yes Evaluation Count:880 |
| 0-880 |
1433 | return glyph_metrics_t(); never executed: return glyph_metrics_t(); | 0 |
1434 | | - |
1435 | glyph_metrics_t overall; executed (the execution status of this line is deduced): glyph_metrics_t overall; | - |
1436 | | - |
1437 | int which = highByte(glyphs.glyphs[0]); executed (the execution status of this line is deduced): int which = highByte(glyphs.glyphs[0]); | - |
1438 | int start = 0; executed (the execution status of this line is deduced): int start = 0; | - |
1439 | int end, i; executed (the execution status of this line is deduced): int end, i; | - |
1440 | for (end = 0; end < glyphs.numGlyphs; ++end) { evaluated: end < glyphs.numGlyphs yes Evaluation Count:18579 | yes Evaluation Count:880 |
| 880-18579 |
1441 | const int e = highByte(glyphs.glyphs[end]); executed (the execution status of this line is deduced): const int e = highByte(glyphs.glyphs[end]); | - |
1442 | if (e == which) partially evaluated: e == which yes Evaluation Count:18579 | no Evaluation Count:0 |
| 0-18579 |
1443 | continue; executed: continue; Execution Count:18579 | 18579 |
1444 | | - |
1445 | // set the high byte to zero | - |
1446 | for (i = start; i < end; ++i) | 0 |
1447 | glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); never executed: glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); | 0 |
1448 | | - |
1449 | // merge the bounding box for this run | - |
1450 | const glyph_metrics_t gm = engine(which)->boundingBox(glyphs.mid(start, end - start)); never executed (the execution status of this line is deduced): const glyph_metrics_t gm = engine(which)->boundingBox(glyphs.mid(start, end - start)); | - |
1451 | | - |
1452 | overall.x = qMin(overall.x, gm.x); never executed (the execution status of this line is deduced): overall.x = qMin(overall.x, gm.x); | - |
1453 | overall.y = qMin(overall.y, gm.y); never executed (the execution status of this line is deduced): overall.y = qMin(overall.y, gm.y); | - |
1454 | overall.width = overall.xoff + gm.width; never executed (the execution status of this line is deduced): overall.width = overall.xoff + gm.width; | - |
1455 | overall.height = qMax(overall.height + overall.y, gm.height + gm.y) - never executed (the execution status of this line is deduced): overall.height = qMax(overall.height + overall.y, gm.height + gm.y) - | - |
1456 | qMin(overall.y, gm.y); never executed (the execution status of this line is deduced): qMin(overall.y, gm.y); | - |
1457 | overall.xoff += gm.xoff; never executed (the execution status of this line is deduced): overall.xoff += gm.xoff; | - |
1458 | overall.yoff += gm.yoff; never executed (the execution status of this line is deduced): overall.yoff += gm.yoff; | - |
1459 | | - |
1460 | // reset the high byte for all glyphs | - |
1461 | const int hi = which << 24; never executed (the execution status of this line is deduced): const int hi = which << 24; | - |
1462 | for (i = start; i < end; ++i) | 0 |
1463 | glyphs.glyphs[i] = hi | glyphs.glyphs[i]; never executed: glyphs.glyphs[i] = hi | glyphs.glyphs[i]; | 0 |
1464 | | - |
1465 | // change engine | - |
1466 | start = end; never executed (the execution status of this line is deduced): start = end; | - |
1467 | which = e; never executed (the execution status of this line is deduced): which = e; | - |
1468 | } | 0 |
1469 | | - |
1470 | // set the high byte to zero | - |
1471 | for (i = start; i < end; ++i) evaluated: i < end yes Evaluation Count:18579 | yes Evaluation Count:880 |
| 880-18579 |
1472 | glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); executed: glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); Execution Count:18579 | 18579 |
1473 | | - |
1474 | // merge the bounding box for this run | - |
1475 | const glyph_metrics_t gm = engine(which)->boundingBox(glyphs.mid(start, end - start)); executed (the execution status of this line is deduced): const glyph_metrics_t gm = engine(which)->boundingBox(glyphs.mid(start, end - start)); | - |
1476 | | - |
1477 | overall.x = qMin(overall.x, gm.x); executed (the execution status of this line is deduced): overall.x = qMin(overall.x, gm.x); | - |
1478 | overall.y = qMin(overall.y, gm.y); executed (the execution status of this line is deduced): overall.y = qMin(overall.y, gm.y); | - |
1479 | overall.width = overall.xoff + gm.width; executed (the execution status of this line is deduced): overall.width = overall.xoff + gm.width; | - |
1480 | overall.height = qMax(overall.height + overall.y, gm.height + gm.y) - executed (the execution status of this line is deduced): overall.height = qMax(overall.height + overall.y, gm.height + gm.y) - | - |
1481 | qMin(overall.y, gm.y); executed (the execution status of this line is deduced): qMin(overall.y, gm.y); | - |
1482 | overall.xoff += gm.xoff; executed (the execution status of this line is deduced): overall.xoff += gm.xoff; | - |
1483 | overall.yoff += gm.yoff; executed (the execution status of this line is deduced): overall.yoff += gm.yoff; | - |
1484 | | - |
1485 | // reset the high byte for all glyphs | - |
1486 | const int hi = which << 24; executed (the execution status of this line is deduced): const int hi = which << 24; | - |
1487 | for (i = start; i < end; ++i) evaluated: i < end yes Evaluation Count:18579 | yes Evaluation Count:880 |
| 880-18579 |
1488 | glyphs.glyphs[i] = hi | glyphs.glyphs[i]; executed: glyphs.glyphs[i] = hi | glyphs.glyphs[i]; Execution Count:18579 | 18579 |
1489 | | - |
1490 | return overall; executed: return overall; Execution Count:880 | 880 |
1491 | } | - |
1492 | | - |
1493 | void QFontEngineMulti::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing) | - |
1494 | { | - |
1495 | int which = highByte(glyph); executed (the execution status of this line is deduced): int which = highByte(glyph); | - |
1496 | ensureEngineAt(which); executed (the execution status of this line is deduced): ensureEngineAt(which); | - |
1497 | engine(which)->getGlyphBearings(stripped(glyph), leftBearing, rightBearing); executed (the execution status of this line is deduced): engine(which)->getGlyphBearings(stripped(glyph), leftBearing, rightBearing); | - |
1498 | } executed: } Execution Count:261641 | 261641 |
1499 | | - |
1500 | void QFontEngineMulti::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, | - |
1501 | QPainterPath *path, QTextItem::RenderFlags flags) | - |
1502 | { | - |
1503 | if (glyphs.numGlyphs <= 0) never evaluated: glyphs.numGlyphs <= 0 | 0 |
1504 | return; | 0 |
1505 | | - |
1506 | int which = highByte(glyphs.glyphs[0]); never executed (the execution status of this line is deduced): int which = highByte(glyphs.glyphs[0]); | - |
1507 | int start = 0; never executed (the execution status of this line is deduced): int start = 0; | - |
1508 | int end, i; never executed (the execution status of this line is deduced): int end, i; | - |
1509 | if (flags & QTextItem::RightToLeft) { never evaluated: flags & QTextItem::RightToLeft | 0 |
1510 | for (int gl = 0; gl < glyphs.numGlyphs; gl++) { never evaluated: gl < glyphs.numGlyphs | 0 |
1511 | x += glyphs.advances_x[gl].toReal(); never executed (the execution status of this line is deduced): x += glyphs.advances_x[gl].toReal(); | - |
1512 | y += glyphs.advances_y[gl].toReal(); never executed (the execution status of this line is deduced): y += glyphs.advances_y[gl].toReal(); | - |
1513 | } | 0 |
1514 | } | 0 |
1515 | for (end = 0; end < glyphs.numGlyphs; ++end) { never evaluated: end < glyphs.numGlyphs | 0 |
1516 | const int e = highByte(glyphs.glyphs[end]); never executed (the execution status of this line is deduced): const int e = highByte(glyphs.glyphs[end]); | - |
1517 | if (e == which) never evaluated: e == which | 0 |
1518 | continue; never executed: continue; | 0 |
1519 | | - |
1520 | if (flags & QTextItem::RightToLeft) { never evaluated: flags & QTextItem::RightToLeft | 0 |
1521 | for (i = start; i < end; ++i) { | 0 |
1522 | x -= glyphs.advances_x[i].toReal(); never executed (the execution status of this line is deduced): x -= glyphs.advances_x[i].toReal(); | - |
1523 | y -= glyphs.advances_y[i].toReal(); never executed (the execution status of this line is deduced): y -= glyphs.advances_y[i].toReal(); | - |
1524 | } | 0 |
1525 | } | 0 |
1526 | | - |
1527 | // set the high byte to zero | - |
1528 | for (i = start; i < end; ++i) | 0 |
1529 | glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); never executed: glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); | 0 |
1530 | engine(which)->addOutlineToPath(x, y, glyphs.mid(start, end - start), path, flags); never executed (the execution status of this line is deduced): engine(which)->addOutlineToPath(x, y, glyphs.mid(start, end - start), path, flags); | - |
1531 | // reset the high byte for all glyphs and update x and y | - |
1532 | const int hi = which << 24; never executed (the execution status of this line is deduced): const int hi = which << 24; | - |
1533 | for (i = start; i < end; ++i) | 0 |
1534 | glyphs.glyphs[i] = hi | glyphs.glyphs[i]; never executed: glyphs.glyphs[i] = hi | glyphs.glyphs[i]; | 0 |
1535 | | - |
1536 | if (!(flags & QTextItem::RightToLeft)) { never evaluated: !(flags & QTextItem::RightToLeft) | 0 |
1537 | for (i = start; i < end; ++i) { | 0 |
1538 | x += glyphs.advances_x[i].toReal(); never executed (the execution status of this line is deduced): x += glyphs.advances_x[i].toReal(); | - |
1539 | y += glyphs.advances_y[i].toReal(); never executed (the execution status of this line is deduced): y += glyphs.advances_y[i].toReal(); | - |
1540 | } | 0 |
1541 | } | 0 |
1542 | | - |
1543 | // change engine | - |
1544 | start = end; never executed (the execution status of this line is deduced): start = end; | - |
1545 | which = e; never executed (the execution status of this line is deduced): which = e; | - |
1546 | } | 0 |
1547 | | - |
1548 | if (flags & QTextItem::RightToLeft) { never evaluated: flags & QTextItem::RightToLeft | 0 |
1549 | for (i = start; i < end; ++i) { | 0 |
1550 | x -= glyphs.advances_x[i].toReal(); never executed (the execution status of this line is deduced): x -= glyphs.advances_x[i].toReal(); | - |
1551 | y -= glyphs.advances_y[i].toReal(); never executed (the execution status of this line is deduced): y -= glyphs.advances_y[i].toReal(); | - |
1552 | } | 0 |
1553 | } | 0 |
1554 | | - |
1555 | // set the high byte to zero | - |
1556 | for (i = start; i < end; ++i) | 0 |
1557 | glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); never executed: glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); | 0 |
1558 | | - |
1559 | engine(which)->addOutlineToPath(x, y, glyphs.mid(start, end - start), path, flags); never executed (the execution status of this line is deduced): engine(which)->addOutlineToPath(x, y, glyphs.mid(start, end - start), path, flags); | - |
1560 | | - |
1561 | // reset the high byte for all glyphs | - |
1562 | const int hi = which << 24; never executed (the execution status of this line is deduced): const int hi = which << 24; | - |
1563 | for (i = start; i < end; ++i) | 0 |
1564 | glyphs.glyphs[i] = hi | glyphs.glyphs[i]; never executed: glyphs.glyphs[i] = hi | glyphs.glyphs[i]; | 0 |
1565 | } | 0 |
1566 | | - |
1567 | void QFontEngineMulti::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const | - |
1568 | { | - |
1569 | if (glyphs->numGlyphs <= 0) never evaluated: glyphs->numGlyphs <= 0 | 0 |
1570 | return; | 0 |
1571 | | - |
1572 | int which = highByte(glyphs->glyphs[0]); never executed (the execution status of this line is deduced): int which = highByte(glyphs->glyphs[0]); | - |
1573 | int start = 0; never executed (the execution status of this line is deduced): int start = 0; | - |
1574 | int end, i; never executed (the execution status of this line is deduced): int end, i; | - |
1575 | for (end = 0; end < glyphs->numGlyphs; ++end) { never evaluated: end < glyphs->numGlyphs | 0 |
1576 | const int e = highByte(glyphs->glyphs[end]); never executed (the execution status of this line is deduced): const int e = highByte(glyphs->glyphs[end]); | - |
1577 | if (e == which) never evaluated: e == which | 0 |
1578 | continue; never executed: continue; | 0 |
1579 | | - |
1580 | // set the high byte to zero | - |
1581 | for (i = start; i < end; ++i) | 0 |
1582 | glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); never executed: glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); | 0 |
1583 | | - |
1584 | QGlyphLayout offs = glyphs->mid(start, end - start); never executed (the execution status of this line is deduced): QGlyphLayout offs = glyphs->mid(start, end - start); | - |
1585 | engine(which)->recalcAdvances(&offs, flags); never executed (the execution status of this line is deduced): engine(which)->recalcAdvances(&offs, flags); | - |
1586 | | - |
1587 | // reset the high byte for all glyphs and update x and y | - |
1588 | const int hi = which << 24; never executed (the execution status of this line is deduced): const int hi = which << 24; | - |
1589 | for (i = start; i < end; ++i) | 0 |
1590 | glyphs->glyphs[i] = hi | glyphs->glyphs[i]; never executed: glyphs->glyphs[i] = hi | glyphs->glyphs[i]; | 0 |
1591 | | - |
1592 | // change engine | - |
1593 | start = end; never executed (the execution status of this line is deduced): start = end; | - |
1594 | which = e; never executed (the execution status of this line is deduced): which = e; | - |
1595 | } | 0 |
1596 | | - |
1597 | // set the high byte to zero | - |
1598 | for (i = start; i < end; ++i) | 0 |
1599 | glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); never executed: glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); | 0 |
1600 | | - |
1601 | QGlyphLayout offs = glyphs->mid(start, end - start); never executed (the execution status of this line is deduced): QGlyphLayout offs = glyphs->mid(start, end - start); | - |
1602 | engine(which)->recalcAdvances(&offs, flags); never executed (the execution status of this line is deduced): engine(which)->recalcAdvances(&offs, flags); | - |
1603 | | - |
1604 | // reset the high byte for all glyphs | - |
1605 | const int hi = which << 24; never executed (the execution status of this line is deduced): const int hi = which << 24; | - |
1606 | for (i = start; i < end; ++i) | 0 |
1607 | glyphs->glyphs[i] = hi | glyphs->glyphs[i]; never executed: glyphs->glyphs[i] = hi | glyphs->glyphs[i]; | 0 |
1608 | } | 0 |
1609 | | - |
1610 | void QFontEngineMulti::doKerning(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const | - |
1611 | { | - |
1612 | if (glyphs->numGlyphs <= 0) never evaluated: glyphs->numGlyphs <= 0 | 0 |
1613 | return; | 0 |
1614 | | - |
1615 | int which = highByte(glyphs->glyphs[0]); never executed (the execution status of this line is deduced): int which = highByte(glyphs->glyphs[0]); | - |
1616 | int start = 0; never executed (the execution status of this line is deduced): int start = 0; | - |
1617 | int end, i; never executed (the execution status of this line is deduced): int end, i; | - |
1618 | for (end = 0; end < glyphs->numGlyphs; ++end) { never evaluated: end < glyphs->numGlyphs | 0 |
1619 | const int e = highByte(glyphs->glyphs[end]); never executed (the execution status of this line is deduced): const int e = highByte(glyphs->glyphs[end]); | - |
1620 | if (e == which) never evaluated: e == which | 0 |
1621 | continue; never executed: continue; | 0 |
1622 | | - |
1623 | // set the high byte to zero | - |
1624 | for (i = start; i < end; ++i) | 0 |
1625 | glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); never executed: glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); | 0 |
1626 | | - |
1627 | QGlyphLayout offs = glyphs->mid(start, end - start); never executed (the execution status of this line is deduced): QGlyphLayout offs = glyphs->mid(start, end - start); | - |
1628 | engine(which)->doKerning(&offs, flags); never executed (the execution status of this line is deduced): engine(which)->doKerning(&offs, flags); | - |
1629 | | - |
1630 | // reset the high byte for all glyphs and update x and y | - |
1631 | const int hi = which << 24; never executed (the execution status of this line is deduced): const int hi = which << 24; | - |
1632 | for (i = start; i < end; ++i) | 0 |
1633 | glyphs->glyphs[i] = hi | glyphs->glyphs[i]; never executed: glyphs->glyphs[i] = hi | glyphs->glyphs[i]; | 0 |
1634 | | - |
1635 | // change engine | - |
1636 | start = end; never executed (the execution status of this line is deduced): start = end; | - |
1637 | which = e; never executed (the execution status of this line is deduced): which = e; | - |
1638 | } | 0 |
1639 | | - |
1640 | // set the high byte to zero | - |
1641 | for (i = start; i < end; ++i) | 0 |
1642 | glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); never executed: glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); | 0 |
1643 | | - |
1644 | QGlyphLayout offs = glyphs->mid(start, end - start); never executed (the execution status of this line is deduced): QGlyphLayout offs = glyphs->mid(start, end - start); | - |
1645 | engine(which)->doKerning(&offs, flags); never executed (the execution status of this line is deduced): engine(which)->doKerning(&offs, flags); | - |
1646 | | - |
1647 | // reset the high byte for all glyphs | - |
1648 | const int hi = which << 24; never executed (the execution status of this line is deduced): const int hi = which << 24; | - |
1649 | for (i = start; i < end; ++i) | 0 |
1650 | glyphs->glyphs[i] = hi | glyphs->glyphs[i]; never executed: glyphs->glyphs[i] = hi | glyphs->glyphs[i]; | 0 |
1651 | } | 0 |
1652 | | - |
1653 | glyph_metrics_t QFontEngineMulti::boundingBox(glyph_t glyph) | - |
1654 | { | - |
1655 | const int which = highByte(glyph); executed (the execution status of this line is deduced): const int which = highByte(glyph); | - |
1656 | Q_ASSERT(which < engines.size()); executed (the execution status of this line is deduced): qt_noop(); | - |
1657 | return engine(which)->boundingBox(stripped(glyph)); executed: return engine(which)->boundingBox(stripped(glyph)); Execution Count:26 | 26 |
1658 | } | - |
1659 | | - |
1660 | QFixed QFontEngineMulti::ascent() const | - |
1661 | { return engine(0)->ascent(); } executed: return engine(0)->ascent(); Execution Count:329221 | 329221 |
1662 | | - |
1663 | QFixed QFontEngineMulti::descent() const | - |
1664 | { return engine(0)->descent(); } executed: return engine(0)->descent(); Execution Count:328465 | 328465 |
1665 | | - |
1666 | QFixed QFontEngineMulti::leading() const | - |
1667 | { | - |
1668 | return engine(0)->leading(); executed: return engine(0)->leading(); Execution Count:292959 | 292959 |
1669 | } | - |
1670 | | - |
1671 | QFixed QFontEngineMulti::xHeight() const | - |
1672 | { | - |
1673 | return engine(0)->xHeight(); never executed: return engine(0)->xHeight(); | 0 |
1674 | } | - |
1675 | | - |
1676 | QFixed QFontEngineMulti::averageCharWidth() const | - |
1677 | { | - |
1678 | return engine(0)->averageCharWidth(); executed: return engine(0)->averageCharWidth(); Execution Count:218 | 218 |
1679 | } | - |
1680 | | - |
1681 | QFixed QFontEngineMulti::lineThickness() const | - |
1682 | { | - |
1683 | return engine(0)->lineThickness(); executed: return engine(0)->lineThickness(); Execution Count:543 | 543 |
1684 | } | - |
1685 | | - |
1686 | QFixed QFontEngineMulti::underlinePosition() const | - |
1687 | { | - |
1688 | return engine(0)->underlinePosition(); executed: return engine(0)->underlinePosition(); Execution Count:540 | 540 |
1689 | } | - |
1690 | | - |
1691 | qreal QFontEngineMulti::maxCharWidth() const | - |
1692 | { | - |
1693 | return engine(0)->maxCharWidth(); executed: return engine(0)->maxCharWidth(); Execution Count:2625 | 2625 |
1694 | } | - |
1695 | | - |
1696 | qreal QFontEngineMulti::minLeftBearing() const | - |
1697 | { | - |
1698 | return engine(0)->minLeftBearing(); executed: return engine(0)->minLeftBearing(); Execution Count:762 | 762 |
1699 | } | - |
1700 | | - |
1701 | qreal QFontEngineMulti::minRightBearing() const | - |
1702 | { | - |
1703 | return engine(0)->minRightBearing(); executed: return engine(0)->minRightBearing(); Execution Count:233229 | 233229 |
1704 | } | - |
1705 | | - |
1706 | bool QFontEngineMulti::canRender(const QChar *string, int len) | - |
1707 | { | - |
1708 | if (engine(0)->canRender(string, len)) partially evaluated: engine(0)->canRender(string, len) yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
1709 | return true; executed: return true; Execution Count:8 | 8 |
1710 | | - |
1711 | QVarLengthGlyphLayoutArray glyphs(len); never executed (the execution status of this line is deduced): QVarLengthGlyphLayoutArray glyphs(len); | - |
1712 | int nglyphs = len; never executed (the execution status of this line is deduced): int nglyphs = len; | - |
1713 | if (!stringToCMap(string, len, &glyphs, &nglyphs, GlyphIndicesOnly)) { never evaluated: !stringToCMap(string, len, &glyphs, &nglyphs, GlyphIndicesOnly) | 0 |
1714 | glyphs.resize(nglyphs); never executed (the execution status of this line is deduced): glyphs.resize(nglyphs); | - |
1715 | stringToCMap(string, len, &glyphs, &nglyphs, GlyphIndicesOnly); never executed (the execution status of this line is deduced): stringToCMap(string, len, &glyphs, &nglyphs, GlyphIndicesOnly); | - |
1716 | } | 0 |
1717 | | - |
1718 | bool allExist = true; never executed (the execution status of this line is deduced): bool allExist = true; | - |
1719 | for (int i = 0; i < nglyphs; i++) { never evaluated: i < nglyphs | 0 |
1720 | if (!glyphs.glyphs[i]) { never evaluated: !glyphs.glyphs[i] | 0 |
1721 | allExist = false; never executed (the execution status of this line is deduced): allExist = false; | - |
1722 | break; | 0 |
1723 | } | - |
1724 | } | 0 |
1725 | | - |
1726 | return allExist; never executed: return allExist; | 0 |
1727 | } | - |
1728 | | - |
1729 | /* Implement alphaMapForGlyph() which is called by Lighthouse/Windows code. | - |
1730 | * Ideally, that code should be fixed to correctly handle QFontEngineMulti. */ | - |
1731 | | - |
1732 | QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph) | - |
1733 | { | - |
1734 | const int which = highByte(glyph); never executed (the execution status of this line is deduced): const int which = highByte(glyph); | - |
1735 | Q_ASSERT(which < engines.size()); never executed (the execution status of this line is deduced): qt_noop(); | - |
1736 | return engine(which)->alphaMapForGlyph(stripped(glyph)); never executed: return engine(which)->alphaMapForGlyph(stripped(glyph)); | 0 |
1737 | } | - |
1738 | | - |
1739 | QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) | - |
1740 | { | - |
1741 | const int which = highByte(glyph); never executed (the execution status of this line is deduced): const int which = highByte(glyph); | - |
1742 | Q_ASSERT(which < engines.size()); never executed (the execution status of this line is deduced): qt_noop(); | - |
1743 | return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition); never executed: return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition); | 0 |
1744 | } | - |
1745 | | - |
1746 | QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, const QTransform &t) | - |
1747 | { | - |
1748 | const int which = highByte(glyph); never executed (the execution status of this line is deduced): const int which = highByte(glyph); | - |
1749 | Q_ASSERT(which < engines.size()); never executed (the execution status of this line is deduced): qt_noop(); | - |
1750 | return engine(which)->alphaMapForGlyph(stripped(glyph), t); never executed: return engine(which)->alphaMapForGlyph(stripped(glyph), t); | 0 |
1751 | } | - |
1752 | | - |
1753 | QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) | - |
1754 | { | - |
1755 | const int which = highByte(glyph); never executed (the execution status of this line is deduced): const int which = highByte(glyph); | - |
1756 | Q_ASSERT(which < engines.size()); never executed (the execution status of this line is deduced): qt_noop(); | - |
1757 | return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition, t); never executed: return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition, t); | 0 |
1758 | } | - |
1759 | | - |
1760 | QImage QFontEngineMulti::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) | - |
1761 | { | - |
1762 | const int which = highByte(glyph); never executed (the execution status of this line is deduced): const int which = highByte(glyph); | - |
1763 | Q_ASSERT(which < engines.size()); never executed (the execution status of this line is deduced): qt_noop(); | - |
1764 | return engine(which)->alphaRGBMapForGlyph(stripped(glyph), subPixelPosition, t); never executed: return engine(which)->alphaRGBMapForGlyph(stripped(glyph), subPixelPosition, t); | 0 |
1765 | } | - |
1766 | | - |
1767 | QT_END_NAMESPACE | - |
1768 | | - |
| | |