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