Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/text/qfontengine.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||||||||
11 | static inline bool qtransform_equals_no_translate(const QTransform &a, const QTransform &b) | - | ||||||||||||||||||||||||||||||
12 | { | - | ||||||||||||||||||||||||||||||
13 | if (a.type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
14 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
15 | } else { | - | ||||||||||||||||||||||||||||||
16 | - | |||||||||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||||||||
18 | ((!(a.type() < QTransform::TxProject)) ? qt_assert("a.type() < QTransform::TxProject",__FILE__,68) : qt_noop()); | - | ||||||||||||||||||||||||||||||
19 | ((!(b.type() < QTransform::TxProject)) ? qt_assert("b.type() < QTransform::TxProject",__FILE__,69) : qt_noop()); | - | ||||||||||||||||||||||||||||||
20 | - | |||||||||||||||||||||||||||||||
21 | return never executed: a.m11() == b.m11()return a.m11() == b.m11() && a.m12() == b.m12() && a.m21() == b.m21() && a.m22() == b.m22();
never executed: return a.m11() == b.m11() && a.m12() == b.m12() && a.m21() == b.m21() && a.m22() == b.m22(); | 0 | ||||||||||||||||||||||||||||||
22 | && a.m12() == b.m12()
never executed: return a.m11() == b.m11() && a.m12() == b.m12() && a.m21() == b.m21() && a.m22() == b.m22(); | 0 | ||||||||||||||||||||||||||||||
23 | && a.m21() == b.m21()
never executed: return a.m11() == b.m11() && a.m12() == b.m12() && a.m21() == b.m21() && a.m22() == b.m22(); | 0 | ||||||||||||||||||||||||||||||
24 | && a.m22() == b.m22()
never executed: return a.m11() == b.m11() && a.m12() == b.m12() && a.m21() == b.m21() && a.m22() == b.m22(); | 0 | ||||||||||||||||||||||||||||||
25 | } | - | ||||||||||||||||||||||||||||||
26 | } | - | ||||||||||||||||||||||||||||||
27 | - | |||||||||||||||||||||||||||||||
28 | template<typename T> | - | ||||||||||||||||||||||||||||||
29 | static inline bool qSafeFromBigEndian(const uchar *source, const uchar *end, T *output) | - | ||||||||||||||||||||||||||||||
30 | { | - | ||||||||||||||||||||||||||||||
31 | if (source + sizeof(T) > end
| 0 | ||||||||||||||||||||||||||||||
32 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
33 | - | |||||||||||||||||||||||||||||||
34 | *output = qFromBigEndian<T>(source); | - | ||||||||||||||||||||||||||||||
35 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
36 | } | - | ||||||||||||||||||||||||||||||
37 | - | |||||||||||||||||||||||||||||||
38 | - | |||||||||||||||||||||||||||||||
39 | - | |||||||||||||||||||||||||||||||
40 | - | |||||||||||||||||||||||||||||||
41 | namespace { namespace Q_QGS_useHarfbuzzNG { typedef bool Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
never executed: }guard.store(QtGlobalStatic::Destroyed); never executed: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type (qgetenv("QT_HARFBUZZ") != "old"))) : value (qgetenv("QT_HARFBUZZ") != "old") { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of block never executed: &holder.value;return &holder.value; never executed: } } } static QGlobalStatic<bool, Q_QGS_useHarfbuzzNG::innerFunction, Q_QGS_useHarfbuzzNG::guard> useHarfbuzzNG;return &holder.value; | 0 | ||||||||||||||||||||||||||||||
42 | - | |||||||||||||||||||||||||||||||
43 | bool qt_useHarfbuzzNG() | - | ||||||||||||||||||||||||||||||
44 | { | - | ||||||||||||||||||||||||||||||
45 | return never executed: *useHarfbuzzNG();return *useHarfbuzzNG(); never executed: return *useHarfbuzzNG(); | 0 | ||||||||||||||||||||||||||||||
46 | } | - | ||||||||||||||||||||||||||||||
47 | - | |||||||||||||||||||||||||||||||
48 | - | |||||||||||||||||||||||||||||||
49 | static_assert(bool(sizeof(HB_Glyph) == sizeof(glyph_t)), "sizeof(HB_Glyph) == sizeof(glyph_t)"); | - | ||||||||||||||||||||||||||||||
50 | static_assert(bool(sizeof(HB_Fixed) == sizeof(QFixed)), "sizeof(HB_Fixed) == sizeof(QFixed)"); | - | ||||||||||||||||||||||||||||||
51 | - | |||||||||||||||||||||||||||||||
52 | static HB_Bool hb_stringToGlyphs(HB_Font font, const HB_UChar16 *string, hb_uint32 length, HB_Glyph *glyphs, hb_uint32 *numGlyphs, HB_Bool rightToLeft) | - | ||||||||||||||||||||||||||||||
53 | { | - | ||||||||||||||||||||||||||||||
54 | QFontEngine *fe = (QFontEngine *)font->userData; | - | ||||||||||||||||||||||||||||||
55 | - | |||||||||||||||||||||||||||||||
56 | const QChar *str = reinterpret_cast<const QChar *>(string); | - | ||||||||||||||||||||||||||||||
57 | - | |||||||||||||||||||||||||||||||
58 | QGlyphLayout qglyphs; | - | ||||||||||||||||||||||||||||||
59 | qglyphs.numGlyphs = *numGlyphs; | - | ||||||||||||||||||||||||||||||
60 | qglyphs.glyphs = glyphs; | - | ||||||||||||||||||||||||||||||
61 | int nGlyphs = *numGlyphs; | - | ||||||||||||||||||||||||||||||
62 | bool result = fe->stringToCMap(str, length, &qglyphs, &nGlyphs, QFontEngine::GlyphIndicesOnly); | - | ||||||||||||||||||||||||||||||
63 | *numGlyphs = nGlyphs; | - | ||||||||||||||||||||||||||||||
64 | - | |||||||||||||||||||||||||||||||
65 | if (rightToLeft
| 0 | ||||||||||||||||||||||||||||||
66 | QStringIterator it(str, str + length); | - | ||||||||||||||||||||||||||||||
67 | while (it.hasNext()
| 0 | ||||||||||||||||||||||||||||||
68 | const uint ucs4 = it.next(); | - | ||||||||||||||||||||||||||||||
69 | const uint mirrored = QChar::mirroredChar(ucs4); | - | ||||||||||||||||||||||||||||||
70 | if (__builtin_expect(!!(mirrored != ucs4), false)
| 0 | ||||||||||||||||||||||||||||||
71 | * never executed: glyphs = fe->glyphIndex(mirrored);*glyphs = fe->glyphIndex(mirrored); never executed: *glyphs = fe->glyphIndex(mirrored); | 0 | ||||||||||||||||||||||||||||||
72 | ++glyphs; | - | ||||||||||||||||||||||||||||||
73 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
74 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
75 | - | |||||||||||||||||||||||||||||||
76 | return never executed: result;return result; never executed: return result; | 0 | ||||||||||||||||||||||||||||||
77 | } | - | ||||||||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||||||||
79 | static void hb_getAdvances(HB_Font font, const HB_Glyph *glyphs, hb_uint32 numGlyphs, HB_Fixed *advances, int flags) | - | ||||||||||||||||||||||||||||||
80 | { | - | ||||||||||||||||||||||||||||||
81 | QFontEngine *fe = (QFontEngine *)font->userData; | - | ||||||||||||||||||||||||||||||
82 | - | |||||||||||||||||||||||||||||||
83 | QGlyphLayout qglyphs; | - | ||||||||||||||||||||||||||||||
84 | qglyphs.numGlyphs = numGlyphs; | - | ||||||||||||||||||||||||||||||
85 | qglyphs.glyphs = const_cast<glyph_t *>(glyphs); | - | ||||||||||||||||||||||||||||||
86 | qglyphs.advances = reinterpret_cast<QFixed *>(advances); | - | ||||||||||||||||||||||||||||||
87 | - | |||||||||||||||||||||||||||||||
88 | fe->recalcAdvances(&qglyphs, (flags & HB_ShaperFlag_UseDesignMetrics) ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0)); | - | ||||||||||||||||||||||||||||||
89 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
90 | - | |||||||||||||||||||||||||||||||
91 | static HB_Bool hb_canRender(HB_Font font, const HB_UChar16 *string, hb_uint32 length) | - | ||||||||||||||||||||||||||||||
92 | { | - | ||||||||||||||||||||||||||||||
93 | QFontEngine *fe = (QFontEngine *)font->userData; | - | ||||||||||||||||||||||||||||||
94 | return never executed: fe->canRender(reinterpret_cast<const QChar *>(string), length);return fe->canRender(reinterpret_cast<const QChar *>(string), length); never executed: return fe->canRender(reinterpret_cast<const QChar *>(string), length); | 0 | ||||||||||||||||||||||||||||||
95 | } | - | ||||||||||||||||||||||||||||||
96 | - | |||||||||||||||||||||||||||||||
97 | static void hb_getGlyphMetrics(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics) | - | ||||||||||||||||||||||||||||||
98 | { | - | ||||||||||||||||||||||||||||||
99 | QFontEngine *fe = (QFontEngine *)font->userData; | - | ||||||||||||||||||||||||||||||
100 | glyph_metrics_t m = fe->boundingBox(glyph); | - | ||||||||||||||||||||||||||||||
101 | metrics->x = m.x.value(); | - | ||||||||||||||||||||||||||||||
102 | metrics->y = m.y.value(); | - | ||||||||||||||||||||||||||||||
103 | metrics->width = m.width.value(); | - | ||||||||||||||||||||||||||||||
104 | metrics->height = m.height.value(); | - | ||||||||||||||||||||||||||||||
105 | metrics->xOffset = m.xoff.value(); | - | ||||||||||||||||||||||||||||||
106 | metrics->yOffset = m.yoff.value(); | - | ||||||||||||||||||||||||||||||
107 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
108 | - | |||||||||||||||||||||||||||||||
109 | static HB_Fixed hb_getFontMetric(HB_Font font, HB_FontMetric metric) | - | ||||||||||||||||||||||||||||||
110 | { | - | ||||||||||||||||||||||||||||||
111 | if (metric == HB_FontAscent
| 0 | ||||||||||||||||||||||||||||||
112 | QFontEngine *fe = (QFontEngine *)font->userData; | - | ||||||||||||||||||||||||||||||
113 | return never executed: fe->ascent().value();return fe->ascent().value(); never executed: return fe->ascent().value(); | 0 | ||||||||||||||||||||||||||||||
114 | } | - | ||||||||||||||||||||||||||||||
115 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
116 | } | - | ||||||||||||||||||||||||||||||
117 | - | |||||||||||||||||||||||||||||||
118 | int QFontEngine::getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints) | - | ||||||||||||||||||||||||||||||
119 | { | - | ||||||||||||||||||||||||||||||
120 | (void)glyph; | - | ||||||||||||||||||||||||||||||
121 | (void)flags; | - | ||||||||||||||||||||||||||||||
122 | (void)point; | - | ||||||||||||||||||||||||||||||
123 | (void)xpos; | - | ||||||||||||||||||||||||||||||
124 | (void)ypos; | - | ||||||||||||||||||||||||||||||
125 | (void)nPoints; | - | ||||||||||||||||||||||||||||||
126 | return never executed: Err_Not_Covered;return Err_Not_Covered; never executed: return Err_Not_Covered; | 0 | ||||||||||||||||||||||||||||||
127 | } | - | ||||||||||||||||||||||||||||||
128 | - | |||||||||||||||||||||||||||||||
129 | 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) | - | ||||||||||||||||||||||||||||||
130 | { | - | ||||||||||||||||||||||||||||||
131 | QFontEngine *fe = (QFontEngine *)font->userData; | - | ||||||||||||||||||||||||||||||
132 | return never executed: (HB_Error)fe->getPointInOutline(glyph, flags, point, (QFixed *)xpos, (QFixed *)ypos, (quint32 *)nPoints);return (HB_Error)fe->getPointInOutline(glyph, flags, point, (QFixed *)xpos, (QFixed *)ypos, (quint32 *)nPoints); never executed: return (HB_Error)fe->getPointInOutline(glyph, flags, point, (QFixed *)xpos, (QFixed *)ypos, (quint32 *)nPoints); | 0 | ||||||||||||||||||||||||||||||
133 | } | - | ||||||||||||||||||||||||||||||
134 | - | |||||||||||||||||||||||||||||||
135 | static const HB_FontClass hb_fontClass = { | - | ||||||||||||||||||||||||||||||
136 | hb_stringToGlyphs, hb_getAdvances, hb_canRender, hb_getPointInOutline, | - | ||||||||||||||||||||||||||||||
137 | hb_getGlyphMetrics, hb_getFontMetric | - | ||||||||||||||||||||||||||||||
138 | }; | - | ||||||||||||||||||||||||||||||
139 | - | |||||||||||||||||||||||||||||||
140 | static HB_Error hb_getSFntTable(void *font, HB_Tag tableTag, HB_Byte *buffer, HB_UInt *length) | - | ||||||||||||||||||||||||||||||
141 | { | - | ||||||||||||||||||||||||||||||
142 | QFontEngine::FaceData *data = (QFontEngine::FaceData *)font; | - | ||||||||||||||||||||||||||||||
143 | ((!(data)) ? qt_assert("data",__FILE__,193) : qt_noop()); | - | ||||||||||||||||||||||||||||||
144 | - | |||||||||||||||||||||||||||||||
145 | qt_get_font_table_func_t get_font_table = data->get_font_table; | - | ||||||||||||||||||||||||||||||
146 | ((!(get_font_table)) ? qt_assert("get_font_table",__FILE__,196) : qt_noop()); | - | ||||||||||||||||||||||||||||||
147 | - | |||||||||||||||||||||||||||||||
148 | if (!get_font_table(data->user_data, tableTag, buffer, length)
| 0 | ||||||||||||||||||||||||||||||
149 | return never executed: HB_Err_Invalid_Argument;return HB_Err_Invalid_Argument; never executed: return HB_Err_Invalid_Argument; | 0 | ||||||||||||||||||||||||||||||
150 | return never executed: HB_Err_Ok;return HB_Err_Ok; never executed: return HB_Err_Ok; | 0 | ||||||||||||||||||||||||||||||
151 | } | - | ||||||||||||||||||||||||||||||
152 | - | |||||||||||||||||||||||||||||||
153 | static void hb_freeFace(void *face) | - | ||||||||||||||||||||||||||||||
154 | { | - | ||||||||||||||||||||||||||||||
155 | qHBFreeFace((HB_Face)face); | - | ||||||||||||||||||||||||||||||
156 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
157 | - | |||||||||||||||||||||||||||||||
158 | - | |||||||||||||||||||||||||||||||
159 | static bool qt_get_font_table_default(void *user_data, uint tag, uchar *buffer, uint *length) | - | ||||||||||||||||||||||||||||||
160 | { | - | ||||||||||||||||||||||||||||||
161 | QFontEngine *fe = (QFontEngine *)user_data; | - | ||||||||||||||||||||||||||||||
162 | return never executed: fe->getSfntTableData(tag, buffer, length);return fe->getSfntTableData(tag, buffer, length); never executed: return fe->getSfntTableData(tag, buffer, length); | 0 | ||||||||||||||||||||||||||||||
163 | } | - | ||||||||||||||||||||||||||||||
164 | - | |||||||||||||||||||||||||||||||
165 | - | |||||||||||||||||||||||||||||||
166 | - | |||||||||||||||||||||||||||||||
167 | - | |||||||||||||||||||||||||||||||
168 | static QList<QFontEngine *> *enginesCollector = 0; | - | ||||||||||||||||||||||||||||||
169 | - | |||||||||||||||||||||||||||||||
170 | __attribute__((visibility("default"))) void QFontEngine_startCollectingEngines() | - | ||||||||||||||||||||||||||||||
171 | { | - | ||||||||||||||||||||||||||||||
172 | delete enginesCollector; | - | ||||||||||||||||||||||||||||||
173 | enginesCollector = new QList<QFontEngine *>(); | - | ||||||||||||||||||||||||||||||
174 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
175 | - | |||||||||||||||||||||||||||||||
176 | __attribute__((visibility("default"))) QList<QFontEngine *> QFontEngine_stopCollectingEngines() | - | ||||||||||||||||||||||||||||||
177 | { | - | ||||||||||||||||||||||||||||||
178 | ((!(enginesCollector)) ? qt_assert("enginesCollector",__FILE__,228) : qt_noop()); | - | ||||||||||||||||||||||||||||||
179 | QList<QFontEngine *> ret = *enginesCollector; | - | ||||||||||||||||||||||||||||||
180 | delete enginesCollector; | - | ||||||||||||||||||||||||||||||
181 | enginesCollector = 0; | - | ||||||||||||||||||||||||||||||
182 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||||||||
183 | } | - | ||||||||||||||||||||||||||||||
184 | - | |||||||||||||||||||||||||||||||
185 | - | |||||||||||||||||||||||||||||||
186 | - | |||||||||||||||||||||||||||||||
187 | - | |||||||||||||||||||||||||||||||
188 | - | |||||||||||||||||||||||||||||||
189 | - | |||||||||||||||||||||||||||||||
190 | - | |||||||||||||||||||||||||||||||
191 | QFontEngine::QFontEngine(Type type) | - | ||||||||||||||||||||||||||||||
192 | : m_type(type), ref(0), | - | ||||||||||||||||||||||||||||||
193 | font_(0), font_destroy_func(0), | - | ||||||||||||||||||||||||||||||
194 | face_(0), face_destroy_func(0), | - | ||||||||||||||||||||||||||||||
195 | m_minLeftBearing(std::numeric_limits<qreal>::max()), | - | ||||||||||||||||||||||||||||||
196 | m_minRightBearing(std::numeric_limits<qreal>::max()) | - | ||||||||||||||||||||||||||||||
197 | { | - | ||||||||||||||||||||||||||||||
198 | faceData.user_data = this; | - | ||||||||||||||||||||||||||||||
199 | faceData.get_font_table = qt_get_font_table_default; | - | ||||||||||||||||||||||||||||||
200 | - | |||||||||||||||||||||||||||||||
201 | cache_cost = 0; | - | ||||||||||||||||||||||||||||||
202 | fsType = 0; | - | ||||||||||||||||||||||||||||||
203 | symbol = false; | - | ||||||||||||||||||||||||||||||
204 | isSmoothlyScalable = false; | - | ||||||||||||||||||||||||||||||
205 | - | |||||||||||||||||||||||||||||||
206 | glyphFormat = Format_None; | - | ||||||||||||||||||||||||||||||
207 | m_subPixelPositionCount = 0; | - | ||||||||||||||||||||||||||||||
208 | - | |||||||||||||||||||||||||||||||
209 | - | |||||||||||||||||||||||||||||||
210 | if (enginesCollector
| 0 | ||||||||||||||||||||||||||||||
211 | enginesCollector->append(this); never executed: enginesCollector->append(this); | 0 | ||||||||||||||||||||||||||||||
212 | - | |||||||||||||||||||||||||||||||
213 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
214 | - | |||||||||||||||||||||||||||||||
215 | QFontEngine::~QFontEngine() | - | ||||||||||||||||||||||||||||||
216 | { | - | ||||||||||||||||||||||||||||||
217 | m_glyphCaches.clear(); | - | ||||||||||||||||||||||||||||||
218 | - | |||||||||||||||||||||||||||||||
219 | if (font_
| 0 | ||||||||||||||||||||||||||||||
220 | font_destroy_func(font_); | - | ||||||||||||||||||||||||||||||
221 | font_ = 0; | - | ||||||||||||||||||||||||||||||
222 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
223 | if (face_
| 0 | ||||||||||||||||||||||||||||||
224 | face_destroy_func(face_); | - | ||||||||||||||||||||||||||||||
225 | face_ = 0; | - | ||||||||||||||||||||||||||||||
226 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
227 | - | |||||||||||||||||||||||||||||||
228 | - | |||||||||||||||||||||||||||||||
229 | if (enginesCollector
| 0 | ||||||||||||||||||||||||||||||
230 | enginesCollector->removeOne(this); never executed: enginesCollector->removeOne(this); | 0 | ||||||||||||||||||||||||||||||
231 | - | |||||||||||||||||||||||||||||||
232 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
233 | - | |||||||||||||||||||||||||||||||
234 | QFixed QFontEngine::lineThickness() const | - | ||||||||||||||||||||||||||||||
235 | { | - | ||||||||||||||||||||||||||||||
236 | - | |||||||||||||||||||||||||||||||
237 | int score = fontDef.weight * fontDef.pixelSize; | - | ||||||||||||||||||||||||||||||
238 | int lw = score / 700; | - | ||||||||||||||||||||||||||||||
239 | - | |||||||||||||||||||||||||||||||
240 | - | |||||||||||||||||||||||||||||||
241 | if (lw < 2
never executed: lw = 2; | 0 | ||||||||||||||||||||||||||||||
242 | if (lw == 0
never executed: lw = 1; | 0 | ||||||||||||||||||||||||||||||
243 | - | |||||||||||||||||||||||||||||||
244 | return never executed: lw;return lw; never executed: return lw; | 0 | ||||||||||||||||||||||||||||||
245 | } | - | ||||||||||||||||||||||||||||||
246 | - | |||||||||||||||||||||||||||||||
247 | QFixed QFontEngine::underlinePosition() const | - | ||||||||||||||||||||||||||||||
248 | { | - | ||||||||||||||||||||||||||||||
249 | return never executed: ((lineThickness() * 2) + 3) / 6;return ((lineThickness() * 2) + 3) / 6; never executed: return ((lineThickness() * 2) + 3) / 6; | 0 | ||||||||||||||||||||||||||||||
250 | } | - | ||||||||||||||||||||||||||||||
251 | - | |||||||||||||||||||||||||||||||
252 | void *QFontEngine::harfbuzzFont() const | - | ||||||||||||||||||||||||||||||
253 | { | - | ||||||||||||||||||||||||||||||
254 | ((!(type() != QFontEngine::Multi)) ? qt_assert("type() != QFontEngine::Multi",__FILE__,304) : qt_noop()); | - | ||||||||||||||||||||||||||||||
255 | - | |||||||||||||||||||||||||||||||
256 | if (qt_useHarfbuzzNG()
| 0 | ||||||||||||||||||||||||||||||
257 | return never executed: hb_qt_font_get_for_engine(const_cast<QFontEngine *>(this));return hb_qt_font_get_for_engine(const_cast<QFontEngine *>(this)); never executed: return hb_qt_font_get_for_engine(const_cast<QFontEngine *>(this)); | 0 | ||||||||||||||||||||||||||||||
258 | - | |||||||||||||||||||||||||||||||
259 | if (!font_
| 0 | ||||||||||||||||||||||||||||||
260 | HB_Face hbFace = (HB_Face)harfbuzzFace(); | - | ||||||||||||||||||||||||||||||
261 | if (hbFace->font_for_init
| 0 | ||||||||||||||||||||||||||||||
262 | void *data = hbFace->font_for_init; | - | ||||||||||||||||||||||||||||||
263 | q_check_ptr(qHBLoadFace(hbFace)); | - | ||||||||||||||||||||||||||||||
264 | free(data); | - | ||||||||||||||||||||||||||||||
265 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||||||||
267 | HB_FontRec *hbFont = (HB_FontRec *) malloc(sizeof(HB_FontRec)); | - | ||||||||||||||||||||||||||||||
268 | do {if(!(hbFont)
never executed: } while (0);qt_check_pointer(__FILE__,318); | 0 | ||||||||||||||||||||||||||||||
269 | hbFont->klass = &hb_fontClass; | - | ||||||||||||||||||||||||||||||
270 | hbFont->userData = const_cast<QFontEngine *>(this); | - | ||||||||||||||||||||||||||||||
271 | - | |||||||||||||||||||||||||||||||
272 | qint64 emSquare = emSquareSize().truncate(); | - | ||||||||||||||||||||||||||||||
273 | ((!(emSquare == emSquareSize().toInt())) ? qt_assert("emSquare == emSquareSize().toInt()",__FILE__,323) : qt_noop()); | - | ||||||||||||||||||||||||||||||
274 | if (emSquare == 0
| 0 | ||||||||||||||||||||||||||||||
275 | emSquare = 1000; never executed: emSquare = 1000; | 0 | ||||||||||||||||||||||||||||||
276 | hbFont->y_ppem = fontDef.pixelSize; | - | ||||||||||||||||||||||||||||||
277 | hbFont->x_ppem = fontDef.pixelSize * fontDef.stretch / 100; | - | ||||||||||||||||||||||||||||||
278 | - | |||||||||||||||||||||||||||||||
279 | hbFont->x_scale = (((qint64)hbFont->x_ppem << 6) * 0x10000L + (emSquare >> 1)) / emSquare; | - | ||||||||||||||||||||||||||||||
280 | hbFont->y_scale = (((qint64)hbFont->y_ppem << 6) * 0x10000L + (emSquare >> 1)) / emSquare; | - | ||||||||||||||||||||||||||||||
281 | - | |||||||||||||||||||||||||||||||
282 | font_ = (void *)hbFont; | - | ||||||||||||||||||||||||||||||
283 | font_destroy_func = free; | - | ||||||||||||||||||||||||||||||
284 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
285 | return never executed: font_;return font_; never executed: return font_; | 0 | ||||||||||||||||||||||||||||||
286 | } | - | ||||||||||||||||||||||||||||||
287 | - | |||||||||||||||||||||||||||||||
288 | void *QFontEngine::harfbuzzFace() const | - | ||||||||||||||||||||||||||||||
289 | { | - | ||||||||||||||||||||||||||||||
290 | ((!(type() != QFontEngine::Multi)) ? qt_assert("type() != QFontEngine::Multi",__FILE__,340) : qt_noop()); | - | ||||||||||||||||||||||||||||||
291 | - | |||||||||||||||||||||||||||||||
292 | if (qt_useHarfbuzzNG()
| 0 | ||||||||||||||||||||||||||||||
293 | return never executed: hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this));return hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this)); never executed: return hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this)); | 0 | ||||||||||||||||||||||||||||||
294 | - | |||||||||||||||||||||||||||||||
295 | if (!face_
| 0 | ||||||||||||||||||||||||||||||
296 | QFontEngine::FaceData *data = (QFontEngine::FaceData *)malloc(sizeof(QFontEngine::FaceData)); | - | ||||||||||||||||||||||||||||||
297 | do {if(!(data)
never executed: } while (0);qt_check_pointer(__FILE__,347); | 0 | ||||||||||||||||||||||||||||||
298 | data->user_data = faceData.user_data; | - | ||||||||||||||||||||||||||||||
299 | data->get_font_table = faceData.get_font_table; | - | ||||||||||||||||||||||||||||||
300 | - | |||||||||||||||||||||||||||||||
301 | HB_Face hbFace = qHBNewFace(data, hb_getSFntTable); | - | ||||||||||||||||||||||||||||||
302 | do {if(!(hbFace)
never executed: } while (0);qt_check_pointer(__FILE__,352); | 0 | ||||||||||||||||||||||||||||||
303 | hbFace->isSymbolFont = symbol; | - | ||||||||||||||||||||||||||||||
304 | - | |||||||||||||||||||||||||||||||
305 | face_ = (void *)hbFace; | - | ||||||||||||||||||||||||||||||
306 | face_destroy_func = hb_freeFace; | - | ||||||||||||||||||||||||||||||
307 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
308 | return never executed: face_;return face_; never executed: return face_; | 0 | ||||||||||||||||||||||||||||||
309 | } | - | ||||||||||||||||||||||||||||||
310 | - | |||||||||||||||||||||||||||||||
311 | bool QFontEngine::supportsScript(QChar::Script script) const | - | ||||||||||||||||||||||||||||||
312 | { | - | ||||||||||||||||||||||||||||||
313 | if (type() <= QFontEngine::Multi
| 0 | ||||||||||||||||||||||||||||||
314 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
315 | - | |||||||||||||||||||||||||||||||
316 | - | |||||||||||||||||||||||||||||||
317 | - | |||||||||||||||||||||||||||||||
318 | - | |||||||||||||||||||||||||||||||
319 | if (!((script >= QChar::Script_Syriac
| 0 | ||||||||||||||||||||||||||||||
320 | || script == QChar::Script_Khmer
| 0 | ||||||||||||||||||||||||||||||
321 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
322 | } | - | ||||||||||||||||||||||||||||||
323 | - | |||||||||||||||||||||||||||||||
324 | - | |||||||||||||||||||||||||||||||
325 | if (qt_useHarfbuzzNG()
| 0 | ||||||||||||||||||||||||||||||
326 | - | |||||||||||||||||||||||||||||||
327 | - | |||||||||||||||||||||||||||||||
328 | - | |||||||||||||||||||||||||||||||
329 | - | |||||||||||||||||||||||||||||||
330 | - | |||||||||||||||||||||||||||||||
331 | - | |||||||||||||||||||||||||||||||
332 | - | |||||||||||||||||||||||||||||||
333 | bool ret = false; | - | ||||||||||||||||||||||||||||||
334 | if (hb_face_t *face = hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this))
| 0 | ||||||||||||||||||||||||||||||
335 | hb_tag_t script_tag_1, script_tag_2; | - | ||||||||||||||||||||||||||||||
336 | hb_ot_tags_from_script(hb_qt_script_to_script(script), &script_tag_1, &script_tag_2); | - | ||||||||||||||||||||||||||||||
337 | - | |||||||||||||||||||||||||||||||
338 | unsigned int script_index; | - | ||||||||||||||||||||||||||||||
339 | ret = hb_ot_layout_table_find_script(face, ((hb_tag_t)((((uint8_t)('G'))<<24)|(((uint8_t)('S'))<<16)|(((uint8_t)('U'))<<8)|((uint8_t)('B')))), script_tag_1, &script_index); | - | ||||||||||||||||||||||||||||||
340 | if (!ret
| 0 | ||||||||||||||||||||||||||||||
341 | ret = hb_ot_layout_table_find_script(face, ((hb_tag_t)((((uint8_t)('G'))<<24)|(((uint8_t)('S'))<<16)|(((uint8_t)('U'))<<8)|((uint8_t)('B')))), script_tag_2, &script_index); | - | ||||||||||||||||||||||||||||||
342 | if (!ret
| 0 | ||||||||||||||||||||||||||||||
343 | ret = hb_ot_layout_table_find_script(face, ((hb_tag_t)((((uint8_t)('G'))<<24)|(((uint8_t)('S'))<<16)|(((uint8_t)('U'))<<8)|((uint8_t)('B')))), ((hb_tag_t)((((uint8_t)('D'))<<24)|(((uint8_t)('F'))<<16)|(((uint8_t)('L'))<<8)|((uint8_t)('T')))), &script_index); never executed: ret = hb_ot_layout_table_find_script(face, ((hb_tag_t)((((uint8_t)('G'))<<24)|(((uint8_t)('S'))<<16)|(((uint8_t)('U'))<<8)|((uint8_t)('B')))), ((hb_tag_t)((((uint8_t)('D'))<<24)|(((uint8_t)('F'))<<16)|(((uint8_t)('L'))<<8)|((uint8_t)('T')))), &script_index); | 0 | ||||||||||||||||||||||||||||||
344 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
345 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
346 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||||||||
347 | } | - | ||||||||||||||||||||||||||||||
348 | - | |||||||||||||||||||||||||||||||
349 | HB_Face hbFace = (HB_Face)harfbuzzFace(); | - | ||||||||||||||||||||||||||||||
350 | if (hbFace->font_for_init
| 0 | ||||||||||||||||||||||||||||||
351 | void *data = hbFace->font_for_init; | - | ||||||||||||||||||||||||||||||
352 | q_check_ptr(qHBLoadFace(hbFace)); | - | ||||||||||||||||||||||||||||||
353 | free(data); | - | ||||||||||||||||||||||||||||||
354 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
355 | return never executed: hbFace->supported_scripts[script_to_hbscript(script)];return hbFace->supported_scripts[script_to_hbscript(script)]; never executed: return hbFace->supported_scripts[script_to_hbscript(script)]; | 0 | ||||||||||||||||||||||||||||||
356 | } | - | ||||||||||||||||||||||||||||||
357 | - | |||||||||||||||||||||||||||||||
358 | bool QFontEngine::canRender(const QChar *str, int len) const | - | ||||||||||||||||||||||||||||||
359 | { | - | ||||||||||||||||||||||||||||||
360 | QStringIterator it(str, str + len); | - | ||||||||||||||||||||||||||||||
361 | while (it.hasNext()
| 0 | ||||||||||||||||||||||||||||||
362 | if (glyphIndex(it.next()) == 0
| 0 | ||||||||||||||||||||||||||||||
363 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
364 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
365 | - | |||||||||||||||||||||||||||||||
366 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
367 | } | - | ||||||||||||||||||||||||||||||
368 | - | |||||||||||||||||||||||||||||||
369 | glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix) | - | ||||||||||||||||||||||||||||||
370 | { | - | ||||||||||||||||||||||||||||||
371 | glyph_metrics_t metrics = boundingBox(glyph); | - | ||||||||||||||||||||||||||||||
372 | - | |||||||||||||||||||||||||||||||
373 | if (matrix.type() > QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
374 | return never executed: metrics.transformed(matrix);return metrics.transformed(matrix); never executed: return metrics.transformed(matrix); | 0 | ||||||||||||||||||||||||||||||
375 | } | - | ||||||||||||||||||||||||||||||
376 | return never executed: metrics;return metrics; never executed: return metrics; | 0 | ||||||||||||||||||||||||||||||
377 | } | - | ||||||||||||||||||||||||||||||
378 | - | |||||||||||||||||||||||||||||||
379 | QFixed QFontEngine::xHeight() const | - | ||||||||||||||||||||||||||||||
380 | { | - | ||||||||||||||||||||||||||||||
381 | const glyph_t glyph = glyphIndex('x'); | - | ||||||||||||||||||||||||||||||
382 | glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyph); | - | ||||||||||||||||||||||||||||||
383 | return never executed: bb.height;return bb.height; never executed: return bb.height; | 0 | ||||||||||||||||||||||||||||||
384 | } | - | ||||||||||||||||||||||||||||||
385 | - | |||||||||||||||||||||||||||||||
386 | QFixed QFontEngine::averageCharWidth() const | - | ||||||||||||||||||||||||||||||
387 | { | - | ||||||||||||||||||||||||||||||
388 | const glyph_t glyph = glyphIndex('x'); | - | ||||||||||||||||||||||||||||||
389 | glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyph); | - | ||||||||||||||||||||||||||||||
390 | return never executed: bb.xoff;return bb.xoff; never executed: return bb.xoff; | 0 | ||||||||||||||||||||||||||||||
391 | } | - | ||||||||||||||||||||||||||||||
392 | - | |||||||||||||||||||||||||||||||
393 | bool QFontEngine::supportsTransformation(const QTransform &transform) const | - | ||||||||||||||||||||||||||||||
394 | { | - | ||||||||||||||||||||||||||||||
395 | return never executed: transform.type() < QTransform::TxProject;return transform.type() < QTransform::TxProject; never executed: return transform.type() < QTransform::TxProject; | 0 | ||||||||||||||||||||||||||||||
396 | } | - | ||||||||||||||||||||||||||||||
397 | - | |||||||||||||||||||||||||||||||
398 | void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags, | - | ||||||||||||||||||||||||||||||
399 | QVarLengthArray<glyph_t> &glyphs_out, QVarLengthArray<QFixedPoint> &positions) | - | ||||||||||||||||||||||||||||||
400 | { | - | ||||||||||||||||||||||||||||||
401 | QFixed xpos; | - | ||||||||||||||||||||||||||||||
402 | QFixed ypos; | - | ||||||||||||||||||||||||||||||
403 | - | |||||||||||||||||||||||||||||||
404 | const bool transform = matrix.m11() != 1.
| 0 | ||||||||||||||||||||||||||||||
405 | || matrix.m12() != 0.
| 0 | ||||||||||||||||||||||||||||||
406 | || matrix.m21() != 0.
| 0 | ||||||||||||||||||||||||||||||
407 | || matrix.m22() != 1.
| 0 | ||||||||||||||||||||||||||||||
408 | if (!transform
| 0 | ||||||||||||||||||||||||||||||
409 | xpos = QFixed::fromReal(matrix.dx()); | - | ||||||||||||||||||||||||||||||
410 | ypos = QFixed::fromReal(matrix.dy()); | - | ||||||||||||||||||||||||||||||
411 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
412 | - | |||||||||||||||||||||||||||||||
413 | int current = 0; | - | ||||||||||||||||||||||||||||||
414 | if (flags & QTextItem::RightToLeft
| 0 | ||||||||||||||||||||||||||||||
415 | int i = glyphs.numGlyphs; | - | ||||||||||||||||||||||||||||||
416 | int totalKashidas = 0; | - | ||||||||||||||||||||||||||||||
417 | while(i--
| 0 | ||||||||||||||||||||||||||||||
418 | if (glyphs.attributes[i].dontPrint
| 0 | ||||||||||||||||||||||||||||||
419 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
420 | xpos += glyphs.advances[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6); | - | ||||||||||||||||||||||||||||||
421 | totalKashidas += glyphs.justifications[i].nKashidas; | - | ||||||||||||||||||||||||||||||
422 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
423 | positions.resize(glyphs.numGlyphs+totalKashidas); | - | ||||||||||||||||||||||||||||||
424 | glyphs_out.resize(glyphs.numGlyphs+totalKashidas); | - | ||||||||||||||||||||||||||||||
425 | - | |||||||||||||||||||||||||||||||
426 | i = 0; | - | ||||||||||||||||||||||||||||||
427 | while(i < glyphs.numGlyphs
| 0 | ||||||||||||||||||||||||||||||
428 | if (glyphs.attributes[i].dontPrint
| 0 | ||||||||||||||||||||||||||||||
429 | ++i; | - | ||||||||||||||||||||||||||||||
430 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
431 | } | - | ||||||||||||||||||||||||||||||
432 | xpos -= glyphs.advances[i]; | - | ||||||||||||||||||||||||||||||
433 | - | |||||||||||||||||||||||||||||||
434 | QFixed gpos_x = xpos + glyphs.offsets[i].x; | - | ||||||||||||||||||||||||||||||
435 | QFixed gpos_y = ypos + glyphs.offsets[i].y; | - | ||||||||||||||||||||||||||||||
436 | if (transform
| 0 | ||||||||||||||||||||||||||||||
437 | QPointF gpos(gpos_x.toReal(), gpos_y.toReal()); | - | ||||||||||||||||||||||||||||||
438 | gpos = gpos * matrix; | - | ||||||||||||||||||||||||||||||
439 | gpos_x = QFixed::fromReal(gpos.x()); | - | ||||||||||||||||||||||||||||||
440 | gpos_y = QFixed::fromReal(gpos.y()); | - | ||||||||||||||||||||||||||||||
441 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
442 | positions[current].x = gpos_x; | - | ||||||||||||||||||||||||||||||
443 | positions[current].y = gpos_y; | - | ||||||||||||||||||||||||||||||
444 | glyphs_out[current] = glyphs.glyphs[i]; | - | ||||||||||||||||||||||||||||||
445 | ++current; | - | ||||||||||||||||||||||||||||||
446 | if (glyphs.justifications[i].nKashidas
| 0 | ||||||||||||||||||||||||||||||
447 | QChar ch(0x640); | - | ||||||||||||||||||||||||||||||
448 | - | |||||||||||||||||||||||||||||||
449 | glyph_t kashidaGlyph = glyphIndex(ch.unicode()); | - | ||||||||||||||||||||||||||||||
450 | QFixed kashidaWidth; | - | ||||||||||||||||||||||||||||||
451 | - | |||||||||||||||||||||||||||||||
452 | QGlyphLayout g; | - | ||||||||||||||||||||||||||||||
453 | g.numGlyphs = 1; | - | ||||||||||||||||||||||||||||||
454 | g.glyphs = &kashidaGlyph; | - | ||||||||||||||||||||||||||||||
455 | g.advances = &kashidaWidth; | - | ||||||||||||||||||||||||||||||
456 | recalcAdvances(&g, 0); | - | ||||||||||||||||||||||||||||||
457 | - | |||||||||||||||||||||||||||||||
458 | for (uint k = 0; k < glyphs.justifications[i].nKashidas
| 0 | ||||||||||||||||||||||||||||||
459 | xpos -= kashidaWidth; | - | ||||||||||||||||||||||||||||||
460 | - | |||||||||||||||||||||||||||||||
461 | QFixed gpos_x = xpos + glyphs.offsets[i].x; | - | ||||||||||||||||||||||||||||||
462 | QFixed gpos_y = ypos + glyphs.offsets[i].y; | - | ||||||||||||||||||||||||||||||
463 | if (transform
| 0 | ||||||||||||||||||||||||||||||
464 | QPointF gpos(gpos_x.toReal(), gpos_y.toReal()); | - | ||||||||||||||||||||||||||||||
465 | gpos = gpos * matrix; | - | ||||||||||||||||||||||||||||||
466 | gpos_x = QFixed::fromReal(gpos.x()); | - | ||||||||||||||||||||||||||||||
467 | gpos_y = QFixed::fromReal(gpos.y()); | - | ||||||||||||||||||||||||||||||
468 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
469 | positions[current].x = gpos_x; | - | ||||||||||||||||||||||||||||||
470 | positions[current].y = gpos_y; | - | ||||||||||||||||||||||||||||||
471 | glyphs_out[current] = kashidaGlyph; | - | ||||||||||||||||||||||||||||||
472 | ++current; | - | ||||||||||||||||||||||||||||||
473 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
474 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
475 | xpos -= QFixed::fromFixed(glyphs.justifications[i].space_18d6); | - | ||||||||||||||||||||||||||||||
476 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
477 | ++i; | - | ||||||||||||||||||||||||||||||
478 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
479 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
480 | positions.resize(glyphs.numGlyphs); | - | ||||||||||||||||||||||||||||||
481 | glyphs_out.resize(glyphs.numGlyphs); | - | ||||||||||||||||||||||||||||||
482 | int i = 0; | - | ||||||||||||||||||||||||||||||
483 | if (!transform
| 0 | ||||||||||||||||||||||||||||||
484 | while (i < glyphs.numGlyphs
| 0 | ||||||||||||||||||||||||||||||
485 | if (!glyphs.attributes[i].dontPrint
| 0 | ||||||||||||||||||||||||||||||
486 | positions[current].x = xpos + glyphs.offsets[i].x; | - | ||||||||||||||||||||||||||||||
487 | positions[current].y = ypos + glyphs.offsets[i].y; | - | ||||||||||||||||||||||||||||||
488 | glyphs_out[current] = glyphs.glyphs[i]; | - | ||||||||||||||||||||||||||||||
489 | xpos += glyphs.advances[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6); | - | ||||||||||||||||||||||||||||||
490 | ++current; | - | ||||||||||||||||||||||||||||||
491 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
492 | ++i; | - | ||||||||||||||||||||||||||||||
493 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
494 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
495 | while (i < glyphs.numGlyphs
| 0 | ||||||||||||||||||||||||||||||
496 | if (!glyphs.attributes[i].dontPrint
| 0 | ||||||||||||||||||||||||||||||
497 | QFixed gpos_x = xpos + glyphs.offsets[i].x; | - | ||||||||||||||||||||||||||||||
498 | QFixed gpos_y = ypos + glyphs.offsets[i].y; | - | ||||||||||||||||||||||||||||||
499 | QPointF gpos(gpos_x.toReal(), gpos_y.toReal()); | - | ||||||||||||||||||||||||||||||
500 | gpos = gpos * matrix; | - | ||||||||||||||||||||||||||||||
501 | positions[current].x = QFixed::fromReal(gpos.x()); | - | ||||||||||||||||||||||||||||||
502 | positions[current].y = QFixed::fromReal(gpos.y()); | - | ||||||||||||||||||||||||||||||
503 | glyphs_out[current] = glyphs.glyphs[i]; | - | ||||||||||||||||||||||||||||||
504 | xpos += glyphs.advances[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6); | - | ||||||||||||||||||||||||||||||
505 | ++current; | - | ||||||||||||||||||||||||||||||
506 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
507 | ++i; | - | ||||||||||||||||||||||||||||||
508 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
509 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
510 | } | - | ||||||||||||||||||||||||||||||
511 | positions.resize(current); | - | ||||||||||||||||||||||||||||||
512 | glyphs_out.resize(current); | - | ||||||||||||||||||||||||||||||
513 | ((!(positions.size() == glyphs_out.size())) ? qt_assert("positions.size() == glyphs_out.size()",__FILE__,563) : qt_noop()); | - | ||||||||||||||||||||||||||||||
514 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
515 | - | |||||||||||||||||||||||||||||||
516 | void QFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing) | - | ||||||||||||||||||||||||||||||
517 | { | - | ||||||||||||||||||||||||||||||
518 | glyph_metrics_t gi = boundingBox(glyph); | - | ||||||||||||||||||||||||||||||
519 | if (leftBearing != 0
| 0 | ||||||||||||||||||||||||||||||
520 | * never executed: leftBearing = gi.leftBearing().toReal();*leftBearing = gi.leftBearing().toReal(); never executed: *leftBearing = gi.leftBearing().toReal(); | 0 | ||||||||||||||||||||||||||||||
521 | if (rightBearing != 0
| 0 | ||||||||||||||||||||||||||||||
522 | * never executed: rightBearing = gi.rightBearing().toReal();*rightBearing = gi.rightBearing().toReal(); never executed: *rightBearing = gi.rightBearing().toReal(); | 0 | ||||||||||||||||||||||||||||||
523 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
524 | - | |||||||||||||||||||||||||||||||
525 | qreal QFontEngine::minLeftBearing() const | - | ||||||||||||||||||||||||||||||
526 | { | - | ||||||||||||||||||||||||||||||
527 | if (m_minLeftBearing == std::numeric_limits<qreal>::max()
| 0 | ||||||||||||||||||||||||||||||
528 | minRightBearing(); never executed: minRightBearing(); | 0 | ||||||||||||||||||||||||||||||
529 | - | |||||||||||||||||||||||||||||||
530 | return never executed: m_minLeftBearing;return m_minLeftBearing; never executed: return m_minLeftBearing; | 0 | ||||||||||||||||||||||||||||||
531 | } | - | ||||||||||||||||||||||||||||||
532 | - | |||||||||||||||||||||||||||||||
533 | - | |||||||||||||||||||||||||||||||
534 | - | |||||||||||||||||||||||||||||||
535 | - | |||||||||||||||||||||||||||||||
536 | - | |||||||||||||||||||||||||||||||
537 | - | |||||||||||||||||||||||||||||||
538 | qreal QFontEngine::minRightBearing() const | - | ||||||||||||||||||||||||||||||
539 | { | - | ||||||||||||||||||||||||||||||
540 | if (m_minRightBearing == std::numeric_limits<qreal>::max()
| 0 | ||||||||||||||||||||||||||||||
541 | - | |||||||||||||||||||||||||||||||
542 | - | |||||||||||||||||||||||||||||||
543 | QByteArray hheaTable = getSfntTable(( (((quint32)('h')) << 24) | (((quint32)('h')) << 16) | (((quint32)('e')) << 8) | ((quint32)('a')) )); | - | ||||||||||||||||||||||||||||||
544 | if (hheaTable.size() >= int(14 + sizeof(qint16))
| 0 | ||||||||||||||||||||||||||||||
545 | const uchar *tableData = reinterpret_cast<const uchar *>(hheaTable.constData()); | - | ||||||||||||||||||||||||||||||
546 | ((!(((qFromBigEndian<quint32>(tableData)) / 65536.0) == 1.0)) ? qt_assert("q16Dot16ToFloat(qFromBigEndian<quint32>(tableData)) == 1.0",__FILE__,596) : qt_noop()); | - | ||||||||||||||||||||||||||||||
547 | - | |||||||||||||||||||||||||||||||
548 | qint16 minLeftSideBearing = qFromBigEndian<qint16>(tableData + 12); | - | ||||||||||||||||||||||||||||||
549 | qint16 minRightSideBearing = qFromBigEndian<qint16>(tableData + 14); | - | ||||||||||||||||||||||||||||||
550 | - | |||||||||||||||||||||||||||||||
551 | - | |||||||||||||||||||||||||||||||
552 | - | |||||||||||||||||||||||||||||||
553 | - | |||||||||||||||||||||||||||||||
554 | int unitsPerEm = emSquareSize().toInt(); | - | ||||||||||||||||||||||||||||||
555 | qreal funitToPixelFactor = fontDef.pixelSize / unitsPerEm; | - | ||||||||||||||||||||||||||||||
556 | - | |||||||||||||||||||||||||||||||
557 | - | |||||||||||||||||||||||||||||||
558 | - | |||||||||||||||||||||||||||||||
559 | - | |||||||||||||||||||||||||||||||
560 | - | |||||||||||||||||||||||||||||||
561 | static const int largestValidBearing = 4 * unitsPerEm; | - | ||||||||||||||||||||||||||||||
562 | - | |||||||||||||||||||||||||||||||
563 | if (qAbs(minLeftSideBearing) < largestValidBearing
| 0 | ||||||||||||||||||||||||||||||
564 | m_minLeftBearing = minLeftSideBearing * funitToPixelFactor; never executed: m_minLeftBearing = minLeftSideBearing * funitToPixelFactor; | 0 | ||||||||||||||||||||||||||||||
565 | if (qAbs(minRightSideBearing) < largestValidBearing
| 0 | ||||||||||||||||||||||||||||||
566 | m_minRightBearing = minRightSideBearing * funitToPixelFactor; never executed: m_minRightBearing = minRightSideBearing * funitToPixelFactor; | 0 | ||||||||||||||||||||||||||||||
567 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
568 | - | |||||||||||||||||||||||||||||||
569 | - | |||||||||||||||||||||||||||||||
570 | if (m_minLeftBearing == std::numeric_limits<qreal>::max()
| 0 | ||||||||||||||||||||||||||||||
571 | - | |||||||||||||||||||||||||||||||
572 | - | |||||||||||||||||||||||||||||||
573 | - | |||||||||||||||||||||||||||||||
574 | - | |||||||||||||||||||||||||||||||
575 | static const ushort characterSubset[] = { | - | ||||||||||||||||||||||||||||||
576 | '(', 'C', 'F', 'K', 'V', 'X', 'Y', ']', '_', 'f', 'r', '|', | - | ||||||||||||||||||||||||||||||
577 | 127, 205, 645, 884, 922, 1070, 12386 | - | ||||||||||||||||||||||||||||||
578 | }; | - | ||||||||||||||||||||||||||||||
579 | - | |||||||||||||||||||||||||||||||
580 | - | |||||||||||||||||||||||||||||||
581 | m_minLeftBearing = m_minRightBearing = std::numeric_limits<qreal>::max(); | - | ||||||||||||||||||||||||||||||
582 | - | |||||||||||||||||||||||||||||||
583 | for (uint i = 0; i < (sizeof(characterSubset) / sizeof(ushort))
| 0 | ||||||||||||||||||||||||||||||
584 | const glyph_t glyph = glyphIndex(characterSubset[i]); | - | ||||||||||||||||||||||||||||||
585 | if (!glyph
| 0 | ||||||||||||||||||||||||||||||
586 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
587 | - | |||||||||||||||||||||||||||||||
588 | glyph_metrics_t glyphMetrics = const_cast<QFontEngine *>(this)->boundingBox(glyph); | - | ||||||||||||||||||||||||||||||
589 | - | |||||||||||||||||||||||||||||||
590 | - | |||||||||||||||||||||||||||||||
591 | if (!glyphMetrics.width
| 0 | ||||||||||||||||||||||||||||||
592 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
593 | - | |||||||||||||||||||||||||||||||
594 | m_minLeftBearing = qMin(m_minLeftBearing, glyphMetrics.leftBearing().toReal()); | - | ||||||||||||||||||||||||||||||
595 | m_minRightBearing = qMin(m_minRightBearing, glyphMetrics.rightBearing().toReal()); | - | ||||||||||||||||||||||||||||||
596 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
597 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
598 | - | |||||||||||||||||||||||||||||||
599 | if (m_minLeftBearing == std::numeric_limits<qreal>::max()
| 0 | ||||||||||||||||||||||||||||||
600 | QMessageLogger(__FILE__, 650, __PRETTY_FUNCTION__).warning() << "Failed to compute left/right minimum bearings for" << fontDef.family; never executed: QMessageLogger(__FILE__, 650, __PRETTY_FUNCTION__).warning() << "Failed to compute left/right minimum bearings for" << fontDef.family; | 0 | ||||||||||||||||||||||||||||||
601 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
602 | - | |||||||||||||||||||||||||||||||
603 | return never executed: m_minRightBearing;return m_minRightBearing; never executed: return m_minRightBearing; | 0 | ||||||||||||||||||||||||||||||
604 | } | - | ||||||||||||||||||||||||||||||
605 | - | |||||||||||||||||||||||||||||||
606 | glyph_metrics_t QFontEngine::tightBoundingBox(const QGlyphLayout &glyphs) | - | ||||||||||||||||||||||||||||||
607 | { | - | ||||||||||||||||||||||||||||||
608 | glyph_metrics_t overall; | - | ||||||||||||||||||||||||||||||
609 | - | |||||||||||||||||||||||||||||||
610 | QFixed ymax = 0; | - | ||||||||||||||||||||||||||||||
611 | QFixed xmax = 0; | - | ||||||||||||||||||||||||||||||
612 | for (int i = 0; i < glyphs.numGlyphs
| 0 | ||||||||||||||||||||||||||||||
613 | glyph_metrics_t bb = boundingBox(glyphs.glyphs[i]); | - | ||||||||||||||||||||||||||||||
614 | QFixed x = overall.xoff + glyphs.offsets[i].x + bb.x; | - | ||||||||||||||||||||||||||||||
615 | QFixed y = overall.yoff + glyphs.offsets[i].y + bb.y; | - | ||||||||||||||||||||||||||||||
616 | overall.x = qMin(overall.x, x); | - | ||||||||||||||||||||||||||||||
617 | overall.y = qMin(overall.y, y); | - | ||||||||||||||||||||||||||||||
618 | xmax = qMax(xmax, x + bb.width); | - | ||||||||||||||||||||||||||||||
619 | ymax = qMax(ymax, y + bb.height); | - | ||||||||||||||||||||||||||||||
620 | overall.xoff += bb.xoff; | - | ||||||||||||||||||||||||||||||
621 | overall.yoff += bb.yoff; | - | ||||||||||||||||||||||||||||||
622 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
623 | overall.height = qMax(overall.height, ymax - overall.y); | - | ||||||||||||||||||||||||||||||
624 | overall.width = xmax - overall.x; | - | ||||||||||||||||||||||||||||||
625 | - | |||||||||||||||||||||||||||||||
626 | return never executed: overall;return overall; never executed: return overall; | 0 | ||||||||||||||||||||||||||||||
627 | } | - | ||||||||||||||||||||||||||||||
628 | - | |||||||||||||||||||||||||||||||
629 | - | |||||||||||||||||||||||||||||||
630 | void QFontEngine::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, | - | ||||||||||||||||||||||||||||||
631 | QTextItem::RenderFlags flags) | - | ||||||||||||||||||||||||||||||
632 | { | - | ||||||||||||||||||||||||||||||
633 | if (!glyphs.numGlyphs
| 0 | ||||||||||||||||||||||||||||||
634 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
635 | - | |||||||||||||||||||||||||||||||
636 | QVarLengthArray<QFixedPoint> positions; | - | ||||||||||||||||||||||||||||||
637 | QVarLengthArray<glyph_t> positioned_glyphs; | - | ||||||||||||||||||||||||||||||
638 | QTransform matrix = QTransform::fromTranslate(x, y); | - | ||||||||||||||||||||||||||||||
639 | getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions); | - | ||||||||||||||||||||||||||||||
640 | addGlyphsToPath(positioned_glyphs.data(), positions.data(), positioned_glyphs.size(), path, flags); | - | ||||||||||||||||||||||||||||||
641 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
642 | - | |||||||||||||||||||||||||||||||
643 | - | |||||||||||||||||||||||||||||||
644 | - | |||||||||||||||||||||||||||||||
645 | - | |||||||||||||||||||||||||||||||
646 | enum { EdgeRight = 0x1, | - | ||||||||||||||||||||||||||||||
647 | EdgeDown = 0x2, | - | ||||||||||||||||||||||||||||||
648 | EdgeLeft = 0x4, | - | ||||||||||||||||||||||||||||||
649 | EdgeUp = 0x8 | - | ||||||||||||||||||||||||||||||
650 | }; | - | ||||||||||||||||||||||||||||||
651 | - | |||||||||||||||||||||||||||||||
652 | static void collectSingleContour(qreal x0, qreal y0, uint *grid, int x, int y, int w, int h, QPainterPath *path) | - | ||||||||||||||||||||||||||||||
653 | { | - | ||||||||||||||||||||||||||||||
654 | (void)h;; | - | ||||||||||||||||||||||||||||||
655 | - | |||||||||||||||||||||||||||||||
656 | path->moveTo(x + x0, y + y0); | - | ||||||||||||||||||||||||||||||
657 | while (grid[(y)*(w+1) + (x)]
| 0 | ||||||||||||||||||||||||||||||
658 | if (grid[(y)*(w+1) + (x)] & EdgeRight
| 0 | ||||||||||||||||||||||||||||||
659 | while (grid[(y)*(w+1) + (x)] & EdgeRight
| 0 | ||||||||||||||||||||||||||||||
660 | grid[(y)*(w+1) + (x)] &= ~EdgeRight; | - | ||||||||||||||||||||||||||||||
661 | ++x; | - | ||||||||||||||||||||||||||||||
662 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
663 | ((!(x <= w)) ? qt_assert("x <= w",__FILE__,713) : qt_noop()); | - | ||||||||||||||||||||||||||||||
664 | path->lineTo(x + x0, y + y0); | - | ||||||||||||||||||||||||||||||
665 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
666 | } | - | ||||||||||||||||||||||||||||||
667 | if (grid[(y)*(w+1) + (x)] & EdgeDown
| 0 | ||||||||||||||||||||||||||||||
668 | while (grid[(y)*(w+1) + (x)] & EdgeDown
| 0 | ||||||||||||||||||||||||||||||
669 | grid[(y)*(w+1) + (x)] &= ~EdgeDown; | - | ||||||||||||||||||||||||||||||
670 | ++y; | - | ||||||||||||||||||||||||||||||
671 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
672 | ((!(y <= h)) ? qt_assert("y <= h",__FILE__,722) : qt_noop()); | - | ||||||||||||||||||||||||||||||
673 | path->lineTo(x + x0, y + y0); | - | ||||||||||||||||||||||||||||||
674 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
675 | } | - | ||||||||||||||||||||||||||||||
676 | if (grid[(y)*(w+1) + (x)] & EdgeLeft
| 0 | ||||||||||||||||||||||||||||||
677 | while (grid[(y)*(w+1) + (x)] & EdgeLeft
| 0 | ||||||||||||||||||||||||||||||
678 | grid[(y)*(w+1) + (x)] &= ~EdgeLeft; | - | ||||||||||||||||||||||||||||||
679 | --x; | - | ||||||||||||||||||||||||||||||
680 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
681 | ((!(x >= 0)) ? qt_assert("x >= 0",__FILE__,731) : qt_noop()); | - | ||||||||||||||||||||||||||||||
682 | path->lineTo(x + x0, y + y0); | - | ||||||||||||||||||||||||||||||
683 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
684 | } | - | ||||||||||||||||||||||||||||||
685 | if (grid[(y)*(w+1) + (x)] & EdgeUp
| 0 | ||||||||||||||||||||||||||||||
686 | while (grid[(y)*(w+1) + (x)] & EdgeUp
| 0 | ||||||||||||||||||||||||||||||
687 | grid[(y)*(w+1) + (x)] &= ~EdgeUp; | - | ||||||||||||||||||||||||||||||
688 | --y; | - | ||||||||||||||||||||||||||||||
689 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
690 | ((!(y >= 0)) ? qt_assert("y >= 0",__FILE__,740) : qt_noop()); | - | ||||||||||||||||||||||||||||||
691 | path->lineTo(x + x0, y + y0); | - | ||||||||||||||||||||||||||||||
692 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
693 | } | - | ||||||||||||||||||||||||||||||
694 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
695 | path->closeSubpath(); | - | ||||||||||||||||||||||||||||||
696 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
697 | - | |||||||||||||||||||||||||||||||
698 | __attribute__((visibility("default"))) void qt_addBitmapToPath(qreal x0, qreal y0, const uchar *image_data, int bpl, int w, int h, QPainterPath *path) | - | ||||||||||||||||||||||||||||||
699 | { | - | ||||||||||||||||||||||||||||||
700 | uint *grid = new uint[(w+1)*(h+1)]; | - | ||||||||||||||||||||||||||||||
701 | - | |||||||||||||||||||||||||||||||
702 | for (int y = 0; y <= h
| 0 | ||||||||||||||||||||||||||||||
703 | for (int x = 0; x <= w
| 0 | ||||||||||||||||||||||||||||||
704 | bool topLeft = (
| 0 | ||||||||||||||||||||||||||||||
705 | bool topRight = (
| 0 | ||||||||||||||||||||||||||||||
706 | bool bottomLeft = (
| 0 | ||||||||||||||||||||||||||||||
707 | bool bottomRight = (
| 0 | ||||||||||||||||||||||||||||||
708 | - | |||||||||||||||||||||||||||||||
709 | grid[(y)*(w+1) + (x)] = 0; | - | ||||||||||||||||||||||||||||||
710 | if ((
| 0 | ||||||||||||||||||||||||||||||
711 | grid[(y)*(w+1) + (x)] |= EdgeRight; never executed: grid[(y)*(w+1) + (x)] |= EdgeRight; | 0 | ||||||||||||||||||||||||||||||
712 | if ((
| 0 | ||||||||||||||||||||||||||||||
713 | grid[(y)*(w+1) + (x)] |= EdgeDown; never executed: grid[(y)*(w+1) + (x)] |= EdgeDown; | 0 | ||||||||||||||||||||||||||||||
714 | if ((
| 0 | ||||||||||||||||||||||||||||||
715 | grid[(y)*(w+1) + (x)] |= EdgeLeft; never executed: grid[(y)*(w+1) + (x)] |= EdgeLeft; | 0 | ||||||||||||||||||||||||||||||
716 | if ((
| 0 | ||||||||||||||||||||||||||||||
717 | grid[(y)*(w+1) + (x)] |= EdgeUp; never executed: grid[(y)*(w+1) + (x)] |= EdgeUp; | 0 | ||||||||||||||||||||||||||||||
718 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
719 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
720 | - | |||||||||||||||||||||||||||||||
721 | - | |||||||||||||||||||||||||||||||
722 | for (int y = 0; y < h
| 0 | ||||||||||||||||||||||||||||||
723 | for (int x = 0; x < w
| 0 | ||||||||||||||||||||||||||||||
724 | if (!grid[(y)*(w+1) + (x)]
| 0 | ||||||||||||||||||||||||||||||
725 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
726 | - | |||||||||||||||||||||||||||||||
727 | collectSingleContour(x0, y0, grid, x, y, w, h, path); | - | ||||||||||||||||||||||||||||||
728 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
729 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
730 | delete [] grid; | - | ||||||||||||||||||||||||||||||
731 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
732 | - | |||||||||||||||||||||||||||||||
733 | - | |||||||||||||||||||||||||||||||
734 | - | |||||||||||||||||||||||||||||||
735 | - | |||||||||||||||||||||||||||||||
736 | - | |||||||||||||||||||||||||||||||
737 | void QFontEngine::addBitmapFontToPath(qreal x, qreal y, const QGlyphLayout &glyphs, | - | ||||||||||||||||||||||||||||||
738 | QPainterPath *path, QTextItem::RenderFlags flags) | - | ||||||||||||||||||||||||||||||
739 | { | - | ||||||||||||||||||||||||||||||
740 | - | |||||||||||||||||||||||||||||||
741 | (void)flags;; | - | ||||||||||||||||||||||||||||||
742 | QFixed advanceX = QFixed::fromReal(x); | - | ||||||||||||||||||||||||||||||
743 | QFixed advanceY = QFixed::fromReal(y); | - | ||||||||||||||||||||||||||||||
744 | for (int i=0; i < glyphs.numGlyphs
| 0 | ||||||||||||||||||||||||||||||
745 | glyph_metrics_t metrics = boundingBox(glyphs.glyphs[i]); | - | ||||||||||||||||||||||||||||||
746 | if (metrics.width.value() == 0
| 0 | ||||||||||||||||||||||||||||||
747 | advanceX += glyphs.advances[i]; | - | ||||||||||||||||||||||||||||||
748 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
749 | } | - | ||||||||||||||||||||||||||||||
750 | const QImage alphaMask = alphaMapForGlyph(glyphs.glyphs[i]); | - | ||||||||||||||||||||||||||||||
751 | - | |||||||||||||||||||||||||||||||
752 | const int w = alphaMask.width(); | - | ||||||||||||||||||||||||||||||
753 | const int h = alphaMask.height(); | - | ||||||||||||||||||||||||||||||
754 | const int srcBpl = alphaMask.bytesPerLine(); | - | ||||||||||||||||||||||||||||||
755 | QImage bitmap; | - | ||||||||||||||||||||||||||||||
756 | if (alphaMask.depth() == 1
| 0 | ||||||||||||||||||||||||||||||
757 | bitmap = alphaMask; | - | ||||||||||||||||||||||||||||||
758 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
759 | bitmap = QImage(w, h, QImage::Format_Mono); | - | ||||||||||||||||||||||||||||||
760 | const uchar *imageData = alphaMask.bits(); | - | ||||||||||||||||||||||||||||||
761 | const int destBpl = bitmap.bytesPerLine(); | - | ||||||||||||||||||||||||||||||
762 | uchar *bitmapData = bitmap.bits(); | - | ||||||||||||||||||||||||||||||
763 | - | |||||||||||||||||||||||||||||||
764 | for (int yi = 0; yi < h
| 0 | ||||||||||||||||||||||||||||||
765 | const uchar *src = imageData + yi*srcBpl; | - | ||||||||||||||||||||||||||||||
766 | uchar *dst = bitmapData + yi*destBpl; | - | ||||||||||||||||||||||||||||||
767 | for (int xi = 0; xi < w
| 0 | ||||||||||||||||||||||||||||||
768 | const int byte = xi / 8; | - | ||||||||||||||||||||||||||||||
769 | const int bit = xi % 8; | - | ||||||||||||||||||||||||||||||
770 | if (bit == 0
| 0 | ||||||||||||||||||||||||||||||
771 | dst[byte] = 0; never executed: dst[byte] = 0; | 0 | ||||||||||||||||||||||||||||||
772 | if (src[xi]
| 0 | ||||||||||||||||||||||||||||||
773 | dst[byte] |= 128 >> bit; never executed: dst[byte] |= 128 >> bit; | 0 | ||||||||||||||||||||||||||||||
774 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
775 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
776 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
777 | const uchar *bitmap_data = bitmap.constBits(); | - | ||||||||||||||||||||||||||||||
778 | QFixedPoint offset = glyphs.offsets[i]; | - | ||||||||||||||||||||||||||||||
779 | advanceX += offset.x; | - | ||||||||||||||||||||||||||||||
780 | advanceY += offset.y; | - | ||||||||||||||||||||||||||||||
781 | qt_addBitmapToPath((advanceX + metrics.x).toReal(), (advanceY + metrics.y).toReal(), bitmap_data, bitmap.bytesPerLine(), w, h, path); | - | ||||||||||||||||||||||||||||||
782 | advanceX += glyphs.advances[i]; | - | ||||||||||||||||||||||||||||||
783 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
784 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
785 | - | |||||||||||||||||||||||||||||||
786 | void QFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nGlyphs, | - | ||||||||||||||||||||||||||||||
787 | QPainterPath *path, QTextItem::RenderFlags flags) | - | ||||||||||||||||||||||||||||||
788 | { | - | ||||||||||||||||||||||||||||||
789 | qreal x = positions[0].x.toReal(); | - | ||||||||||||||||||||||||||||||
790 | qreal y = positions[0].y.toReal(); | - | ||||||||||||||||||||||||||||||
791 | QVarLengthGlyphLayoutArray g(nGlyphs); | - | ||||||||||||||||||||||||||||||
792 | - | |||||||||||||||||||||||||||||||
793 | for (int i = 0; i < nGlyphs - 1
| 0 | ||||||||||||||||||||||||||||||
794 | g.glyphs[i] = glyphs[i]; | - | ||||||||||||||||||||||||||||||
795 | g.advances[i] = positions[i + 1].x - positions[i].x; | - | ||||||||||||||||||||||||||||||
796 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
797 | g.glyphs[nGlyphs - 1] = glyphs[nGlyphs - 1]; | - | ||||||||||||||||||||||||||||||
798 | g.advances[nGlyphs - 1] = QFixed::fromReal(maxCharWidth()); | - | ||||||||||||||||||||||||||||||
799 | - | |||||||||||||||||||||||||||||||
800 | addBitmapFontToPath(x, y, g, path, flags); | - | ||||||||||||||||||||||||||||||
801 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
802 | - | |||||||||||||||||||||||||||||||
803 | QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed ) | - | ||||||||||||||||||||||||||||||
804 | { | - | ||||||||||||||||||||||||||||||
805 | - | |||||||||||||||||||||||||||||||
806 | return never executed: alphaMapForGlyph(glyph);return alphaMapForGlyph(glyph); never executed: return alphaMapForGlyph(glyph); | 0 | ||||||||||||||||||||||||||||||
807 | } | - | ||||||||||||||||||||||||||||||
808 | - | |||||||||||||||||||||||||||||||
809 | QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t) | - | ||||||||||||||||||||||||||||||
810 | { | - | ||||||||||||||||||||||||||||||
811 | QImage i = alphaMapForGlyph(glyph); | - | ||||||||||||||||||||||||||||||
812 | if (t.type() > QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
813 | i = i.transformed(t).convertToFormat(QImage::Format_Alpha8); never executed: i = i.transformed(t).convertToFormat(QImage::Format_Alpha8); | 0 | ||||||||||||||||||||||||||||||
814 | ((!(i.depth() <= 8)) ? qt_assert("i.depth() <= 8",__FILE__,864) : qt_noop()); | - | ||||||||||||||||||||||||||||||
815 | - | |||||||||||||||||||||||||||||||
816 | return never executed: i;return i; never executed: return i; | 0 | ||||||||||||||||||||||||||||||
817 | } | - | ||||||||||||||||||||||||||||||
818 | - | |||||||||||||||||||||||||||||||
819 | QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) | - | ||||||||||||||||||||||||||||||
820 | { | - | ||||||||||||||||||||||||||||||
821 | if (! supportsSubPixelPositions()
| 0 | ||||||||||||||||||||||||||||||
822 | return never executed: alphaMapForGlyph(glyph, t);return alphaMapForGlyph(glyph, t); never executed: return alphaMapForGlyph(glyph, t); | 0 | ||||||||||||||||||||||||||||||
823 | - | |||||||||||||||||||||||||||||||
824 | QImage i = alphaMapForGlyph(glyph, subPixelPosition); | - | ||||||||||||||||||||||||||||||
825 | if (t.type() > QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
826 | i = i.transformed(t).convertToFormat(QImage::Format_Alpha8); never executed: i = i.transformed(t).convertToFormat(QImage::Format_Alpha8); | 0 | ||||||||||||||||||||||||||||||
827 | ((!(i.depth() <= 8)) ? qt_assert("i.depth() <= 8",__FILE__,877) : qt_noop()); | - | ||||||||||||||||||||||||||||||
828 | - | |||||||||||||||||||||||||||||||
829 | return never executed: i;return i; never executed: return i; | 0 | ||||||||||||||||||||||||||||||
830 | } | - | ||||||||||||||||||||||||||||||
831 | - | |||||||||||||||||||||||||||||||
832 | QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed , const QTransform &t) | - | ||||||||||||||||||||||||||||||
833 | { | - | ||||||||||||||||||||||||||||||
834 | const QImage alphaMask = alphaMapForGlyph(glyph, t); | - | ||||||||||||||||||||||||||||||
835 | QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32); | - | ||||||||||||||||||||||||||||||
836 | - | |||||||||||||||||||||||||||||||
837 | for (int y=0; y<alphaMask.height()
| 0 | ||||||||||||||||||||||||||||||
838 | uint *dst = (uint *) rgbMask.scanLine(y); | - | ||||||||||||||||||||||||||||||
839 | const uchar *src = alphaMask.constScanLine(y); | - | ||||||||||||||||||||||||||||||
840 | for (int x=0; x<alphaMask.width()
| 0 | ||||||||||||||||||||||||||||||
841 | int val = src[x]; | - | ||||||||||||||||||||||||||||||
842 | dst[x] = qRgb(val, val, val); | - | ||||||||||||||||||||||||||||||
843 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
844 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
845 | - | |||||||||||||||||||||||||||||||
846 | return never executed: rgbMask;return rgbMask; never executed: return rgbMask; | 0 | ||||||||||||||||||||||||||||||
847 | } | - | ||||||||||||||||||||||||||||||
848 | - | |||||||||||||||||||||||||||||||
849 | QImage QFontEngine::bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform&) | - | ||||||||||||||||||||||||||||||
850 | { | - | ||||||||||||||||||||||||||||||
851 | (void)subPixelPosition;; | - | ||||||||||||||||||||||||||||||
852 | - | |||||||||||||||||||||||||||||||
853 | return never executed: QImage();return QImage(); never executed: return QImage(); | 0 | ||||||||||||||||||||||||||||||
854 | } | - | ||||||||||||||||||||||||||||||
855 | - | |||||||||||||||||||||||||||||||
856 | QFixed QFontEngine::subPixelPositionForX(QFixed x) const | - | ||||||||||||||||||||||||||||||
857 | { | - | ||||||||||||||||||||||||||||||
858 | if (m_subPixelPositionCount <= 1
| 0 | ||||||||||||||||||||||||||||||
859 | return never executed: QFixed();return QFixed(); never executed: return QFixed(); | 0 | ||||||||||||||||||||||||||||||
860 | - | |||||||||||||||||||||||||||||||
861 | QFixed subPixelPosition; | - | ||||||||||||||||||||||||||||||
862 | if (x != 0
| 0 | ||||||||||||||||||||||||||||||
863 | subPixelPosition = x - x.floor(); | - | ||||||||||||||||||||||||||||||
864 | QFixed fraction = (subPixelPosition / QFixed::fromReal(1.0 / m_subPixelPositionCount)).floor(); | - | ||||||||||||||||||||||||||||||
865 | - | |||||||||||||||||||||||||||||||
866 | - | |||||||||||||||||||||||||||||||
867 | - | |||||||||||||||||||||||||||||||
868 | subPixelPosition = fraction / QFixed(m_subPixelPositionCount) + QFixed::fromReal(0.015625); | - | ||||||||||||||||||||||||||||||
869 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
870 | return never executed: subPixelPosition;return subPixelPosition; never executed: return subPixelPosition; | 0 | ||||||||||||||||||||||||||||||
871 | } | - | ||||||||||||||||||||||||||||||
872 | - | |||||||||||||||||||||||||||||||
873 | QImage *QFontEngine::lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, | - | ||||||||||||||||||||||||||||||
874 | QFontEngine::GlyphFormat neededFormat, | - | ||||||||||||||||||||||||||||||
875 | const QTransform &t, QPoint *offset) | - | ||||||||||||||||||||||||||||||
876 | { | - | ||||||||||||||||||||||||||||||
877 | ((!(currentlyLockedAlphaMap.isNull())) ? qt_assert("currentlyLockedAlphaMap.isNull()",__FILE__,927) : qt_noop()); | - | ||||||||||||||||||||||||||||||
878 | if (neededFormat == Format_None
| 0 | ||||||||||||||||||||||||||||||
879 | neededFormat = Format_A32; never executed: neededFormat = Format_A32; | 0 | ||||||||||||||||||||||||||||||
880 | - | |||||||||||||||||||||||||||||||
881 | if (neededFormat != Format_A32
| 0 | ||||||||||||||||||||||||||||||
882 | currentlyLockedAlphaMap = alphaMapForGlyph(glyph, subPixelPosition, t); never executed: currentlyLockedAlphaMap = alphaMapForGlyph(glyph, subPixelPosition, t); | 0 | ||||||||||||||||||||||||||||||
883 | else | - | ||||||||||||||||||||||||||||||
884 | currentlyLockedAlphaMap = alphaRGBMapForGlyph(glyph, subPixelPosition, t); never executed: currentlyLockedAlphaMap = alphaRGBMapForGlyph(glyph, subPixelPosition, t); | 0 | ||||||||||||||||||||||||||||||
885 | - | |||||||||||||||||||||||||||||||
886 | if (offset != 0
| 0 | ||||||||||||||||||||||||||||||
887 | * never executed: offset = QPoint(0, 0);*offset = QPoint(0, 0); never executed: *offset = QPoint(0, 0); | 0 | ||||||||||||||||||||||||||||||
888 | - | |||||||||||||||||||||||||||||||
889 | return never executed: ¤tlyLockedAlphaMap;return ¤tlyLockedAlphaMap; never executed: return ¤tlyLockedAlphaMap; | 0 | ||||||||||||||||||||||||||||||
890 | } | - | ||||||||||||||||||||||||||||||
891 | - | |||||||||||||||||||||||||||||||
892 | void QFontEngine::unlockAlphaMapForGlyph() | - | ||||||||||||||||||||||||||||||
893 | { | - | ||||||||||||||||||||||||||||||
894 | ((!(!currentlyLockedAlphaMap.isNull())) ? qt_assert("!currentlyLockedAlphaMap.isNull()",__FILE__,944) : qt_noop()); | - | ||||||||||||||||||||||||||||||
895 | currentlyLockedAlphaMap = QImage(); | - | ||||||||||||||||||||||||||||||
896 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
897 | - | |||||||||||||||||||||||||||||||
898 | QImage QFontEngine::alphaMapForGlyph(glyph_t glyph) | - | ||||||||||||||||||||||||||||||
899 | { | - | ||||||||||||||||||||||||||||||
900 | glyph_metrics_t gm = boundingBox(glyph); | - | ||||||||||||||||||||||||||||||
901 | int glyph_x = qFloor(gm.x.toReal()); | - | ||||||||||||||||||||||||||||||
902 | int glyph_y = qFloor(gm.y.toReal()); | - | ||||||||||||||||||||||||||||||
903 | int glyph_width = qCeil((gm.x + gm.width).toReal()) - glyph_x; | - | ||||||||||||||||||||||||||||||
904 | int glyph_height = qCeil((gm.y + gm.height).toReal()) - glyph_y; | - | ||||||||||||||||||||||||||||||
905 | - | |||||||||||||||||||||||||||||||
906 | if (glyph_width <= 0
| 0 | ||||||||||||||||||||||||||||||
907 | return never executed: QImage();return QImage(); never executed: return QImage(); | 0 | ||||||||||||||||||||||||||||||
908 | QFixedPoint pt; | - | ||||||||||||||||||||||||||||||
909 | pt.x = -glyph_x; | - | ||||||||||||||||||||||||||||||
910 | pt.y = -glyph_y; | - | ||||||||||||||||||||||||||||||
911 | QPainterPath path; | - | ||||||||||||||||||||||||||||||
912 | path.setFillRule(Qt::WindingFill); | - | ||||||||||||||||||||||||||||||
913 | QImage im(glyph_width, glyph_height, QImage::Format_ARGB32_Premultiplied); | - | ||||||||||||||||||||||||||||||
914 | im.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||
915 | QPainter p(&im); | - | ||||||||||||||||||||||||||||||
916 | p.setRenderHint(QPainter::Antialiasing); | - | ||||||||||||||||||||||||||||||
917 | addGlyphsToPath(&glyph, &pt, 1, &path, 0); | - | ||||||||||||||||||||||||||||||
918 | p.setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||
919 | p.setBrush(Qt::black); | - | ||||||||||||||||||||||||||||||
920 | p.drawPath(path); | - | ||||||||||||||||||||||||||||||
921 | p.end(); | - | ||||||||||||||||||||||||||||||
922 | - | |||||||||||||||||||||||||||||||
923 | QImage alphaMap(im.width(), im.height(), QImage::Format_Alpha8); | - | ||||||||||||||||||||||||||||||
924 | - | |||||||||||||||||||||||||||||||
925 | for (int y=0; y<im.height()
| 0 | ||||||||||||||||||||||||||||||
926 | uchar *dst = (uchar *) alphaMap.scanLine(y); | - | ||||||||||||||||||||||||||||||
927 | const uint *src = reinterpret_cast<const uint *>(im.constScanLine(y)); | - | ||||||||||||||||||||||||||||||
928 | for (int x=0; x<im.width()
| 0 | ||||||||||||||||||||||||||||||
929 | dst[x] = qAlpha(src[x]); never executed: dst[x] = qAlpha(src[x]); | 0 | ||||||||||||||||||||||||||||||
930 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
931 | - | |||||||||||||||||||||||||||||||
932 | return never executed: alphaMap;return alphaMap; never executed: return alphaMap; | 0 | ||||||||||||||||||||||||||||||
933 | } | - | ||||||||||||||||||||||||||||||
934 | - | |||||||||||||||||||||||||||||||
935 | void QFontEngine::removeGlyphFromCache(glyph_t) | - | ||||||||||||||||||||||||||||||
936 | { | - | ||||||||||||||||||||||||||||||
937 | } | - | ||||||||||||||||||||||||||||||
938 | - | |||||||||||||||||||||||||||||||
939 | QFontEngine::Properties QFontEngine::properties() const | - | ||||||||||||||||||||||||||||||
940 | { | - | ||||||||||||||||||||||||||||||
941 | Properties p; | - | ||||||||||||||||||||||||||||||
942 | QByteArray psname = QFontEngine::convertToPostscriptFontFamilyName(fontDef.family.toUtf8()); | - | ||||||||||||||||||||||||||||||
943 | psname += '-'; | - | ||||||||||||||||||||||||||||||
944 | psname += QByteArray::number(fontDef.style); | - | ||||||||||||||||||||||||||||||
945 | psname += '-'; | - | ||||||||||||||||||||||||||||||
946 | psname += QByteArray::number(fontDef.weight); | - | ||||||||||||||||||||||||||||||
947 | - | |||||||||||||||||||||||||||||||
948 | p.postscriptName = psname; | - | ||||||||||||||||||||||||||||||
949 | p.ascent = ascent(); | - | ||||||||||||||||||||||||||||||
950 | p.descent = descent(); | - | ||||||||||||||||||||||||||||||
951 | p.leading = leading(); | - | ||||||||||||||||||||||||||||||
952 | p.emSquare = p.ascent; | - | ||||||||||||||||||||||||||||||
953 | p.boundingBox = QRectF(0, -p.ascent.toReal(), maxCharWidth(), (p.ascent + p.descent).toReal()); | - | ||||||||||||||||||||||||||||||
954 | p.italicAngle = 0; | - | ||||||||||||||||||||||||||||||
955 | p.capHeight = p.ascent; | - | ||||||||||||||||||||||||||||||
956 | p.lineWidth = lineThickness(); | - | ||||||||||||||||||||||||||||||
957 | return never executed: p;return p; never executed: return p; | 0 | ||||||||||||||||||||||||||||||
958 | } | - | ||||||||||||||||||||||||||||||
959 | - | |||||||||||||||||||||||||||||||
960 | void QFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) | - | ||||||||||||||||||||||||||||||
961 | { | - | ||||||||||||||||||||||||||||||
962 | *metrics = boundingBox(glyph); | - | ||||||||||||||||||||||||||||||
963 | QFixedPoint p; | - | ||||||||||||||||||||||||||||||
964 | p.x = 0; | - | ||||||||||||||||||||||||||||||
965 | p.y = 0; | - | ||||||||||||||||||||||||||||||
966 | addGlyphsToPath(&glyph, &p, 1, path, QFlag(0)); | - | ||||||||||||||||||||||||||||||
967 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
968 | bool QFontEngine::getSfntTableData(uint tag, uchar *buffer, uint *length) const | - | ||||||||||||||||||||||||||||||
969 | { | - | ||||||||||||||||||||||||||||||
970 | (void)tag; | - | ||||||||||||||||||||||||||||||
971 | (void)buffer; | - | ||||||||||||||||||||||||||||||
972 | (void)length; | - | ||||||||||||||||||||||||||||||
973 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
974 | } | - | ||||||||||||||||||||||||||||||
975 | - | |||||||||||||||||||||||||||||||
976 | QByteArray QFontEngine::getSfntTable(uint tag) const | - | ||||||||||||||||||||||||||||||
977 | { | - | ||||||||||||||||||||||||||||||
978 | QByteArray table; | - | ||||||||||||||||||||||||||||||
979 | uint len = 0; | - | ||||||||||||||||||||||||||||||
980 | if (!getSfntTableData(tag, 0, &len)
| 0 | ||||||||||||||||||||||||||||||
981 | return never executed: table;return table; never executed: return table; | 0 | ||||||||||||||||||||||||||||||
982 | table.resize(len); | - | ||||||||||||||||||||||||||||||
983 | if (!getSfntTableData(tag, reinterpret_cast<uchar *>(table.data()), &len)
| 0 | ||||||||||||||||||||||||||||||
984 | return never executed: QByteArray();return QByteArray(); never executed: return QByteArray(); | 0 | ||||||||||||||||||||||||||||||
985 | return never executed: table;return table; never executed: return table; | 0 | ||||||||||||||||||||||||||||||
986 | } | - | ||||||||||||||||||||||||||||||
987 | - | |||||||||||||||||||||||||||||||
988 | void QFontEngine::clearGlyphCache(const void *context) | - | ||||||||||||||||||||||||||||||
989 | { | - | ||||||||||||||||||||||||||||||
990 | m_glyphCaches.remove(context); | - | ||||||||||||||||||||||||||||||
991 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
992 | - | |||||||||||||||||||||||||||||||
993 | void QFontEngine::setGlyphCache(const void *context, QFontEngineGlyphCache *cache) | - | ||||||||||||||||||||||||||||||
994 | { | - | ||||||||||||||||||||||||||||||
995 | ((!(cache)) ? qt_assert("cache",__FILE__,1057) : qt_noop()); | - | ||||||||||||||||||||||||||||||
996 | - | |||||||||||||||||||||||||||||||
997 | GlyphCaches &caches = m_glyphCaches[context]; | - | ||||||||||||||||||||||||||||||
998 | for (GlyphCaches::const_iterator it = caches.constBegin(), end = caches.constEnd(); it != end
| 0 | ||||||||||||||||||||||||||||||
999 | if (cache == it->cache.data()
| 0 | ||||||||||||||||||||||||||||||
1000 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1001 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1002 | - | |||||||||||||||||||||||||||||||
1003 | - | |||||||||||||||||||||||||||||||
1004 | - | |||||||||||||||||||||||||||||||
1005 | if (caches.size() == 4
| 0 | ||||||||||||||||||||||||||||||
1006 | caches.removeLast(); never executed: caches.removeLast(); | 0 | ||||||||||||||||||||||||||||||
1007 | - | |||||||||||||||||||||||||||||||
1008 | GlyphCacheEntry entry; | - | ||||||||||||||||||||||||||||||
1009 | entry.cache = cache; | - | ||||||||||||||||||||||||||||||
1010 | caches.push_front(entry); | - | ||||||||||||||||||||||||||||||
1011 | - | |||||||||||||||||||||||||||||||
1012 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1013 | - | |||||||||||||||||||||||||||||||
1014 | QFontEngineGlyphCache *QFontEngine::glyphCache(const void *context, GlyphFormat format, const QTransform &transform) const | - | ||||||||||||||||||||||||||||||
1015 | { | - | ||||||||||||||||||||||||||||||
1016 | const QHash<const void*, GlyphCaches>::const_iterator caches = m_glyphCaches.constFind(context); | - | ||||||||||||||||||||||||||||||
1017 | if (caches == m_glyphCaches.cend()
| 0 | ||||||||||||||||||||||||||||||
1018 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||||||||||||||
1019 | - | |||||||||||||||||||||||||||||||
1020 | for (GlyphCaches::const_iterator it = caches->begin(), end = caches->end(); it != end
| 0 | ||||||||||||||||||||||||||||||
1021 | QFontEngineGlyphCache *cache = it->cache.data(); | - | ||||||||||||||||||||||||||||||
1022 | if (format == cache->glyphFormat()
| 0 | ||||||||||||||||||||||||||||||
1023 | return never executed: cache;return cache; never executed: return cache; | 0 | ||||||||||||||||||||||||||||||
1024 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1025 | - | |||||||||||||||||||||||||||||||
1026 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||||||||||||||
1027 | } | - | ||||||||||||||||||||||||||||||
1028 | - | |||||||||||||||||||||||||||||||
1029 | static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs) | - | ||||||||||||||||||||||||||||||
1030 | { | - | ||||||||||||||||||||||||||||||
1031 | uint left_right = (left << 16) + right; | - | ||||||||||||||||||||||||||||||
1032 | - | |||||||||||||||||||||||||||||||
1033 | left = 0, right = numPairs - 1; | - | ||||||||||||||||||||||||||||||
1034 | while (left <= right
| 0 | ||||||||||||||||||||||||||||||
1035 | int middle = left + ( ( right - left ) >> 1 ); | - | ||||||||||||||||||||||||||||||
1036 | - | |||||||||||||||||||||||||||||||
1037 | if(pairs[middle].left_right == left_right
| 0 | ||||||||||||||||||||||||||||||
1038 | return never executed: pairs[middle].adjust;return pairs[middle].adjust; never executed: return pairs[middle].adjust; | 0 | ||||||||||||||||||||||||||||||
1039 | - | |||||||||||||||||||||||||||||||
1040 | if (pairs[middle].left_right < left_right
| 0 | ||||||||||||||||||||||||||||||
1041 | left = middle + 1; never executed: left = middle + 1; | 0 | ||||||||||||||||||||||||||||||
1042 | else | - | ||||||||||||||||||||||||||||||
1043 | right = middle - 1; never executed: right = middle - 1; | 0 | ||||||||||||||||||||||||||||||
1044 | } | - | ||||||||||||||||||||||||||||||
1045 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1046 | } | - | ||||||||||||||||||||||||||||||
1047 | - | |||||||||||||||||||||||||||||||
1048 | void QFontEngine::doKerning(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const | - | ||||||||||||||||||||||||||||||
1049 | { | - | ||||||||||||||||||||||||||||||
1050 | int numPairs = kerning_pairs.size(); | - | ||||||||||||||||||||||||||||||
1051 | if(!numPairs
| 0 | ||||||||||||||||||||||||||||||
1052 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1053 | - | |||||||||||||||||||||||||||||||
1054 | const KernPair *pairs = kerning_pairs.constData(); | - | ||||||||||||||||||||||||||||||
1055 | - | |||||||||||||||||||||||||||||||
1056 | if (flags & DesignMetrics
| 0 | ||||||||||||||||||||||||||||||
1057 | for(int i = 0; i < glyphs->numGlyphs - 1
| 0 | ||||||||||||||||||||||||||||||
1058 | glyphs->advances[i] += kerning(glyphs->glyphs[i], glyphs->glyphs[i+1] , pairs, numPairs); never executed: glyphs->advances[i] += kerning(glyphs->glyphs[i], glyphs->glyphs[i+1] , pairs, numPairs); | 0 | ||||||||||||||||||||||||||||||
1059 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
1060 | for(int i = 0; i < glyphs->numGlyphs - 1
| 0 | ||||||||||||||||||||||||||||||
1061 | glyphs->advances[i] += qRound(kerning(glyphs->glyphs[i], glyphs->glyphs[i+1] , pairs, numPairs)); never executed: glyphs->advances[i] += qRound(kerning(glyphs->glyphs[i], glyphs->glyphs[i+1] , pairs, numPairs)); | 0 | ||||||||||||||||||||||||||||||
1062 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1063 | } | - | ||||||||||||||||||||||||||||||
1064 | - | |||||||||||||||||||||||||||||||
1065 | void QFontEngine::loadKerningPairs(QFixed scalingFactor) | - | ||||||||||||||||||||||||||||||
1066 | { | - | ||||||||||||||||||||||||||||||
1067 | kerning_pairs.clear(); | - | ||||||||||||||||||||||||||||||
1068 | - | |||||||||||||||||||||||||||||||
1069 | QByteArray tab = getSfntTable(( (((quint32)('k')) << 24) | (((quint32)('e')) << 16) | (((quint32)('r')) << 8) | ((quint32)('n')) )); | - | ||||||||||||||||||||||||||||||
1070 | if (tab.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
1071 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1072 | - | |||||||||||||||||||||||||||||||
1073 | const uchar *table = reinterpret_cast<const uchar *>(tab.constData()); | - | ||||||||||||||||||||||||||||||
1074 | const uchar *end = table + tab.size(); | - | ||||||||||||||||||||||||||||||
1075 | - | |||||||||||||||||||||||||||||||
1076 | quint16 version; | - | ||||||||||||||||||||||||||||||
1077 | if (!qSafeFromBigEndian(table, end, &version)
| 0 | ||||||||||||||||||||||||||||||
1078 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1079 | - | |||||||||||||||||||||||||||||||
1080 | if (version != 0
| 0 | ||||||||||||||||||||||||||||||
1081 | - | |||||||||||||||||||||||||||||||
1082 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1083 | } | - | ||||||||||||||||||||||||||||||
1084 | - | |||||||||||||||||||||||||||||||
1085 | quint16 numTables; | - | ||||||||||||||||||||||||||||||
1086 | if (!qSafeFromBigEndian(table + 2, end, &numTables)
| 0 | ||||||||||||||||||||||||||||||
1087 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1088 | - | |||||||||||||||||||||||||||||||
1089 | { | - | ||||||||||||||||||||||||||||||
1090 | int offset = 4; | - | ||||||||||||||||||||||||||||||
1091 | for(int i = 0; i < numTables
| 0 | ||||||||||||||||||||||||||||||
1092 | const uchar *header = table + offset; | - | ||||||||||||||||||||||||||||||
1093 | - | |||||||||||||||||||||||||||||||
1094 | quint16 version; | - | ||||||||||||||||||||||||||||||
1095 | if (!qSafeFromBigEndian(header, end, &version)
| 0 | ||||||||||||||||||||||||||||||
1096 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
1097 | - | |||||||||||||||||||||||||||||||
1098 | quint16 length; | - | ||||||||||||||||||||||||||||||
1099 | if (!qSafeFromBigEndian(header + 2, end, &length)
| 0 | ||||||||||||||||||||||||||||||
1100 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
1101 | - | |||||||||||||||||||||||||||||||
1102 | quint16 coverage; | - | ||||||||||||||||||||||||||||||
1103 | if (!qSafeFromBigEndian(header + 4, end, &coverage)
| 0 | ||||||||||||||||||||||||||||||
1104 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
1105 | - | |||||||||||||||||||||||||||||||
1106 | - | |||||||||||||||||||||||||||||||
1107 | if(version == 0
| 0 | ||||||||||||||||||||||||||||||
1108 | if (offset + length > tab.size()
| 0 | ||||||||||||||||||||||||||||||
1109 | - | |||||||||||||||||||||||||||||||
1110 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
1111 | } | - | ||||||||||||||||||||||||||||||
1112 | const uchar *data = table + offset + 6; | - | ||||||||||||||||||||||||||||||
1113 | - | |||||||||||||||||||||||||||||||
1114 | quint16 nPairs; | - | ||||||||||||||||||||||||||||||
1115 | if (!qSafeFromBigEndian(data, end, &nPairs)
| 0 | ||||||||||||||||||||||||||||||
1116 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
1117 | - | |||||||||||||||||||||||||||||||
1118 | if(nPairs * 6 + 8 > length - 6
| 0 | ||||||||||||||||||||||||||||||
1119 | - | |||||||||||||||||||||||||||||||
1120 | - | |||||||||||||||||||||||||||||||
1121 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
1122 | } | - | ||||||||||||||||||||||||||||||
1123 | - | |||||||||||||||||||||||||||||||
1124 | int off = 8; | - | ||||||||||||||||||||||||||||||
1125 | for(int i = 0; i < nPairs
| 0 | ||||||||||||||||||||||||||||||
1126 | QFontEngine::KernPair p; | - | ||||||||||||||||||||||||||||||
1127 | - | |||||||||||||||||||||||||||||||
1128 | quint16 tmp; | - | ||||||||||||||||||||||||||||||
1129 | if (!qSafeFromBigEndian(data + off, end, &tmp)
| 0 | ||||||||||||||||||||||||||||||
1130 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
1131 | - | |||||||||||||||||||||||||||||||
1132 | p.left_right = uint(tmp) << 16; | - | ||||||||||||||||||||||||||||||
1133 | if (!qSafeFromBigEndian(data + off + 2, end, &tmp)
| 0 | ||||||||||||||||||||||||||||||
1134 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
1135 | - | |||||||||||||||||||||||||||||||
1136 | p.left_right |= tmp; | - | ||||||||||||||||||||||||||||||
1137 | - | |||||||||||||||||||||||||||||||
1138 | if (!qSafeFromBigEndian(data + off + 4, end, &tmp)
| 0 | ||||||||||||||||||||||||||||||
1139 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
1140 | - | |||||||||||||||||||||||||||||||
1141 | p.adjust = QFixed(int(short(tmp))) / scalingFactor; | - | ||||||||||||||||||||||||||||||
1142 | kerning_pairs.append(p); | - | ||||||||||||||||||||||||||||||
1143 | off += 6; | - | ||||||||||||||||||||||||||||||
1144 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1145 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1146 | offset += length; | - | ||||||||||||||||||||||||||||||
1147 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1148 | } | - | ||||||||||||||||||||||||||||||
1149 | end: code before this statement never executed: end: | 0 | ||||||||||||||||||||||||||||||
1150 | std::sort(kerning_pairs.begin(), kerning_pairs.end()); | - | ||||||||||||||||||||||||||||||
1151 | - | |||||||||||||||||||||||||||||||
1152 | - | |||||||||||||||||||||||||||||||
1153 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1154 | - | |||||||||||||||||||||||||||||||
1155 | - | |||||||||||||||||||||||||||||||
1156 | int QFontEngine::glyphCount() const | - | ||||||||||||||||||||||||||||||
1157 | { | - | ||||||||||||||||||||||||||||||
1158 | QByteArray maxpTable = getSfntTable(( (((quint32)('m')) << 24) | (((quint32)('a')) << 16) | (((quint32)('x')) << 8) | ((quint32)('p')) )); | - | ||||||||||||||||||||||||||||||
1159 | if (maxpTable.size() < 6
| 0 | ||||||||||||||||||||||||||||||
1160 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1161 | - | |||||||||||||||||||||||||||||||
1162 | const uchar *source = reinterpret_cast<const uchar *>(maxpTable.constData() + 4); | - | ||||||||||||||||||||||||||||||
1163 | const uchar *end = source + maxpTable.size(); | - | ||||||||||||||||||||||||||||||
1164 | - | |||||||||||||||||||||||||||||||
1165 | quint16 count = 0; | - | ||||||||||||||||||||||||||||||
1166 | qSafeFromBigEndian(source, end, &count); | - | ||||||||||||||||||||||||||||||
1167 | return never executed: count;return count; never executed: return count; | 0 | ||||||||||||||||||||||||||||||
1168 | } | - | ||||||||||||||||||||||||||||||
1169 | - | |||||||||||||||||||||||||||||||
1170 | Qt::HANDLE QFontEngine::handle() const | - | ||||||||||||||||||||||||||||||
1171 | { | - | ||||||||||||||||||||||||||||||
1172 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||||||||||||||
1173 | } | - | ||||||||||||||||||||||||||||||
1174 | - | |||||||||||||||||||||||||||||||
1175 | const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize) | - | ||||||||||||||||||||||||||||||
1176 | { | - | ||||||||||||||||||||||||||||||
1177 | const uchar *header = table; | - | ||||||||||||||||||||||||||||||
1178 | const uchar *endPtr = table + tableSize; | - | ||||||||||||||||||||||||||||||
1179 | - | |||||||||||||||||||||||||||||||
1180 | - | |||||||||||||||||||||||||||||||
1181 | quint16 version; | - | ||||||||||||||||||||||||||||||
1182 | if (!qSafeFromBigEndian(header, endPtr, &version)
| 0 | ||||||||||||||||||||||||||||||
1183 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1184 | - | |||||||||||||||||||||||||||||||
1185 | quint16 numTables; | - | ||||||||||||||||||||||||||||||
1186 | if (!qSafeFromBigEndian(header + 2, endPtr, &numTables)
| 0 | ||||||||||||||||||||||||||||||
1187 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1188 | - | |||||||||||||||||||||||||||||||
1189 | const uchar *maps = table + 4; | - | ||||||||||||||||||||||||||||||
1190 | - | |||||||||||||||||||||||||||||||
1191 | enum { | - | ||||||||||||||||||||||||||||||
1192 | Invalid, | - | ||||||||||||||||||||||||||||||
1193 | AppleRoman, | - | ||||||||||||||||||||||||||||||
1194 | Symbol, | - | ||||||||||||||||||||||||||||||
1195 | Unicode11, | - | ||||||||||||||||||||||||||||||
1196 | Unicode, | - | ||||||||||||||||||||||||||||||
1197 | MicrosoftUnicode, | - | ||||||||||||||||||||||||||||||
1198 | MicrosoftUnicodeExtended | - | ||||||||||||||||||||||||||||||
1199 | }; | - | ||||||||||||||||||||||||||||||
1200 | - | |||||||||||||||||||||||||||||||
1201 | int symbolTable = -1; | - | ||||||||||||||||||||||||||||||
1202 | int tableToUse = -1; | - | ||||||||||||||||||||||||||||||
1203 | int score = Invalid; | - | ||||||||||||||||||||||||||||||
1204 | for (int n = 0; n < numTables
| 0 | ||||||||||||||||||||||||||||||
1205 | quint16 platformId; | - | ||||||||||||||||||||||||||||||
1206 | if (!qSafeFromBigEndian(maps + 8 * n, endPtr, &platformId)
| 0 | ||||||||||||||||||||||||||||||
1207 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1208 | - | |||||||||||||||||||||||||||||||
1209 | quint16 platformSpecificId; | - | ||||||||||||||||||||||||||||||
1210 | if (!qSafeFromBigEndian(maps + 8 * n + 2, endPtr, &platformSpecificId)
| 0 | ||||||||||||||||||||||||||||||
1211 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1212 | - | |||||||||||||||||||||||||||||||
1213 | switch (platformId) { | - | ||||||||||||||||||||||||||||||
1214 | case never executed: 0:case 0: never executed: case 0: | 0 | ||||||||||||||||||||||||||||||
1215 | if (score < Unicode
| 0 | ||||||||||||||||||||||||||||||
1216 | (platformSpecificId == 0
| 0 | ||||||||||||||||||||||||||||||
1217 | platformSpecificId == 2
| 0 | ||||||||||||||||||||||||||||||
1218 | platformSpecificId == 3
| 0 | ||||||||||||||||||||||||||||||
1219 | tableToUse = n; | - | ||||||||||||||||||||||||||||||
1220 | score = Unicode; | - | ||||||||||||||||||||||||||||||
1221 | } never executed: else if (score < Unicode11end of block
| 0 | ||||||||||||||||||||||||||||||
1222 | tableToUse = n; | - | ||||||||||||||||||||||||||||||
1223 | score = Unicode11; | - | ||||||||||||||||||||||||||||||
1224 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1225 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
1226 | case never executed: 1:case 1: never executed: case 1: | 0 | ||||||||||||||||||||||||||||||
1227 | if (score < AppleRoman
| 0 | ||||||||||||||||||||||||||||||
1228 | tableToUse = n; | - | ||||||||||||||||||||||||||||||
1229 | score = AppleRoman; | - | ||||||||||||||||||||||||||||||
1230 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1231 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
1232 | case never executed: 3:case 3: never executed: case 3: | 0 | ||||||||||||||||||||||||||||||
1233 | switch (platformSpecificId) { | - | ||||||||||||||||||||||||||||||
1234 | case never executed: 0:case 0: never executed: case 0: | 0 | ||||||||||||||||||||||||||||||
1235 | symbolTable = n; | - | ||||||||||||||||||||||||||||||
1236 | if (score < Symbol
| 0 | ||||||||||||||||||||||||||||||
1237 | tableToUse = n; | - | ||||||||||||||||||||||||||||||
1238 | score = Symbol; | - | ||||||||||||||||||||||||||||||
1239 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1240 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
1241 | case never executed: 1:case 1: never executed: case 1: | 0 | ||||||||||||||||||||||||||||||
1242 | if (score < MicrosoftUnicode
| 0 | ||||||||||||||||||||||||||||||
1243 | tableToUse = n; | - | ||||||||||||||||||||||||||||||
1244 | score = MicrosoftUnicode; | - | ||||||||||||||||||||||||||||||
1245 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1246 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
1247 | case never executed: 0xa:case 0xa: never executed: case 0xa: | 0 | ||||||||||||||||||||||||||||||
1248 | if (score < MicrosoftUnicodeExtended
| 0 | ||||||||||||||||||||||||||||||
1249 | tableToUse = n; | - | ||||||||||||||||||||||||||||||
1250 | score = MicrosoftUnicodeExtended; | - | ||||||||||||||||||||||||||||||
1251 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1252 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
1253 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
1254 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
1255 | } | - | ||||||||||||||||||||||||||||||
1256 | default never executed: :default: never executed: default: code before this statement never executed: default: | 0 | ||||||||||||||||||||||||||||||
1257 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
1258 | } | - | ||||||||||||||||||||||||||||||
1259 | } | - | ||||||||||||||||||||||||||||||
1260 | if(tableToUse < 0
| 0 | ||||||||||||||||||||||||||||||
1261 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1262 | - | |||||||||||||||||||||||||||||||
1263 | resolveTable: code before this statement never executed: resolveTable: | 0 | ||||||||||||||||||||||||||||||
1264 | *isSymbolFont = (symbolTable > -1); | - | ||||||||||||||||||||||||||||||
1265 | - | |||||||||||||||||||||||||||||||
1266 | quint32 unicode_table; | - | ||||||||||||||||||||||||||||||
1267 | if (!qSafeFromBigEndian(maps + 8 * tableToUse + 4, endPtr, &unicode_table)
| 0 | ||||||||||||||||||||||||||||||
1268 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1269 | - | |||||||||||||||||||||||||||||||
1270 | if (!unicode_table
| 0 | ||||||||||||||||||||||||||||||
1271 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1272 | - | |||||||||||||||||||||||||||||||
1273 | - | |||||||||||||||||||||||||||||||
1274 | header = table + unicode_table; | - | ||||||||||||||||||||||||||||||
1275 | - | |||||||||||||||||||||||||||||||
1276 | quint16 format; | - | ||||||||||||||||||||||||||||||
1277 | if (!qSafeFromBigEndian(header, endPtr, &format)
| 0 | ||||||||||||||||||||||||||||||
1278 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1279 | - | |||||||||||||||||||||||||||||||
1280 | quint32 length; | - | ||||||||||||||||||||||||||||||
1281 | if (format < 8
| 0 | ||||||||||||||||||||||||||||||
1282 | quint16 tmp; | - | ||||||||||||||||||||||||||||||
1283 | if (!qSafeFromBigEndian(header + 2, endPtr, &tmp)
| 0 | ||||||||||||||||||||||||||||||
1284 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1285 | length = tmp; | - | ||||||||||||||||||||||||||||||
1286 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
1287 | if (!qSafeFromBigEndian(header + 4, endPtr, &length)
| 0 | ||||||||||||||||||||||||||||||
1288 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1289 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1290 | - | |||||||||||||||||||||||||||||||
1291 | if (table + unicode_table + length > endPtr
| 0 | ||||||||||||||||||||||||||||||
1292 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1293 | *cmapSize = length; | - | ||||||||||||||||||||||||||||||
1294 | - | |||||||||||||||||||||||||||||||
1295 | - | |||||||||||||||||||||||||||||||
1296 | - | |||||||||||||||||||||||||||||||
1297 | - | |||||||||||||||||||||||||||||||
1298 | if (symbolTable > -1
| 0 | ||||||||||||||||||||||||||||||
1299 | const uchar *selectedTable = table + unicode_table; | - | ||||||||||||||||||||||||||||||
1300 | - | |||||||||||||||||||||||||||||||
1301 | - | |||||||||||||||||||||||||||||||
1302 | bool unicodeTableHasLatin1 = false; | - | ||||||||||||||||||||||||||||||
1303 | for (int uc=0x00; uc<0x100
| 0 | ||||||||||||||||||||||||||||||
1304 | if (getTrueTypeGlyphIndex(selectedTable, length, uc) != 0
| 0 | ||||||||||||||||||||||||||||||
1305 | unicodeTableHasLatin1 = true; | - | ||||||||||||||||||||||||||||||
1306 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
1307 | } | - | ||||||||||||||||||||||||||||||
1308 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1309 | - | |||||||||||||||||||||||||||||||
1310 | - | |||||||||||||||||||||||||||||||
1311 | bool unicodeTableHasSymbols = false; | - | ||||||||||||||||||||||||||||||
1312 | if (!unicodeTableHasLatin1
| 0 | ||||||||||||||||||||||||||||||
1313 | for (int uc=0xf000; uc<0xf100
| 0 | ||||||||||||||||||||||||||||||
1314 | if (getTrueTypeGlyphIndex(selectedTable, length, uc) != 0
| 0 | ||||||||||||||||||||||||||||||
1315 | unicodeTableHasSymbols = true; | - | ||||||||||||||||||||||||||||||
1316 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
1317 | } | - | ||||||||||||||||||||||||||||||
1318 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1319 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1320 | - | |||||||||||||||||||||||||||||||
1321 | - | |||||||||||||||||||||||||||||||
1322 | if (!unicodeTableHasLatin1
| 0 | ||||||||||||||||||||||||||||||
1323 | tableToUse = symbolTable; | - | ||||||||||||||||||||||||||||||
1324 | score = Symbol; | - | ||||||||||||||||||||||||||||||
1325 | goto never executed: resolveTable;goto resolveTable; never executed: goto resolveTable; | 0 | ||||||||||||||||||||||||||||||
1326 | } | - | ||||||||||||||||||||||||||||||
1327 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1328 | - | |||||||||||||||||||||||||||||||
1329 | return never executed: table + unicode_table;return table + unicode_table; never executed: return table + unicode_table; | 0 | ||||||||||||||||||||||||||||||
1330 | } | - | ||||||||||||||||||||||||||||||
1331 | - | |||||||||||||||||||||||||||||||
1332 | quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint unicode) | - | ||||||||||||||||||||||||||||||
1333 | { | - | ||||||||||||||||||||||||||||||
1334 | const uchar *end = cmap + cmapSize; | - | ||||||||||||||||||||||||||||||
1335 | quint16 format; | - | ||||||||||||||||||||||||||||||
1336 | if (!qSafeFromBigEndian(cmap, end, &format)
| 0 | ||||||||||||||||||||||||||||||
1337 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1338 | - | |||||||||||||||||||||||||||||||
1339 | if (format == 0
| 0 | ||||||||||||||||||||||||||||||
1340 | const uchar *ptr = cmap + 6 + unicode; | - | ||||||||||||||||||||||||||||||
1341 | if (unicode < 256
| 0 | ||||||||||||||||||||||||||||||
1342 | return never executed: quint32(*ptr);return quint32(*ptr); never executed: return quint32(*ptr); | 0 | ||||||||||||||||||||||||||||||
1343 | } never executed: else if (format == 4end of block
| 0 | ||||||||||||||||||||||||||||||
1344 | - | |||||||||||||||||||||||||||||||
1345 | - | |||||||||||||||||||||||||||||||
1346 | - | |||||||||||||||||||||||||||||||
1347 | - | |||||||||||||||||||||||||||||||
1348 | - | |||||||||||||||||||||||||||||||
1349 | if(unicode >= 0xffff
| 0 | ||||||||||||||||||||||||||||||
1350 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1351 | - | |||||||||||||||||||||||||||||||
1352 | quint16 segCountX2; | - | ||||||||||||||||||||||||||||||
1353 | if (!qSafeFromBigEndian(cmap + 6, end, &segCountX2)
| 0 | ||||||||||||||||||||||||||||||
1354 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1355 | - | |||||||||||||||||||||||||||||||
1356 | const unsigned char *ends = cmap + 14; | - | ||||||||||||||||||||||||||||||
1357 | - | |||||||||||||||||||||||||||||||
1358 | int i = 0; | - | ||||||||||||||||||||||||||||||
1359 | for (; i < segCountX2/2
| 0 | ||||||||||||||||||||||||||||||
1360 | quint16 codePoint; | - | ||||||||||||||||||||||||||||||
1361 | if (!qSafeFromBigEndian(ends + 2 * i, end, &codePoint)
| 0 | ||||||||||||||||||||||||||||||
1362 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1363 | if (codePoint >= unicode
| 0 | ||||||||||||||||||||||||||||||
1364 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
1365 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1366 | - | |||||||||||||||||||||||||||||||
1367 | const unsigned char *idx = ends + segCountX2 + 2 + 2*i; | - | ||||||||||||||||||||||||||||||
1368 | - | |||||||||||||||||||||||||||||||
1369 | quint16 startIndex; | - | ||||||||||||||||||||||||||||||
1370 | if (!qSafeFromBigEndian(idx, end, &startIndex)
| 0 | ||||||||||||||||||||||||||||||
1371 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1372 | if (startIndex > unicode
| 0 | ||||||||||||||||||||||||||||||
1373 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1374 | - | |||||||||||||||||||||||||||||||
1375 | idx += segCountX2; | - | ||||||||||||||||||||||||||||||
1376 | - | |||||||||||||||||||||||||||||||
1377 | quint16 tmp; | - | ||||||||||||||||||||||||||||||
1378 | if (!qSafeFromBigEndian(idx, end, &tmp)
| 0 | ||||||||||||||||||||||||||||||
1379 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1380 | qint16 idDelta = qint16(tmp); | - | ||||||||||||||||||||||||||||||
1381 | - | |||||||||||||||||||||||||||||||
1382 | idx += segCountX2; | - | ||||||||||||||||||||||||||||||
1383 | - | |||||||||||||||||||||||||||||||
1384 | quint16 idRangeoffset_t; | - | ||||||||||||||||||||||||||||||
1385 | if (!qSafeFromBigEndian(idx, end, &idRangeoffset_t)
| 0 | ||||||||||||||||||||||||||||||
1386 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1387 | - | |||||||||||||||||||||||||||||||
1388 | quint16 glyphIndex; | - | ||||||||||||||||||||||||||||||
1389 | if (idRangeoffset_t
| 0 | ||||||||||||||||||||||||||||||
1390 | quint16 id; | - | ||||||||||||||||||||||||||||||
1391 | if (!qSafeFromBigEndian(idRangeoffset_t + 2 * (unicode - startIndex) + idx, end, &id)
| 0 | ||||||||||||||||||||||||||||||
1392 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1393 | - | |||||||||||||||||||||||||||||||
1394 | if (id
| 0 | ||||||||||||||||||||||||||||||
1395 | glyphIndex = (idDelta + id) % 0x10000; never executed: glyphIndex = (idDelta + id) % 0x10000; | 0 | ||||||||||||||||||||||||||||||
1396 | else | - | ||||||||||||||||||||||||||||||
1397 | glyphIndex = 0; never executed: glyphIndex = 0; | 0 | ||||||||||||||||||||||||||||||
1398 | } else { | - | ||||||||||||||||||||||||||||||
1399 | glyphIndex = (idDelta + unicode) % 0x10000; | - | ||||||||||||||||||||||||||||||
1400 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1401 | return never executed: glyphIndex;return glyphIndex; never executed: return glyphIndex; | 0 | ||||||||||||||||||||||||||||||
1402 | } else if (format == 6
| 0 | ||||||||||||||||||||||||||||||
1403 | quint16 tableSize; | - | ||||||||||||||||||||||||||||||
1404 | if (!qSafeFromBigEndian(cmap + 2, end, &tableSize)
| 0 | ||||||||||||||||||||||||||||||
1405 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1406 | - | |||||||||||||||||||||||||||||||
1407 | quint16 firstCode6; | - | ||||||||||||||||||||||||||||||
1408 | if (!qSafeFromBigEndian(cmap + 6, end, &firstCode6)
| 0 | ||||||||||||||||||||||||||||||
1409 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1410 | if (unicode < firstCode6
| 0 | ||||||||||||||||||||||||||||||
1411 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1412 | - | |||||||||||||||||||||||||||||||
1413 | quint16 entryCount6; | - | ||||||||||||||||||||||||||||||
1414 | if (!qSafeFromBigEndian(cmap + 8, end, &entryCount6)
| 0 | ||||||||||||||||||||||||||||||
1415 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1416 | if (entryCount6 * 2 + 10 > tableSize
| 0 | ||||||||||||||||||||||||||||||
1417 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1418 | - | |||||||||||||||||||||||||||||||
1419 | quint16 sentinel6 = firstCode6 + entryCount6; | - | ||||||||||||||||||||||||||||||
1420 | if (unicode >= sentinel6
| 0 | ||||||||||||||||||||||||||||||
1421 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1422 | - | |||||||||||||||||||||||||||||||
1423 | quint16 entryIndex6 = unicode - firstCode6; | - | ||||||||||||||||||||||||||||||
1424 | - | |||||||||||||||||||||||||||||||
1425 | quint16 index = 0; | - | ||||||||||||||||||||||||||||||
1426 | qSafeFromBigEndian(cmap + 10 + (entryIndex6 * 2), end, &index); | - | ||||||||||||||||||||||||||||||
1427 | return never executed: index;return index; never executed: return index; | 0 | ||||||||||||||||||||||||||||||
1428 | } else if (format == 12
| 0 | ||||||||||||||||||||||||||||||
1429 | quint32 nGroups; | - | ||||||||||||||||||||||||||||||
1430 | if (!qSafeFromBigEndian(cmap + 12, end, &nGroups)
| 0 | ||||||||||||||||||||||||||||||
1431 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1432 | - | |||||||||||||||||||||||||||||||
1433 | cmap += 16; | - | ||||||||||||||||||||||||||||||
1434 | - | |||||||||||||||||||||||||||||||
1435 | int left = 0, right = nGroups - 1; | - | ||||||||||||||||||||||||||||||
1436 | while (left <= right
| 0 | ||||||||||||||||||||||||||||||
1437 | int middle = left + ( ( right - left ) >> 1 ); | - | ||||||||||||||||||||||||||||||
1438 | - | |||||||||||||||||||||||||||||||
1439 | quint32 startCharCode; | - | ||||||||||||||||||||||||||||||
1440 | if (!qSafeFromBigEndian(cmap + 12 * middle, end, &startCharCode)
| 0 | ||||||||||||||||||||||||||||||
1441 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1442 | - | |||||||||||||||||||||||||||||||
1443 | if(unicode < startCharCode
| 0 | ||||||||||||||||||||||||||||||
1444 | right = middle - 1; never executed: right = middle - 1; | 0 | ||||||||||||||||||||||||||||||
1445 | else { | - | ||||||||||||||||||||||||||||||
1446 | quint32 endCharCode; | - | ||||||||||||||||||||||||||||||
1447 | if (!qSafeFromBigEndian(cmap + 12 * middle + 4, end, &endCharCode)
| 0 | ||||||||||||||||||||||||||||||
1448 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1449 | - | |||||||||||||||||||||||||||||||
1450 | if (unicode <= endCharCode
| 0 | ||||||||||||||||||||||||||||||
1451 | quint32 index; | - | ||||||||||||||||||||||||||||||
1452 | if (!qSafeFromBigEndian(cmap + 12 * middle + 8, end, &index)
| 0 | ||||||||||||||||||||||||||||||
1453 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1454 | - | |||||||||||||||||||||||||||||||
1455 | return never executed: index + unicode - startCharCode;return index + unicode - startCharCode; never executed: return index + unicode - startCharCode; | 0 | ||||||||||||||||||||||||||||||
1456 | } | - | ||||||||||||||||||||||||||||||
1457 | left = middle + 1; | - | ||||||||||||||||||||||||||||||
1458 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1459 | } | - | ||||||||||||||||||||||||||||||
1460 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
1461 | QMessageLogger(__FILE__, 1523, __PRETTY_FUNCTION__).debug("cmap table of format %d not implemented", format); | - | ||||||||||||||||||||||||||||||
1462 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1463 | - | |||||||||||||||||||||||||||||||
1464 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1465 | } | - | ||||||||||||||||||||||||||||||
1466 | - | |||||||||||||||||||||||||||||||
1467 | QByteArray QFontEngine::convertToPostscriptFontFamilyName(const QByteArray &family) | - | ||||||||||||||||||||||||||||||
1468 | { | - | ||||||||||||||||||||||||||||||
1469 | QByteArray f = family; | - | ||||||||||||||||||||||||||||||
1470 | f.replace(' ', ""); | - | ||||||||||||||||||||||||||||||
1471 | f.replace('(', ""); | - | ||||||||||||||||||||||||||||||
1472 | f.replace(')', ""); | - | ||||||||||||||||||||||||||||||
1473 | f.replace('<', ""); | - | ||||||||||||||||||||||||||||||
1474 | f.replace('>', ""); | - | ||||||||||||||||||||||||||||||
1475 | f.replace('[', ""); | - | ||||||||||||||||||||||||||||||
1476 | f.replace(']', ""); | - | ||||||||||||||||||||||||||||||
1477 | f.replace('{', ""); | - | ||||||||||||||||||||||||||||||
1478 | f.replace('}', ""); | - | ||||||||||||||||||||||||||||||
1479 | f.replace('/', ""); | - | ||||||||||||||||||||||||||||||
1480 | f.replace('%', ""); | - | ||||||||||||||||||||||||||||||
1481 | return never executed: f;return f; never executed: return f; | 0 | ||||||||||||||||||||||||||||||
1482 | } | - | ||||||||||||||||||||||||||||||
1483 | - | |||||||||||||||||||||||||||||||
1484 | - | |||||||||||||||||||||||||||||||
1485 | - | |||||||||||||||||||||||||||||||
1486 | - | |||||||||||||||||||||||||||||||
1487 | bool QFontEngine::hasUnreliableGlyphOutline() const | - | ||||||||||||||||||||||||||||||
1488 | { | - | ||||||||||||||||||||||||||||||
1489 | - | |||||||||||||||||||||||||||||||
1490 | return never executed: glyphFormat == QFontEngine::Format_ARGB;return glyphFormat == QFontEngine::Format_ARGB; never executed: return glyphFormat == QFontEngine::Format_ARGB; | 0 | ||||||||||||||||||||||||||||||
1491 | } | - | ||||||||||||||||||||||||||||||
1492 | - | |||||||||||||||||||||||||||||||
1493 | QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round) | - | ||||||||||||||||||||||||||||||
1494 | { | - | ||||||||||||||||||||||||||||||
1495 | if (glyphs.numGlyphs >= 1
| 0 | ||||||||||||||||||||||||||||||
1496 | glyph_t glyph = glyphs.glyphs[glyphs.numGlyphs - 1]; | - | ||||||||||||||||||||||||||||||
1497 | glyph_metrics_t gi = boundingBox(glyph); | - | ||||||||||||||||||||||||||||||
1498 | if (gi.isValid()
| 0 | ||||||||||||||||||||||||||||||
1499 | return never executed: roundreturn round ? qRound(gi.rightBearing()) : gi.rightBearing();
never executed: return round ? qRound(gi.rightBearing()) : gi.rightBearing(); | 0 | ||||||||||||||||||||||||||||||
1500 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1501 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1502 | } | - | ||||||||||||||||||||||||||||||
1503 | - | |||||||||||||||||||||||||||||||
1504 | - | |||||||||||||||||||||||||||||||
1505 | QFontEngine::GlyphCacheEntry::GlyphCacheEntry() | - | ||||||||||||||||||||||||||||||
1506 | { | - | ||||||||||||||||||||||||||||||
1507 | } | - | ||||||||||||||||||||||||||||||
1508 | - | |||||||||||||||||||||||||||||||
1509 | QFontEngine::GlyphCacheEntry::GlyphCacheEntry(const GlyphCacheEntry &o) | - | ||||||||||||||||||||||||||||||
1510 | : cache(o.cache) | - | ||||||||||||||||||||||||||||||
1511 | { | - | ||||||||||||||||||||||||||||||
1512 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1513 | - | |||||||||||||||||||||||||||||||
1514 | QFontEngine::GlyphCacheEntry::~GlyphCacheEntry() | - | ||||||||||||||||||||||||||||||
1515 | { | - | ||||||||||||||||||||||||||||||
1516 | } | - | ||||||||||||||||||||||||||||||
1517 | - | |||||||||||||||||||||||||||||||
1518 | QFontEngine::GlyphCacheEntry &QFontEngine::GlyphCacheEntry::operator=(const GlyphCacheEntry &o) | - | ||||||||||||||||||||||||||||||
1519 | { | - | ||||||||||||||||||||||||||||||
1520 | cache = o.cache; | - | ||||||||||||||||||||||||||||||
1521 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||||||||||||||||||||
1522 | } | - | ||||||||||||||||||||||||||||||
1523 | - | |||||||||||||||||||||||||||||||
1524 | - | |||||||||||||||||||||||||||||||
1525 | - | |||||||||||||||||||||||||||||||
1526 | - | |||||||||||||||||||||||||||||||
1527 | - | |||||||||||||||||||||||||||||||
1528 | QFontEngineBox::QFontEngineBox(int size) | - | ||||||||||||||||||||||||||||||
1529 | : QFontEngine(Box), | - | ||||||||||||||||||||||||||||||
1530 | _size(size) | - | ||||||||||||||||||||||||||||||
1531 | { | - | ||||||||||||||||||||||||||||||
1532 | cache_cost = sizeof(QFontEngineBox); | - | ||||||||||||||||||||||||||||||
1533 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1534 | - | |||||||||||||||||||||||||||||||
1535 | QFontEngineBox::QFontEngineBox(Type type, int size) | - | ||||||||||||||||||||||||||||||
1536 | : QFontEngine(type), | - | ||||||||||||||||||||||||||||||
1537 | _size(size) | - | ||||||||||||||||||||||||||||||
1538 | { | - | ||||||||||||||||||||||||||||||
1539 | cache_cost = sizeof(QFontEngineBox); | - | ||||||||||||||||||||||||||||||
1540 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1541 | - | |||||||||||||||||||||||||||||||
1542 | QFontEngineBox::~QFontEngineBox() | - | ||||||||||||||||||||||||||||||
1543 | { | - | ||||||||||||||||||||||||||||||
1544 | } | - | ||||||||||||||||||||||||||||||
1545 | - | |||||||||||||||||||||||||||||||
1546 | glyph_t QFontEngineBox::glyphIndex(uint ucs4) const | - | ||||||||||||||||||||||||||||||
1547 | { | - | ||||||||||||||||||||||||||||||
1548 | (void)ucs4; | - | ||||||||||||||||||||||||||||||
1549 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1550 | } | - | ||||||||||||||||||||||||||||||
1551 | - | |||||||||||||||||||||||||||||||
1552 | bool QFontEngineBox::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const | - | ||||||||||||||||||||||||||||||
1553 | { | - | ||||||||||||||||||||||||||||||
1554 | ((!(glyphs->numGlyphs >= *nglyphs)) ? qt_assert("glyphs->numGlyphs >= *nglyphs",__FILE__,1616) : qt_noop()); | - | ||||||||||||||||||||||||||||||
1555 | if (*
| 0 | ||||||||||||||||||||||||||||||
1556 | *nglyphs = len; | - | ||||||||||||||||||||||||||||||
1557 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
1558 | } | - | ||||||||||||||||||||||||||||||
1559 | - | |||||||||||||||||||||||||||||||
1560 | int ucs4Length = 0; | - | ||||||||||||||||||||||||||||||
1561 | QStringIterator it(str, str + len); | - | ||||||||||||||||||||||||||||||
1562 | while (it.hasNext()
| 0 | ||||||||||||||||||||||||||||||
1563 | it.advance(); | - | ||||||||||||||||||||||||||||||
1564 | glyphs->glyphs[ucs4Length++] = 0; | - | ||||||||||||||||||||||||||||||
1565 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1566 | - | |||||||||||||||||||||||||||||||
1567 | *nglyphs = ucs4Length; | - | ||||||||||||||||||||||||||||||
1568 | glyphs->numGlyphs = ucs4Length; | - | ||||||||||||||||||||||||||||||
1569 | - | |||||||||||||||||||||||||||||||
1570 | if (!(flags & GlyphIndicesOnly)
| 0 | ||||||||||||||||||||||||||||||
1571 | recalcAdvances(glyphs, flags); never executed: recalcAdvances(glyphs, flags); | 0 | ||||||||||||||||||||||||||||||
1572 | - | |||||||||||||||||||||||||||||||
1573 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
1574 | } | - | ||||||||||||||||||||||||||||||
1575 | - | |||||||||||||||||||||||||||||||
1576 | void QFontEngineBox::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags) const | - | ||||||||||||||||||||||||||||||
1577 | { | - | ||||||||||||||||||||||||||||||
1578 | for (int i = 0; i < glyphs->numGlyphs
| 0 | ||||||||||||||||||||||||||||||
1579 | glyphs->advances[i] = _size; never executed: glyphs->advances[i] = _size; | 0 | ||||||||||||||||||||||||||||||
1580 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1581 | - | |||||||||||||||||||||||||||||||
1582 | void QFontEngineBox::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) | - | ||||||||||||||||||||||||||||||
1583 | { | - | ||||||||||||||||||||||||||||||
1584 | if (!glyphs.numGlyphs
| 0 | ||||||||||||||||||||||||||||||
1585 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1586 | - | |||||||||||||||||||||||||||||||
1587 | QVarLengthArray<QFixedPoint> positions; | - | ||||||||||||||||||||||||||||||
1588 | QVarLengthArray<glyph_t> positioned_glyphs; | - | ||||||||||||||||||||||||||||||
1589 | QTransform matrix = QTransform::fromTranslate(x, y - _size); | - | ||||||||||||||||||||||||||||||
1590 | getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions); | - | ||||||||||||||||||||||||||||||
1591 | - | |||||||||||||||||||||||||||||||
1592 | QSize s(_size - 3, _size - 3); | - | ||||||||||||||||||||||||||||||
1593 | for (int k = 0; k < positions.size()
| 0 | ||||||||||||||||||||||||||||||
1594 | path->addRect(QRectF(positions[k].toPointF(), s)); never executed: path->addRect(QRectF(positions[k].toPointF(), s)); | 0 | ||||||||||||||||||||||||||||||
1595 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1596 | - | |||||||||||||||||||||||||||||||
1597 | glyph_metrics_t QFontEngineBox::boundingBox(const QGlyphLayout &glyphs) | - | ||||||||||||||||||||||||||||||
1598 | { | - | ||||||||||||||||||||||||||||||
1599 | glyph_metrics_t overall; | - | ||||||||||||||||||||||||||||||
1600 | overall.width = _size*glyphs.numGlyphs; | - | ||||||||||||||||||||||||||||||
1601 | overall.height = _size; | - | ||||||||||||||||||||||||||||||
1602 | overall.xoff = overall.width; | - | ||||||||||||||||||||||||||||||
1603 | return never executed: overall;return overall; never executed: return overall; | 0 | ||||||||||||||||||||||||||||||
1604 | } | - | ||||||||||||||||||||||||||||||
1605 | - | |||||||||||||||||||||||||||||||
1606 | void QFontEngineBox::draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &ti) | - | ||||||||||||||||||||||||||||||
1607 | { | - | ||||||||||||||||||||||||||||||
1608 | if (!ti.glyphs.numGlyphs
| 0 | ||||||||||||||||||||||||||||||
1609 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1610 | - | |||||||||||||||||||||||||||||||
1611 | - | |||||||||||||||||||||||||||||||
1612 | QSize s(_size - 3, _size - 3); | - | ||||||||||||||||||||||||||||||
1613 | - | |||||||||||||||||||||||||||||||
1614 | QVarLengthArray<QFixedPoint> positions; | - | ||||||||||||||||||||||||||||||
1615 | QVarLengthArray<glyph_t> glyphs; | - | ||||||||||||||||||||||||||||||
1616 | QTransform matrix = QTransform::fromTranslate(x, y - _size); | - | ||||||||||||||||||||||||||||||
1617 | ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); | - | ||||||||||||||||||||||||||||||
1618 | if (glyphs.size() == 0
| 0 | ||||||||||||||||||||||||||||||
1619 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1620 | - | |||||||||||||||||||||||||||||||
1621 | - | |||||||||||||||||||||||||||||||
1622 | QPainter *painter = p->painter(); | - | ||||||||||||||||||||||||||||||
1623 | painter->save(); | - | ||||||||||||||||||||||||||||||
1624 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||
1625 | QPen pen = painter->pen(); | - | ||||||||||||||||||||||||||||||
1626 | pen.setWidthF(lineThickness().toReal()); | - | ||||||||||||||||||||||||||||||
1627 | painter->setPen(pen); | - | ||||||||||||||||||||||||||||||
1628 | for (int k = 0; k < positions.size()
| 0 | ||||||||||||||||||||||||||||||
1629 | painter->drawRect(QRectF(positions[k].toPointF(), s)); never executed: painter->drawRect(QRectF(positions[k].toPointF(), s)); | 0 | ||||||||||||||||||||||||||||||
1630 | painter->restore(); | - | ||||||||||||||||||||||||||||||
1631 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1632 | - | |||||||||||||||||||||||||||||||
1633 | glyph_metrics_t QFontEngineBox::boundingBox(glyph_t) | - | ||||||||||||||||||||||||||||||
1634 | { | - | ||||||||||||||||||||||||||||||
1635 | return never executed: glyph_metrics_t(0, -_size, _size, _size, _size, 0);return glyph_metrics_t(0, -_size, _size, _size, _size, 0); never executed: return glyph_metrics_t(0, -_size, _size, _size, _size, 0); | 0 | ||||||||||||||||||||||||||||||
1636 | } | - | ||||||||||||||||||||||||||||||
1637 | - | |||||||||||||||||||||||||||||||
1638 | QFontEngine *QFontEngineBox::cloneWithSize(qreal pixelSize) const | - | ||||||||||||||||||||||||||||||
1639 | { | - | ||||||||||||||||||||||||||||||
1640 | QFontEngineBox *fe = new QFontEngineBox(pixelSize); | - | ||||||||||||||||||||||||||||||
1641 | return never executed: fe;return fe; never executed: return fe; | 0 | ||||||||||||||||||||||||||||||
1642 | } | - | ||||||||||||||||||||||||||||||
1643 | - | |||||||||||||||||||||||||||||||
1644 | QFixed QFontEngineBox::ascent() const | - | ||||||||||||||||||||||||||||||
1645 | { | - | ||||||||||||||||||||||||||||||
1646 | return never executed: _size;return _size; never executed: return _size; | 0 | ||||||||||||||||||||||||||||||
1647 | } | - | ||||||||||||||||||||||||||||||
1648 | - | |||||||||||||||||||||||||||||||
1649 | QFixed QFontEngineBox::descent() const | - | ||||||||||||||||||||||||||||||
1650 | { | - | ||||||||||||||||||||||||||||||
1651 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1652 | } | - | ||||||||||||||||||||||||||||||
1653 | - | |||||||||||||||||||||||||||||||
1654 | QFixed QFontEngineBox::leading() const | - | ||||||||||||||||||||||||||||||
1655 | { | - | ||||||||||||||||||||||||||||||
1656 | QFixed l = _size * QFixed::fromReal(qreal(0.15)); | - | ||||||||||||||||||||||||||||||
1657 | return never executed: l.ceil();return l.ceil(); never executed: return l.ceil(); | 0 | ||||||||||||||||||||||||||||||
1658 | } | - | ||||||||||||||||||||||||||||||
1659 | - | |||||||||||||||||||||||||||||||
1660 | qreal QFontEngineBox::maxCharWidth() const | - | ||||||||||||||||||||||||||||||
1661 | { | - | ||||||||||||||||||||||||||||||
1662 | return never executed: _size;return _size; never executed: return _size; | 0 | ||||||||||||||||||||||||||||||
1663 | } | - | ||||||||||||||||||||||||||||||
1664 | - | |||||||||||||||||||||||||||||||
1665 | bool QFontEngineBox::canRender(const QChar *, int) const | - | ||||||||||||||||||||||||||||||
1666 | { | - | ||||||||||||||||||||||||||||||
1667 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
1668 | } | - | ||||||||||||||||||||||||||||||
1669 | - | |||||||||||||||||||||||||||||||
1670 | QImage QFontEngineBox::alphaMapForGlyph(glyph_t) | - | ||||||||||||||||||||||||||||||
1671 | { | - | ||||||||||||||||||||||||||||||
1672 | QImage image(_size, _size, QImage::Format_Alpha8); | - | ||||||||||||||||||||||||||||||
1673 | image.fill(0); | - | ||||||||||||||||||||||||||||||
1674 | - | |||||||||||||||||||||||||||||||
1675 | - | |||||||||||||||||||||||||||||||
1676 | for (int i=2; i <= _size-3
| 0 | ||||||||||||||||||||||||||||||
1677 | image.setPixel(i, 2, 255); | - | ||||||||||||||||||||||||||||||
1678 | image.setPixel(i, _size-3, 255); | - | ||||||||||||||||||||||||||||||
1679 | image.setPixel(2, i, 255); | - | ||||||||||||||||||||||||||||||
1680 | image.setPixel(_size-3, i, 255); | - | ||||||||||||||||||||||||||||||
1681 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1682 | return never executed: image;return image; never executed: return image; | 0 | ||||||||||||||||||||||||||||||
1683 | } | - | ||||||||||||||||||||||||||||||
1684 | - | |||||||||||||||||||||||||||||||
1685 | - | |||||||||||||||||||||||||||||||
1686 | - | |||||||||||||||||||||||||||||||
1687 | - | |||||||||||||||||||||||||||||||
1688 | - | |||||||||||||||||||||||||||||||
1689 | static inline uchar highByte(glyph_t glyph) | - | ||||||||||||||||||||||||||||||
1690 | { return never executed: glyph >> 24;return glyph >> 24; never executed: }return glyph >> 24; | 0 | ||||||||||||||||||||||||||||||
1691 | - | |||||||||||||||||||||||||||||||
1692 | - | |||||||||||||||||||||||||||||||
1693 | static inline glyph_t stripped(glyph_t glyph) | - | ||||||||||||||||||||||||||||||
1694 | { return never executed: glyph & 0x00ffffff;return glyph & 0x00ffffff; never executed: }return glyph & 0x00ffffff; | 0 | ||||||||||||||||||||||||||||||
1695 | - | |||||||||||||||||||||||||||||||
1696 | QFontEngineMulti::QFontEngineMulti(QFontEngine *engine, int script, const QStringList &fallbackFamilies) | - | ||||||||||||||||||||||||||||||
1697 | : QFontEngine(Multi), | - | ||||||||||||||||||||||||||||||
1698 | m_fallbackFamilies(fallbackFamilies), | - | ||||||||||||||||||||||||||||||
1699 | m_script(script), | - | ||||||||||||||||||||||||||||||
1700 | m_fallbackFamiliesQueried(!m_fallbackFamilies.isEmpty()) | - | ||||||||||||||||||||||||||||||
1701 | { | - | ||||||||||||||||||||||||||||||
1702 | ((!(engine && engine->type() != QFontEngine::Multi)) ? qt_assert("engine && engine->type() != QFontEngine::Multi",__FILE__,1764) : qt_noop()); | - | ||||||||||||||||||||||||||||||
1703 | - | |||||||||||||||||||||||||||||||
1704 | if (m_fallbackFamilies.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
1705 | - | |||||||||||||||||||||||||||||||
1706 | m_fallbackFamilies << QString(); | - | ||||||||||||||||||||||||||||||
1707 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1708 | - | |||||||||||||||||||||||||||||||
1709 | m_engines.resize(m_fallbackFamilies.size() + 1); | - | ||||||||||||||||||||||||||||||
1710 | - | |||||||||||||||||||||||||||||||
1711 | engine->ref.ref(); | - | ||||||||||||||||||||||||||||||
1712 | m_engines[0] = engine; | - | ||||||||||||||||||||||||||||||
1713 | - | |||||||||||||||||||||||||||||||
1714 | fontDef = engine->fontDef; | - | ||||||||||||||||||||||||||||||
1715 | cache_cost = engine->cache_cost; | - | ||||||||||||||||||||||||||||||
1716 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1717 | - | |||||||||||||||||||||||||||||||
1718 | QFontEngineMulti::~QFontEngineMulti() | - | ||||||||||||||||||||||||||||||
1719 | { | - | ||||||||||||||||||||||||||||||
1720 | for (int i = 0; i < m_engines.size()
| 0 | ||||||||||||||||||||||||||||||
1721 | QFontEngine *fontEngine = m_engines.at(i); | - | ||||||||||||||||||||||||||||||
1722 | if (fontEngine
| 0 | ||||||||||||||||||||||||||||||
1723 | delete fontEngine; never executed: delete fontEngine; | 0 | ||||||||||||||||||||||||||||||
1724 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1725 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1726 | - | |||||||||||||||||||||||||||||||
1727 | QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script); | - | ||||||||||||||||||||||||||||||
1728 | - | |||||||||||||||||||||||||||||||
1729 | void QFontEngineMulti::ensureFallbackFamiliesQueried() | - | ||||||||||||||||||||||||||||||
1730 | { | - | ||||||||||||||||||||||||||||||
1731 | QFont::StyleHint styleHint = QFont::StyleHint(fontDef.styleHint); | - | ||||||||||||||||||||||||||||||
1732 | if (styleHint == QFont::AnyStyle
| 0 | ||||||||||||||||||||||||||||||
1733 | styleHint = QFont::TypeWriter; never executed: styleHint = QFont::TypeWriter; | 0 | ||||||||||||||||||||||||||||||
1734 | - | |||||||||||||||||||||||||||||||
1735 | setFallbackFamiliesList(qt_fallbacksForFamily(fontDef.family, QFont::Style(fontDef.style), styleHint, QChar::Script(m_script))); | - | ||||||||||||||||||||||||||||||
1736 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1737 | - | |||||||||||||||||||||||||||||||
1738 | void QFontEngineMulti::setFallbackFamiliesList(const QStringList &fallbackFamilies) | - | ||||||||||||||||||||||||||||||
1739 | { | - | ||||||||||||||||||||||||||||||
1740 | ((!(!m_fallbackFamiliesQueried)) ? qt_assert("!m_fallbackFamiliesQueried",__FILE__,1802) : qt_noop()); | - | ||||||||||||||||||||||||||||||
1741 | - | |||||||||||||||||||||||||||||||
1742 | m_fallbackFamilies = fallbackFamilies; | - | ||||||||||||||||||||||||||||||
1743 | if (m_fallbackFamilies.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
1744 | - | |||||||||||||||||||||||||||||||
1745 | ((!(m_engines.size() == 2)) ? qt_assert("m_engines.size() == 2",__FILE__,1807) : qt_noop()); | - | ||||||||||||||||||||||||||||||
1746 | QFontEngine *engine = m_engines.at(0); | - | ||||||||||||||||||||||||||||||
1747 | engine->ref.ref(); | - | ||||||||||||||||||||||||||||||
1748 | m_engines[1] = engine; | - | ||||||||||||||||||||||||||||||
1749 | m_fallbackFamilies << fontDef.family; | - | ||||||||||||||||||||||||||||||
1750 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
1751 | m_engines.resize(m_fallbackFamilies.size() + 1); | - | ||||||||||||||||||||||||||||||
1752 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1753 | - | |||||||||||||||||||||||||||||||
1754 | m_fallbackFamiliesQueried = true; | - | ||||||||||||||||||||||||||||||
1755 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1756 | - | |||||||||||||||||||||||||||||||
1757 | void QFontEngineMulti::ensureEngineAt(int at) | - | ||||||||||||||||||||||||||||||
1758 | { | - | ||||||||||||||||||||||||||||||
1759 | if (!m_fallbackFamiliesQueried
| 0 | ||||||||||||||||||||||||||||||
1760 | ensureFallbackFamiliesQueried(); never executed: ensureFallbackFamiliesQueried(); | 0 | ||||||||||||||||||||||||||||||
1761 | ((!(at < m_engines.size())) ? qt_assert("at < m_engines.size()",__FILE__,1823) : qt_noop()); | - | ||||||||||||||||||||||||||||||
1762 | if (!m_engines.at(at)
| 0 | ||||||||||||||||||||||||||||||
1763 | QFontEngine *engine = loadEngine(at); | - | ||||||||||||||||||||||||||||||
1764 | if (!engine
| 0 | ||||||||||||||||||||||||||||||
1765 | engine = new QFontEngineBox(fontDef.pixelSize); never executed: engine = new QFontEngineBox(fontDef.pixelSize); | 0 | ||||||||||||||||||||||||||||||
1766 | ((!(engine && engine->type() != QFontEngine::Multi)) ? qt_assert("engine && engine->type() != QFontEngine::Multi",__FILE__,1828) : qt_noop()); | - | ||||||||||||||||||||||||||||||
1767 | engine->ref.ref(); | - | ||||||||||||||||||||||||||||||
1768 | m_engines[at] = engine; | - | ||||||||||||||||||||||||||||||
1769 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1770 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1771 | - | |||||||||||||||||||||||||||||||
1772 | QFontEngine *QFontEngineMulti::loadEngine(int at) | - | ||||||||||||||||||||||||||||||
1773 | { | - | ||||||||||||||||||||||||||||||
1774 | QFontDef request(fontDef); | - | ||||||||||||||||||||||||||||||
1775 | request.styleStrategy |= QFont::NoFontMerging; | - | ||||||||||||||||||||||||||||||
1776 | request.family = fallbackFamilyAt(at - 1); | - | ||||||||||||||||||||||||||||||
1777 | - | |||||||||||||||||||||||||||||||
1778 | if (QFontEngine *engine = QFontDatabase::findFont(request, m_script)
| 0 | ||||||||||||||||||||||||||||||
1779 | engine->fontDef.weight = request.weight; | - | ||||||||||||||||||||||||||||||
1780 | if (request.style > QFont::StyleNormal
| 0 | ||||||||||||||||||||||||||||||
1781 | engine->fontDef.style = request.style; never executed: engine->fontDef.style = request.style; | 0 | ||||||||||||||||||||||||||||||
1782 | return never executed: engine;return engine; never executed: return engine; | 0 | ||||||||||||||||||||||||||||||
1783 | } | - | ||||||||||||||||||||||||||||||
1784 | - | |||||||||||||||||||||||||||||||
1785 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
1786 | } | - | ||||||||||||||||||||||||||||||
1787 | - | |||||||||||||||||||||||||||||||
1788 | glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const | - | ||||||||||||||||||||||||||||||
1789 | { | - | ||||||||||||||||||||||||||||||
1790 | glyph_t glyph = engine(0)->glyphIndex(ucs4); | - | ||||||||||||||||||||||||||||||
1791 | if (glyph == 0
| 0 | ||||||||||||||||||||||||||||||
1792 | if (!m_fallbackFamiliesQueried
| 0 | ||||||||||||||||||||||||||||||
1793 | const_cast< never executed: QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried(); never executed: const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried(); | 0 | ||||||||||||||||||||||||||||||
1794 | for (int x = 1, n = qMin(m_engines.size(), 256); x < n
| 0 | ||||||||||||||||||||||||||||||
1795 | QFontEngine *engine = m_engines.at(x); | - | ||||||||||||||||||||||||||||||
1796 | if (!engine
| 0 | ||||||||||||||||||||||||||||||
1797 | if (!shouldLoadFontEngineForCharacter(x, ucs4)
| 0 | ||||||||||||||||||||||||||||||
1798 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
1799 | const_cast<QFontEngineMulti *>(this)->ensureEngineAt(x); | - | ||||||||||||||||||||||||||||||
1800 | engine = m_engines.at(x); | - | ||||||||||||||||||||||||||||||
1801 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1802 | ((!(engine != 0)) ? qt_assert("engine != 0",__FILE__,1864) : qt_noop()); | - | ||||||||||||||||||||||||||||||
1803 | if (engine->type() == Box
| 0 | ||||||||||||||||||||||||||||||
1804 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
1805 | - | |||||||||||||||||||||||||||||||
1806 | glyph = engine->glyphIndex(ucs4); | - | ||||||||||||||||||||||||||||||
1807 | if (glyph != 0
| 0 | ||||||||||||||||||||||||||||||
1808 | - | |||||||||||||||||||||||||||||||
1809 | glyph |= (x << 24); | - | ||||||||||||||||||||||||||||||
1810 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
1811 | } | - | ||||||||||||||||||||||||||||||
1812 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1813 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1814 | - | |||||||||||||||||||||||||||||||
1815 | return never executed: glyph;return glyph; never executed: return glyph; | 0 | ||||||||||||||||||||||||||||||
1816 | } | - | ||||||||||||||||||||||||||||||
1817 | - | |||||||||||||||||||||||||||||||
1818 | bool QFontEngineMulti::stringToCMap(const QChar *str, int len, | - | ||||||||||||||||||||||||||||||
1819 | QGlyphLayout *glyphs, int *nglyphs, | - | ||||||||||||||||||||||||||||||
1820 | QFontEngine::ShaperFlags flags) const | - | ||||||||||||||||||||||||||||||
1821 | { | - | ||||||||||||||||||||||||||||||
1822 | if (!engine(0)->stringToCMap(str, len, glyphs, nglyphs, flags)
| 0 | ||||||||||||||||||||||||||||||
1823 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
1824 | - | |||||||||||||||||||||||||||||||
1825 | int glyph_pos = 0; | - | ||||||||||||||||||||||||||||||
1826 | QStringIterator it(str, str + len); | - | ||||||||||||||||||||||||||||||
1827 | while (it.hasNext()
| 0 | ||||||||||||||||||||||||||||||
1828 | const uint ucs4 = it.peekNext(); | - | ||||||||||||||||||||||||||||||
1829 | if (glyphs->glyphs[glyph_pos] == 0
| 0 | ||||||||||||||||||||||||||||||
1830 | if (!m_fallbackFamiliesQueried
| 0 | ||||||||||||||||||||||||||||||
1831 | const_cast< never executed: QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried(); never executed: const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried(); | 0 | ||||||||||||||||||||||||||||||
1832 | for (int x = 1, n = qMin(m_engines.size(), 256); x < n
| 0 | ||||||||||||||||||||||||||||||
1833 | QFontEngine *engine = m_engines.at(x); | - | ||||||||||||||||||||||||||||||
1834 | if (!engine
| 0 | ||||||||||||||||||||||||||||||
1835 | if (!shouldLoadFontEngineForCharacter(x, ucs4)
| 0 | ||||||||||||||||||||||||||||||
1836 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
1837 | const_cast<QFontEngineMulti *>(this)->ensureEngineAt(x); | - | ||||||||||||||||||||||||||||||
1838 | engine = m_engines.at(x); | - | ||||||||||||||||||||||||||||||
1839 | if (!engine
| 0 | ||||||||||||||||||||||||||||||
1840 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
1841 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1842 | ((!(engine != 0)) ? qt_assert("engine != 0",__FILE__,1904) : qt_noop()); | - | ||||||||||||||||||||||||||||||
1843 | if (engine->type() == Box
| 0 | ||||||||||||||||||||||||||||||
1844 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
1845 | - | |||||||||||||||||||||||||||||||
1846 | glyph_t glyph = engine->glyphIndex(ucs4); | - | ||||||||||||||||||||||||||||||
1847 | if (glyph != 0
| 0 | ||||||||||||||||||||||||||||||
1848 | glyphs->glyphs[glyph_pos] = glyph; | - | ||||||||||||||||||||||||||||||
1849 | if (!(flags & GlyphIndicesOnly)
| 0 | ||||||||||||||||||||||||||||||
1850 | QGlyphLayout g = glyphs->mid(glyph_pos, 1); | - | ||||||||||||||||||||||||||||||
1851 | engine->recalcAdvances(&g, flags); | - | ||||||||||||||||||||||||||||||
1852 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1853 | - | |||||||||||||||||||||||||||||||
1854 | glyphs->glyphs[glyph_pos] |= (x << 24); | - | ||||||||||||||||||||||||||||||
1855 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
1856 | } | - | ||||||||||||||||||||||||||||||
1857 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1858 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1859 | - | |||||||||||||||||||||||||||||||
1860 | it.advance(); | - | ||||||||||||||||||||||||||||||
1861 | ++glyph_pos; | - | ||||||||||||||||||||||||||||||
1862 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1863 | - | |||||||||||||||||||||||||||||||
1864 | *nglyphs = glyph_pos; | - | ||||||||||||||||||||||||||||||
1865 | glyphs->numGlyphs = glyph_pos; | - | ||||||||||||||||||||||||||||||
1866 | - | |||||||||||||||||||||||||||||||
1867 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
1868 | } | - | ||||||||||||||||||||||||||||||
1869 | - | |||||||||||||||||||||||||||||||
1870 | bool QFontEngineMulti::shouldLoadFontEngineForCharacter(int at, uint ucs4) const | - | ||||||||||||||||||||||||||||||
1871 | { | - | ||||||||||||||||||||||||||||||
1872 | (void)at;; | - | ||||||||||||||||||||||||||||||
1873 | (void)ucs4;; | - | ||||||||||||||||||||||||||||||
1874 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
1875 | } | - | ||||||||||||||||||||||||||||||
1876 | - | |||||||||||||||||||||||||||||||
1877 | glyph_metrics_t QFontEngineMulti::boundingBox(const QGlyphLayout &glyphs) | - | ||||||||||||||||||||||||||||||
1878 | { | - | ||||||||||||||||||||||||||||||
1879 | if (glyphs.numGlyphs <= 0
| 0 | ||||||||||||||||||||||||||||||
1880 | return never executed: glyph_metrics_t();return glyph_metrics_t(); never executed: return glyph_metrics_t(); | 0 | ||||||||||||||||||||||||||||||
1881 | - | |||||||||||||||||||||||||||||||
1882 | glyph_metrics_t overall; | - | ||||||||||||||||||||||||||||||
1883 | - | |||||||||||||||||||||||||||||||
1884 | int which = highByte(glyphs.glyphs[0]); | - | ||||||||||||||||||||||||||||||
1885 | int start = 0; | - | ||||||||||||||||||||||||||||||
1886 | int end, i; | - | ||||||||||||||||||||||||||||||
1887 | for (end = 0; end < glyphs.numGlyphs
| 0 | ||||||||||||||||||||||||||||||
1888 | const int e = highByte(glyphs.glyphs[end]); | - | ||||||||||||||||||||||||||||||
1889 | if (e == which
| 0 | ||||||||||||||||||||||||||||||
1890 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
1891 | - | |||||||||||||||||||||||||||||||
1892 | - | |||||||||||||||||||||||||||||||
1893 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
1894 | glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); never executed: glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); | 0 | ||||||||||||||||||||||||||||||
1895 | - | |||||||||||||||||||||||||||||||
1896 | - | |||||||||||||||||||||||||||||||
1897 | const glyph_metrics_t gm = engine(which)->boundingBox(glyphs.mid(start, end - start)); | - | ||||||||||||||||||||||||||||||
1898 | - | |||||||||||||||||||||||||||||||
1899 | overall.x = qMin(overall.x, gm.x); | - | ||||||||||||||||||||||||||||||
1900 | overall.y = qMin(overall.y, gm.y); | - | ||||||||||||||||||||||||||||||
1901 | overall.width = overall.xoff + gm.width; | - | ||||||||||||||||||||||||||||||
1902 | overall.height = qMax(overall.height + overall.y, gm.height + gm.y) - | - | ||||||||||||||||||||||||||||||
1903 | qMin(overall.y, gm.y); | - | ||||||||||||||||||||||||||||||
1904 | overall.xoff += gm.xoff; | - | ||||||||||||||||||||||||||||||
1905 | overall.yoff += gm.yoff; | - | ||||||||||||||||||||||||||||||
1906 | - | |||||||||||||||||||||||||||||||
1907 | - | |||||||||||||||||||||||||||||||
1908 | const int hi = which << 24; | - | ||||||||||||||||||||||||||||||
1909 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
1910 | glyphs.glyphs[i] = hi | glyphs.glyphs[i]; never executed: glyphs.glyphs[i] = hi | glyphs.glyphs[i]; | 0 | ||||||||||||||||||||||||||||||
1911 | - | |||||||||||||||||||||||||||||||
1912 | - | |||||||||||||||||||||||||||||||
1913 | start = end; | - | ||||||||||||||||||||||||||||||
1914 | which = e; | - | ||||||||||||||||||||||||||||||
1915 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1916 | - | |||||||||||||||||||||||||||||||
1917 | - | |||||||||||||||||||||||||||||||
1918 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
1919 | glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); never executed: glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); | 0 | ||||||||||||||||||||||||||||||
1920 | - | |||||||||||||||||||||||||||||||
1921 | - | |||||||||||||||||||||||||||||||
1922 | const glyph_metrics_t gm = engine(which)->boundingBox(glyphs.mid(start, end - start)); | - | ||||||||||||||||||||||||||||||
1923 | - | |||||||||||||||||||||||||||||||
1924 | overall.x = qMin(overall.x, gm.x); | - | ||||||||||||||||||||||||||||||
1925 | overall.y = qMin(overall.y, gm.y); | - | ||||||||||||||||||||||||||||||
1926 | overall.width = overall.xoff + gm.width; | - | ||||||||||||||||||||||||||||||
1927 | overall.height = qMax(overall.height + overall.y, gm.height + gm.y) - | - | ||||||||||||||||||||||||||||||
1928 | qMin(overall.y, gm.y); | - | ||||||||||||||||||||||||||||||
1929 | overall.xoff += gm.xoff; | - | ||||||||||||||||||||||||||||||
1930 | overall.yoff += gm.yoff; | - | ||||||||||||||||||||||||||||||
1931 | - | |||||||||||||||||||||||||||||||
1932 | - | |||||||||||||||||||||||||||||||
1933 | const int hi = which << 24; | - | ||||||||||||||||||||||||||||||
1934 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
1935 | glyphs.glyphs[i] = hi | glyphs.glyphs[i]; never executed: glyphs.glyphs[i] = hi | glyphs.glyphs[i]; | 0 | ||||||||||||||||||||||||||||||
1936 | - | |||||||||||||||||||||||||||||||
1937 | return never executed: overall;return overall; never executed: return overall; | 0 | ||||||||||||||||||||||||||||||
1938 | } | - | ||||||||||||||||||||||||||||||
1939 | - | |||||||||||||||||||||||||||||||
1940 | void QFontEngineMulti::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing) | - | ||||||||||||||||||||||||||||||
1941 | { | - | ||||||||||||||||||||||||||||||
1942 | int which = highByte(glyph); | - | ||||||||||||||||||||||||||||||
1943 | ensureEngineAt(which); | - | ||||||||||||||||||||||||||||||
1944 | engine(which)->getGlyphBearings(stripped(glyph), leftBearing, rightBearing); | - | ||||||||||||||||||||||||||||||
1945 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1946 | - | |||||||||||||||||||||||||||||||
1947 | void QFontEngineMulti::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, | - | ||||||||||||||||||||||||||||||
1948 | QPainterPath *path, QTextItem::RenderFlags flags) | - | ||||||||||||||||||||||||||||||
1949 | { | - | ||||||||||||||||||||||||||||||
1950 | if (glyphs.numGlyphs <= 0
| 0 | ||||||||||||||||||||||||||||||
1951 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1952 | - | |||||||||||||||||||||||||||||||
1953 | int which = highByte(glyphs.glyphs[0]); | - | ||||||||||||||||||||||||||||||
1954 | int start = 0; | - | ||||||||||||||||||||||||||||||
1955 | int end, i; | - | ||||||||||||||||||||||||||||||
1956 | if (flags & QTextItem::RightToLeft
| 0 | ||||||||||||||||||||||||||||||
1957 | for (int gl = 0; gl < glyphs.numGlyphs
| 0 | ||||||||||||||||||||||||||||||
1958 | x += glyphs.advances[gl].toReal(); never executed: x += glyphs.advances[gl].toReal(); | 0 | ||||||||||||||||||||||||||||||
1959 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1960 | for (end = 0; end < glyphs.numGlyphs
| 0 | ||||||||||||||||||||||||||||||
1961 | const int e = highByte(glyphs.glyphs[end]); | - | ||||||||||||||||||||||||||||||
1962 | if (e == which
| 0 | ||||||||||||||||||||||||||||||
1963 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
1964 | - | |||||||||||||||||||||||||||||||
1965 | if (flags & QTextItem::RightToLeft
| 0 | ||||||||||||||||||||||||||||||
1966 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
1967 | x -= glyphs.advances[i].toReal(); never executed: x -= glyphs.advances[i].toReal(); | 0 | ||||||||||||||||||||||||||||||
1968 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1969 | - | |||||||||||||||||||||||||||||||
1970 | - | |||||||||||||||||||||||||||||||
1971 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
1972 | glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); never executed: glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); | 0 | ||||||||||||||||||||||||||||||
1973 | engine(which)->addOutlineToPath(x, y, glyphs.mid(start, end - start), path, flags); | - | ||||||||||||||||||||||||||||||
1974 | - | |||||||||||||||||||||||||||||||
1975 | const int hi = which << 24; | - | ||||||||||||||||||||||||||||||
1976 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
1977 | glyphs.glyphs[i] = hi | glyphs.glyphs[i]; never executed: glyphs.glyphs[i] = hi | glyphs.glyphs[i]; | 0 | ||||||||||||||||||||||||||||||
1978 | - | |||||||||||||||||||||||||||||||
1979 | if (!(flags & QTextItem::RightToLeft)
| 0 | ||||||||||||||||||||||||||||||
1980 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
1981 | x += glyphs.advances[i].toReal(); never executed: x += glyphs.advances[i].toReal(); | 0 | ||||||||||||||||||||||||||||||
1982 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1983 | - | |||||||||||||||||||||||||||||||
1984 | - | |||||||||||||||||||||||||||||||
1985 | start = end; | - | ||||||||||||||||||||||||||||||
1986 | which = e; | - | ||||||||||||||||||||||||||||||
1987 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1988 | - | |||||||||||||||||||||||||||||||
1989 | if (flags & QTextItem::RightToLeft
| 0 | ||||||||||||||||||||||||||||||
1990 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
1991 | x -= glyphs.advances[i].toReal(); never executed: x -= glyphs.advances[i].toReal(); | 0 | ||||||||||||||||||||||||||||||
1992 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1993 | - | |||||||||||||||||||||||||||||||
1994 | - | |||||||||||||||||||||||||||||||
1995 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
1996 | glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); never executed: glyphs.glyphs[i] = stripped(glyphs.glyphs[i]); | 0 | ||||||||||||||||||||||||||||||
1997 | - | |||||||||||||||||||||||||||||||
1998 | engine(which)->addOutlineToPath(x, y, glyphs.mid(start, end - start), path, flags); | - | ||||||||||||||||||||||||||||||
1999 | - | |||||||||||||||||||||||||||||||
2000 | - | |||||||||||||||||||||||||||||||
2001 | const int hi = which << 24; | - | ||||||||||||||||||||||||||||||
2002 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
2003 | glyphs.glyphs[i] = hi | glyphs.glyphs[i]; never executed: glyphs.glyphs[i] = hi | glyphs.glyphs[i]; | 0 | ||||||||||||||||||||||||||||||
2004 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
2005 | - | |||||||||||||||||||||||||||||||
2006 | void QFontEngineMulti::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const | - | ||||||||||||||||||||||||||||||
2007 | { | - | ||||||||||||||||||||||||||||||
2008 | if (glyphs->numGlyphs <= 0
| 0 | ||||||||||||||||||||||||||||||
2009 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
2010 | - | |||||||||||||||||||||||||||||||
2011 | int which = highByte(glyphs->glyphs[0]); | - | ||||||||||||||||||||||||||||||
2012 | int start = 0; | - | ||||||||||||||||||||||||||||||
2013 | int end, i; | - | ||||||||||||||||||||||||||||||
2014 | for (end = 0; end < glyphs->numGlyphs
| 0 | ||||||||||||||||||||||||||||||
2015 | const int e = highByte(glyphs->glyphs[end]); | - | ||||||||||||||||||||||||||||||
2016 | if (e == which
| 0 | ||||||||||||||||||||||||||||||
2017 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
2018 | - | |||||||||||||||||||||||||||||||
2019 | - | |||||||||||||||||||||||||||||||
2020 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
2021 | glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); never executed: glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); | 0 | ||||||||||||||||||||||||||||||
2022 | - | |||||||||||||||||||||||||||||||
2023 | QGlyphLayout offs = glyphs->mid(start, end - start); | - | ||||||||||||||||||||||||||||||
2024 | engine(which)->recalcAdvances(&offs, flags); | - | ||||||||||||||||||||||||||||||
2025 | - | |||||||||||||||||||||||||||||||
2026 | - | |||||||||||||||||||||||||||||||
2027 | const int hi = which << 24; | - | ||||||||||||||||||||||||||||||
2028 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
2029 | glyphs->glyphs[i] = hi | glyphs->glyphs[i]; never executed: glyphs->glyphs[i] = hi | glyphs->glyphs[i]; | 0 | ||||||||||||||||||||||||||||||
2030 | - | |||||||||||||||||||||||||||||||
2031 | - | |||||||||||||||||||||||||||||||
2032 | start = end; | - | ||||||||||||||||||||||||||||||
2033 | which = e; | - | ||||||||||||||||||||||||||||||
2034 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
2035 | - | |||||||||||||||||||||||||||||||
2036 | - | |||||||||||||||||||||||||||||||
2037 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
2038 | glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); never executed: glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); | 0 | ||||||||||||||||||||||||||||||
2039 | - | |||||||||||||||||||||||||||||||
2040 | QGlyphLayout offs = glyphs->mid(start, end - start); | - | ||||||||||||||||||||||||||||||
2041 | engine(which)->recalcAdvances(&offs, flags); | - | ||||||||||||||||||||||||||||||
2042 | - | |||||||||||||||||||||||||||||||
2043 | - | |||||||||||||||||||||||||||||||
2044 | const int hi = which << 24; | - | ||||||||||||||||||||||||||||||
2045 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
2046 | glyphs->glyphs[i] = hi | glyphs->glyphs[i]; never executed: glyphs->glyphs[i] = hi | glyphs->glyphs[i]; | 0 | ||||||||||||||||||||||||||||||
2047 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
2048 | - | |||||||||||||||||||||||||||||||
2049 | void QFontEngineMulti::doKerning(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const | - | ||||||||||||||||||||||||||||||
2050 | { | - | ||||||||||||||||||||||||||||||
2051 | if (glyphs->numGlyphs <= 0
| 0 | ||||||||||||||||||||||||||||||
2052 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
2053 | - | |||||||||||||||||||||||||||||||
2054 | int which = highByte(glyphs->glyphs[0]); | - | ||||||||||||||||||||||||||||||
2055 | int start = 0; | - | ||||||||||||||||||||||||||||||
2056 | int end, i; | - | ||||||||||||||||||||||||||||||
2057 | for (end = 0; end < glyphs->numGlyphs
| 0 | ||||||||||||||||||||||||||||||
2058 | const int e = highByte(glyphs->glyphs[end]); | - | ||||||||||||||||||||||||||||||
2059 | if (e == which
| 0 | ||||||||||||||||||||||||||||||
2060 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
2061 | - | |||||||||||||||||||||||||||||||
2062 | - | |||||||||||||||||||||||||||||||
2063 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
2064 | glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); never executed: glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); | 0 | ||||||||||||||||||||||||||||||
2065 | - | |||||||||||||||||||||||||||||||
2066 | QGlyphLayout offs = glyphs->mid(start, end - start); | - | ||||||||||||||||||||||||||||||
2067 | engine(which)->doKerning(&offs, flags); | - | ||||||||||||||||||||||||||||||
2068 | - | |||||||||||||||||||||||||||||||
2069 | - | |||||||||||||||||||||||||||||||
2070 | const int hi = which << 24; | - | ||||||||||||||||||||||||||||||
2071 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
2072 | glyphs->glyphs[i] = hi | glyphs->glyphs[i]; never executed: glyphs->glyphs[i] = hi | glyphs->glyphs[i]; | 0 | ||||||||||||||||||||||||||||||
2073 | - | |||||||||||||||||||||||||||||||
2074 | - | |||||||||||||||||||||||||||||||
2075 | start = end; | - | ||||||||||||||||||||||||||||||
2076 | which = e; | - | ||||||||||||||||||||||||||||||
2077 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
2078 | - | |||||||||||||||||||||||||||||||
2079 | - | |||||||||||||||||||||||||||||||
2080 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
2081 | glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); never executed: glyphs->glyphs[i] = stripped(glyphs->glyphs[i]); | 0 | ||||||||||||||||||||||||||||||
2082 | - | |||||||||||||||||||||||||||||||
2083 | QGlyphLayout offs = glyphs->mid(start, end - start); | - | ||||||||||||||||||||||||||||||
2084 | engine(which)->doKerning(&offs, flags); | - | ||||||||||||||||||||||||||||||
2085 | - | |||||||||||||||||||||||||||||||
2086 | - | |||||||||||||||||||||||||||||||
2087 | const int hi = which << 24; | - | ||||||||||||||||||||||||||||||
2088 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||||||||
2089 | glyphs->glyphs[i] = hi | glyphs->glyphs[i]; never executed: glyphs->glyphs[i] = hi | glyphs->glyphs[i]; | 0 | ||||||||||||||||||||||||||||||
2090 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
2091 | - | |||||||||||||||||||||||||||||||
2092 | glyph_metrics_t QFontEngineMulti::boundingBox(glyph_t glyph) | - | ||||||||||||||||||||||||||||||
2093 | { | - | ||||||||||||||||||||||||||||||
2094 | const int which = highByte(glyph); | - | ||||||||||||||||||||||||||||||
2095 | return never executed: engine(which)->boundingBox(stripped(glyph));return engine(which)->boundingBox(stripped(glyph)); never executed: return engine(which)->boundingBox(stripped(glyph)); | 0 | ||||||||||||||||||||||||||||||
2096 | } | - | ||||||||||||||||||||||||||||||
2097 | - | |||||||||||||||||||||||||||||||
2098 | QFixed QFontEngineMulti::ascent() const | - | ||||||||||||||||||||||||||||||
2099 | { return never executed: engine(0)->ascent();return engine(0)->ascent(); never executed: }return engine(0)->ascent(); | 0 | ||||||||||||||||||||||||||||||
2100 | - | |||||||||||||||||||||||||||||||
2101 | QFixed QFontEngineMulti::descent() const | - | ||||||||||||||||||||||||||||||
2102 | { return never executed: engine(0)->descent();return engine(0)->descent(); never executed: }return engine(0)->descent(); | 0 | ||||||||||||||||||||||||||||||
2103 | - | |||||||||||||||||||||||||||||||
2104 | QFixed QFontEngineMulti::leading() const | - | ||||||||||||||||||||||||||||||
2105 | { | - | ||||||||||||||||||||||||||||||
2106 | return never executed: engine(0)->leading();return engine(0)->leading(); never executed: return engine(0)->leading(); | 0 | ||||||||||||||||||||||||||||||
2107 | } | - | ||||||||||||||||||||||||||||||
2108 | - | |||||||||||||||||||||||||||||||
2109 | QFixed QFontEngineMulti::xHeight() const | - | ||||||||||||||||||||||||||||||
2110 | { | - | ||||||||||||||||||||||||||||||
2111 | return never executed: engine(0)->xHeight();return engine(0)->xHeight(); never executed: return engine(0)->xHeight(); | 0 | ||||||||||||||||||||||||||||||
2112 | } | - | ||||||||||||||||||||||||||||||
2113 | - | |||||||||||||||||||||||||||||||
2114 | QFixed QFontEngineMulti::averageCharWidth() const | - | ||||||||||||||||||||||||||||||
2115 | { | - | ||||||||||||||||||||||||||||||
2116 | return never executed: engine(0)->averageCharWidth();return engine(0)->averageCharWidth(); never executed: return engine(0)->averageCharWidth(); | 0 | ||||||||||||||||||||||||||||||
2117 | } | - | ||||||||||||||||||||||||||||||
2118 | - | |||||||||||||||||||||||||||||||
2119 | QFixed QFontEngineMulti::lineThickness() const | - | ||||||||||||||||||||||||||||||
2120 | { | - | ||||||||||||||||||||||||||||||
2121 | return never executed: engine(0)->lineThickness();return engine(0)->lineThickness(); never executed: return engine(0)->lineThickness(); | 0 | ||||||||||||||||||||||||||||||
2122 | } | - | ||||||||||||||||||||||||||||||
2123 | - | |||||||||||||||||||||||||||||||
2124 | QFixed QFontEngineMulti::underlinePosition() const | - | ||||||||||||||||||||||||||||||
2125 | { | - | ||||||||||||||||||||||||||||||
2126 | return never executed: engine(0)->underlinePosition();return engine(0)->underlinePosition(); never executed: return engine(0)->underlinePosition(); | 0 | ||||||||||||||||||||||||||||||
2127 | } | - | ||||||||||||||||||||||||||||||
2128 | - | |||||||||||||||||||||||||||||||
2129 | qreal QFontEngineMulti::maxCharWidth() const | - | ||||||||||||||||||||||||||||||
2130 | { | - | ||||||||||||||||||||||||||||||
2131 | return never executed: engine(0)->maxCharWidth();return engine(0)->maxCharWidth(); never executed: return engine(0)->maxCharWidth(); | 0 | ||||||||||||||||||||||||||||||
2132 | } | - | ||||||||||||||||||||||||||||||
2133 | - | |||||||||||||||||||||||||||||||
2134 | qreal QFontEngineMulti::minLeftBearing() const | - | ||||||||||||||||||||||||||||||
2135 | { | - | ||||||||||||||||||||||||||||||
2136 | return never executed: engine(0)->minLeftBearing();return engine(0)->minLeftBearing(); never executed: return engine(0)->minLeftBearing(); | 0 | ||||||||||||||||||||||||||||||
2137 | } | - | ||||||||||||||||||||||||||||||
2138 | - | |||||||||||||||||||||||||||||||
2139 | qreal QFontEngineMulti::minRightBearing() const | - | ||||||||||||||||||||||||||||||
2140 | { | - | ||||||||||||||||||||||||||||||
2141 | return never executed: engine(0)->minRightBearing();return engine(0)->minRightBearing(); never executed: return engine(0)->minRightBearing(); | 0 | ||||||||||||||||||||||||||||||
2142 | } | - | ||||||||||||||||||||||||||||||
2143 | - | |||||||||||||||||||||||||||||||
2144 | bool QFontEngineMulti::canRender(const QChar *string, int len) const | - | ||||||||||||||||||||||||||||||
2145 | { | - | ||||||||||||||||||||||||||||||
2146 | if (engine(0)->canRender(string, len)
| 0 | ||||||||||||||||||||||||||||||
2147 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
2148 | - | |||||||||||||||||||||||||||||||
2149 | int nglyphs = len; | - | ||||||||||||||||||||||||||||||
2150 | - | |||||||||||||||||||||||||||||||
2151 | QVarLengthArray<glyph_t> glyphs(nglyphs); | - | ||||||||||||||||||||||||||||||
2152 | - | |||||||||||||||||||||||||||||||
2153 | QGlyphLayout g; | - | ||||||||||||||||||||||||||||||
2154 | g.numGlyphs = nglyphs; | - | ||||||||||||||||||||||||||||||
2155 | g.glyphs = glyphs.data(); | - | ||||||||||||||||||||||||||||||
2156 | if (!stringToCMap(string, len, &g, &nglyphs, GlyphIndicesOnly)
| 0 | ||||||||||||||||||||||||||||||
2157 | do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,2219) : qt_noop()); __builtin_unreachable(); } never executed: while (0);end of block | 0 | ||||||||||||||||||||||||||||||
2158 | - | |||||||||||||||||||||||||||||||
2159 | for (int i = 0; i < nglyphs
| 0 | ||||||||||||||||||||||||||||||
2160 | if (glyphs[i] == 0
| 0 | ||||||||||||||||||||||||||||||
2161 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
2162 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
2163 | - | |||||||||||||||||||||||||||||||
2164 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
2165 | } | - | ||||||||||||||||||||||||||||||
2166 | - | |||||||||||||||||||||||||||||||
2167 | - | |||||||||||||||||||||||||||||||
2168 | - | |||||||||||||||||||||||||||||||
2169 | - | |||||||||||||||||||||||||||||||
2170 | QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph) | - | ||||||||||||||||||||||||||||||
2171 | { | - | ||||||||||||||||||||||||||||||
2172 | const int which = highByte(glyph); | - | ||||||||||||||||||||||||||||||
2173 | return never executed: engine(which)->alphaMapForGlyph(stripped(glyph));return engine(which)->alphaMapForGlyph(stripped(glyph)); never executed: return engine(which)->alphaMapForGlyph(stripped(glyph)); | 0 | ||||||||||||||||||||||||||||||
2174 | } | - | ||||||||||||||||||||||||||||||
2175 | - | |||||||||||||||||||||||||||||||
2176 | QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) | - | ||||||||||||||||||||||||||||||
2177 | { | - | ||||||||||||||||||||||||||||||
2178 | const int which = highByte(glyph); | - | ||||||||||||||||||||||||||||||
2179 | return never executed: engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition);return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition); never executed: return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition); | 0 | ||||||||||||||||||||||||||||||
2180 | } | - | ||||||||||||||||||||||||||||||
2181 | - | |||||||||||||||||||||||||||||||
2182 | QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, const QTransform &t) | - | ||||||||||||||||||||||||||||||
2183 | { | - | ||||||||||||||||||||||||||||||
2184 | const int which = highByte(glyph); | - | ||||||||||||||||||||||||||||||
2185 | return never executed: engine(which)->alphaMapForGlyph(stripped(glyph), t);return engine(which)->alphaMapForGlyph(stripped(glyph), t); never executed: return engine(which)->alphaMapForGlyph(stripped(glyph), t); | 0 | ||||||||||||||||||||||||||||||
2186 | } | - | ||||||||||||||||||||||||||||||
2187 | - | |||||||||||||||||||||||||||||||
2188 | QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) | - | ||||||||||||||||||||||||||||||
2189 | { | - | ||||||||||||||||||||||||||||||
2190 | const int which = highByte(glyph); | - | ||||||||||||||||||||||||||||||
2191 | return never executed: engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition, t);return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition, t); never executed: return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition, t); | 0 | ||||||||||||||||||||||||||||||
2192 | } | - | ||||||||||||||||||||||||||||||
2193 | - | |||||||||||||||||||||||||||||||
2194 | QImage QFontEngineMulti::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) | - | ||||||||||||||||||||||||||||||
2195 | { | - | ||||||||||||||||||||||||||||||
2196 | const int which = highByte(glyph); | - | ||||||||||||||||||||||||||||||
2197 | return never executed: engine(which)->alphaRGBMapForGlyph(stripped(glyph), subPixelPosition, t);return engine(which)->alphaRGBMapForGlyph(stripped(glyph), subPixelPosition, t); never executed: return engine(which)->alphaRGBMapForGlyph(stripped(glyph), subPixelPosition, t); | 0 | ||||||||||||||||||||||||||||||
2198 | } | - | ||||||||||||||||||||||||||||||
2199 | QFontEngine *QFontEngineMulti::createMultiFontEngine(QFontEngine *fe, int script) | - | ||||||||||||||||||||||||||||||
2200 | { | - | ||||||||||||||||||||||||||||||
2201 | QFontEngine *engine = 0; | - | ||||||||||||||||||||||||||||||
2202 | QFontCache::Key key(fe->fontDef, script, true); | - | ||||||||||||||||||||||||||||||
2203 | QFontCache *fc = QFontCache::instance(); | - | ||||||||||||||||||||||||||||||
2204 | - | |||||||||||||||||||||||||||||||
2205 | - | |||||||||||||||||||||||||||||||
2206 | - | |||||||||||||||||||||||||||||||
2207 | - | |||||||||||||||||||||||||||||||
2208 | - | |||||||||||||||||||||||||||||||
2209 | const bool faceIsLocal = !fe->faceId().filename.isEmpty(); | - | ||||||||||||||||||||||||||||||
2210 | QFontCache::EngineCache::Iterator it = fc->engineCache.find(key), | - | ||||||||||||||||||||||||||||||
2211 | end = fc->engineCache.end(); | - | ||||||||||||||||||||||||||||||
2212 | while (it != end
| 0 | ||||||||||||||||||||||||||||||
2213 | ((!(it.value().data->type() == QFontEngine::Multi)) ? qt_assert("it.value().data->type() == QFontEngine::Multi",__FILE__,2284) : qt_noop()); | - | ||||||||||||||||||||||||||||||
2214 | QFontEngineMulti *cachedEngine = static_cast<QFontEngineMulti *>(it.value().data); | - | ||||||||||||||||||||||||||||||
2215 | if (fe == cachedEngine->engine(0)
| 0 | ||||||||||||||||||||||||||||||
2216 | engine = cachedEngine; | - | ||||||||||||||||||||||||||||||
2217 | fc->updateHitCountAndTimeStamp(it.value()); | - | ||||||||||||||||||||||||||||||
2218 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
2219 | } | - | ||||||||||||||||||||||||||||||
2220 | ++it; | - | ||||||||||||||||||||||||||||||
2221 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
2222 | if (!engine
| 0 | ||||||||||||||||||||||||||||||
2223 | engine = QGuiApplicationPrivate::instance()->platformIntegration()->fontDatabase()->fontEngineMulti(fe, QChar::Script(script)); | - | ||||||||||||||||||||||||||||||
2224 | fc->insertEngine(key, engine, !faceIsLocal); | - | ||||||||||||||||||||||||||||||
2225 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
2226 | ((!(engine)) ? qt_assert("engine",__FILE__,2297) : qt_noop()); | - | ||||||||||||||||||||||||||||||
2227 | return never executed: engine;return engine; never executed: return engine; | 0 | ||||||||||||||||||||||||||||||
2228 | } | - | ||||||||||||||||||||||||||||||
2229 | - | |||||||||||||||||||||||||||||||
2230 | QTestFontEngine::QTestFontEngine(int size) | - | ||||||||||||||||||||||||||||||
2231 | : QFontEngineBox(TestFontEngine, size) | - | ||||||||||||||||||||||||||||||
2232 | {} never executed: end of block | 0 | ||||||||||||||||||||||||||||||
2233 | - | |||||||||||||||||||||||||||||||
2234 | - | |||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |