qharfbuzzng.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/text/qharfbuzzng.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9static const hb_script_t _qtscript_to_hbscript[] = {-
10 HB_SCRIPT_UNKNOWN,-
11 HB_SCRIPT_INHERITED,-
12 HB_SCRIPT_COMMON,-
13-
14 HB_SCRIPT_LATIN,-
15 HB_SCRIPT_GREEK,-
16 HB_SCRIPT_CYRILLIC,-
17 HB_SCRIPT_ARMENIAN,-
18 HB_SCRIPT_HEBREW,-
19 HB_SCRIPT_ARABIC,-
20 HB_SCRIPT_SYRIAC,-
21 HB_SCRIPT_THAANA,-
22 HB_SCRIPT_DEVANAGARI,-
23 HB_SCRIPT_BENGALI,-
24 HB_SCRIPT_GURMUKHI,-
25 HB_SCRIPT_GUJARATI,-
26 HB_SCRIPT_ORIYA,-
27 HB_SCRIPT_TAMIL,-
28 HB_SCRIPT_TELUGU,-
29 HB_SCRIPT_KANNADA,-
30 HB_SCRIPT_MALAYALAM,-
31 HB_SCRIPT_SINHALA,-
32 HB_SCRIPT_THAI,-
33 HB_SCRIPT_LAO,-
34 HB_SCRIPT_TIBETAN,-
35 HB_SCRIPT_MYANMAR,-
36 HB_SCRIPT_GEORGIAN,-
37 HB_SCRIPT_HANGUL,-
38 HB_SCRIPT_ETHIOPIC,-
39 HB_SCRIPT_CHEROKEE,-
40 HB_SCRIPT_CANADIAN_SYLLABICS,-
41 HB_SCRIPT_OGHAM,-
42 HB_SCRIPT_RUNIC,-
43 HB_SCRIPT_KHMER,-
44 HB_SCRIPT_MONGOLIAN,-
45 HB_SCRIPT_HIRAGANA,-
46 HB_SCRIPT_KATAKANA,-
47 HB_SCRIPT_BOPOMOFO,-
48 HB_SCRIPT_HAN,-
49 HB_SCRIPT_YI,-
50 HB_SCRIPT_OLD_ITALIC,-
51 HB_SCRIPT_GOTHIC,-
52 HB_SCRIPT_DESERET,-
53 HB_SCRIPT_TAGALOG,-
54 HB_SCRIPT_HANUNOO,-
55 HB_SCRIPT_BUHID,-
56 HB_SCRIPT_TAGBANWA,-
57 HB_SCRIPT_COPTIC,-
58-
59-
60 HB_SCRIPT_LIMBU,-
61 HB_SCRIPT_TAI_LE,-
62 HB_SCRIPT_LINEAR_B,-
63 HB_SCRIPT_UGARITIC,-
64 HB_SCRIPT_SHAVIAN,-
65 HB_SCRIPT_OSMANYA,-
66 HB_SCRIPT_CYPRIOT,-
67 HB_SCRIPT_BRAILLE,-
68-
69-
70 HB_SCRIPT_BUGINESE,-
71 HB_SCRIPT_NEW_TAI_LUE,-
72 HB_SCRIPT_GLAGOLITIC,-
73 HB_SCRIPT_TIFINAGH,-
74 HB_SCRIPT_SYLOTI_NAGRI,-
75 HB_SCRIPT_OLD_PERSIAN,-
76 HB_SCRIPT_KHAROSHTHI,-
77-
78-
79 HB_SCRIPT_BALINESE,-
80 HB_SCRIPT_CUNEIFORM,-
81 HB_SCRIPT_PHOENICIAN,-
82 HB_SCRIPT_PHAGS_PA,-
83 HB_SCRIPT_NKO,-
84-
85-
86 HB_SCRIPT_SUNDANESE,-
87 HB_SCRIPT_LEPCHA,-
88 HB_SCRIPT_OL_CHIKI,-
89 HB_SCRIPT_VAI,-
90 HB_SCRIPT_SAURASHTRA,-
91 HB_SCRIPT_KAYAH_LI,-
92 HB_SCRIPT_REJANG,-
93 HB_SCRIPT_LYCIAN,-
94 HB_SCRIPT_CARIAN,-
95 HB_SCRIPT_LYDIAN,-
96 HB_SCRIPT_CHAM,-
97-
98-
99 HB_SCRIPT_TAI_THAM,-
100 HB_SCRIPT_TAI_VIET,-
101 HB_SCRIPT_AVESTAN,-
102 HB_SCRIPT_EGYPTIAN_HIEROGLYPHS,-
103 HB_SCRIPT_SAMARITAN,-
104 HB_SCRIPT_LISU,-
105 HB_SCRIPT_BAMUM,-
106 HB_SCRIPT_JAVANESE,-
107 HB_SCRIPT_MEETEI_MAYEK,-
108 HB_SCRIPT_IMPERIAL_ARAMAIC,-
109 HB_SCRIPT_OLD_SOUTH_ARABIAN,-
110 HB_SCRIPT_INSCRIPTIONAL_PARTHIAN,-
111 HB_SCRIPT_INSCRIPTIONAL_PAHLAVI,-
112 HB_SCRIPT_OLD_TURKIC,-
113 HB_SCRIPT_KAITHI,-
114-
115-
116 HB_SCRIPT_BATAK,-
117 HB_SCRIPT_BRAHMI,-
118 HB_SCRIPT_MANDAIC,-
119-
120-
121 HB_SCRIPT_CHAKMA,-
122 HB_SCRIPT_MEROITIC_CURSIVE,-
123 HB_SCRIPT_MEROITIC_HIEROGLYPHS,-
124 HB_SCRIPT_MIAO,-
125 HB_SCRIPT_SHARADA,-
126 HB_SCRIPT_SORA_SOMPENG,-
127 HB_SCRIPT_TAKRI,-
128-
129-
130 HB_SCRIPT_CAUCASIAN_ALBANIAN,-
131 HB_SCRIPT_BASSA_VAH,-
132 HB_SCRIPT_DUPLOYAN,-
133 HB_SCRIPT_ELBASAN,-
134 HB_SCRIPT_GRANTHA,-
135 HB_SCRIPT_PAHAWH_HMONG,-
136 HB_SCRIPT_KHOJKI,-
137 HB_SCRIPT_LINEAR_A,-
138 HB_SCRIPT_MAHAJANI,-
139 HB_SCRIPT_MANICHAEAN,-
140 HB_SCRIPT_MENDE_KIKAKUI,-
141 HB_SCRIPT_MODI,-
142 HB_SCRIPT_MRO,-
143 HB_SCRIPT_OLD_NORTH_ARABIAN,-
144 HB_SCRIPT_NABATAEAN,-
145 HB_SCRIPT_PALMYRENE,-
146 HB_SCRIPT_PAU_CIN_HAU,-
147 HB_SCRIPT_OLD_PERMIC,-
148 HB_SCRIPT_PSALTER_PAHLAVI,-
149 HB_SCRIPT_SIDDHAM,-
150 HB_SCRIPT_KHUDAWADI,-
151 HB_SCRIPT_TIRHUTA,-
152 HB_SCRIPT_WARANG_CITI,-
153-
154-
155 HB_SCRIPT_AHOM,-
156 HB_SCRIPT_ANATOLIAN_HIEROGLYPHS,-
157 HB_SCRIPT_HATRAN,-
158 HB_SCRIPT_MULTANI,-
159 HB_SCRIPT_OLD_HUNGARIAN,-
160 HB_SCRIPT_SIGNWRITING-
161};-
162static_assert(bool(QChar::ScriptCount == sizeof(_qtscript_to_hbscript) / sizeof(_qtscript_to_hbscript[0])), "QChar::ScriptCount == sizeof(_qtscript_to_hbscript) / sizeof(_qtscript_to_hbscript[0])");-
163-
164hb_script_t hb_qt_script_to_script(QChar::Script script)-
165{-
166 return
never executed: return _qtscript_to_hbscript[script];
_qtscript_to_hbscript[script];
never executed: return _qtscript_to_hbscript[script];
0
167}-
168-
169QChar::Script hb_qt_script_from_script(hb_script_t script)-
170{-
171 uint i = QChar::ScriptCount - 1;-
172 while (i > QChar::Script_Unknown
i > QChar::Script_UnknownDescription
TRUEnever evaluated
FALSEnever evaluated
&& _qtscript_to_hbscript[i] != script
_qtscript_to_h...t[i] != scriptDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
173 --
never executed: --i;
i;
never executed: --i;
0
174 return
never executed: return QChar::Script(i);
QChar::Script(i);
never executed: return QChar::Script(i);
0
175}-
176-
177-
178static hb_unicode_combining_class_t-
179_hb_qt_unicode_combining_class(hb_unicode_funcs_t * ,-
180 hb_codepoint_t unicode,-
181 void * )-
182{-
183 return
never executed: return hb_unicode_combining_class_t(QChar::combiningClass(unicode));
hb_unicode_combining_class_t(QChar::combiningClass(unicode));
never executed: return hb_unicode_combining_class_t(QChar::combiningClass(unicode));
0
184}-
185-
186static unsigned int-
187_hb_qt_unicode_eastasian_width(hb_unicode_funcs_t * ,-
188 hb_codepoint_t ,-
189 void * )-
190{-
191 QMessageLogger(__FILE__, 236, __PRETTY_FUNCTION__).critical("hb_qt_unicode_eastasian_width: not implemented!");-
192 return
never executed: return 1;
1;
never executed: return 1;
0
193}-
194-
195static const hb_unicode_general_category_t _qtcategory_to_hbcategory[] = {-
196 HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK,-
197 HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK,-
198 HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK,-
199-
200 HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER,-
201 HB_UNICODE_GENERAL_CATEGORY_LETTER_NUMBER,-
202 HB_UNICODE_GENERAL_CATEGORY_OTHER_NUMBER,-
203-
204 HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR,-
205 HB_UNICODE_GENERAL_CATEGORY_LINE_SEPARATOR,-
206 HB_UNICODE_GENERAL_CATEGORY_PARAGRAPH_SEPARATOR,-
207-
208 HB_UNICODE_GENERAL_CATEGORY_CONTROL,-
209 HB_UNICODE_GENERAL_CATEGORY_FORMAT,-
210 HB_UNICODE_GENERAL_CATEGORY_SURROGATE,-
211 HB_UNICODE_GENERAL_CATEGORY_PRIVATE_USE,-
212 HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED,-
213-
214 HB_UNICODE_GENERAL_CATEGORY_UPPERCASE_LETTER,-
215 HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER,-
216 HB_UNICODE_GENERAL_CATEGORY_TITLECASE_LETTER,-
217 HB_UNICODE_GENERAL_CATEGORY_MODIFIER_LETTER,-
218 HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER,-
219-
220 HB_UNICODE_GENERAL_CATEGORY_CONNECT_PUNCTUATION,-
221 HB_UNICODE_GENERAL_CATEGORY_DASH_PUNCTUATION,-
222 HB_UNICODE_GENERAL_CATEGORY_OPEN_PUNCTUATION,-
223 HB_UNICODE_GENERAL_CATEGORY_CLOSE_PUNCTUATION,-
224 HB_UNICODE_GENERAL_CATEGORY_INITIAL_PUNCTUATION,-
225 HB_UNICODE_GENERAL_CATEGORY_FINAL_PUNCTUATION,-
226 HB_UNICODE_GENERAL_CATEGORY_OTHER_PUNCTUATION,-
227-
228 HB_UNICODE_GENERAL_CATEGORY_MATH_SYMBOL,-
229 HB_UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL,-
230 HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL,-
231 HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL-
232};-
233-
234static hb_unicode_general_category_t-
235_hb_qt_unicode_general_category(hb_unicode_funcs_t * ,-
236 hb_codepoint_t unicode,-
237 void * )-
238{-
239 return
never executed: return _qtcategory_to_hbcategory[QChar::category(unicode)];
_qtcategory_to_hbcategory[QChar::category(unicode)];
never executed: return _qtcategory_to_hbcategory[QChar::category(unicode)];
0
240}-
241-
242static hb_codepoint_t-
243_hb_qt_unicode_mirroring(hb_unicode_funcs_t * ,-
244 hb_codepoint_t unicode,-
245 void * )-
246{-
247 return
never executed: return QChar::mirroredChar(unicode);
QChar::mirroredChar(unicode);
never executed: return QChar::mirroredChar(unicode);
0
248}-
249-
250static hb_script_t-
251_hb_qt_unicode_script(hb_unicode_funcs_t * ,-
252 hb_codepoint_t unicode,-
253 void * )-
254{-
255 return
never executed: return _qtscript_to_hbscript[QChar::script(unicode)];
_qtscript_to_hbscript[QChar::script(unicode)];
never executed: return _qtscript_to_hbscript[QChar::script(unicode)];
0
256}-
257-
258static hb_bool_t-
259_hb_qt_unicode_compose(hb_unicode_funcs_t * ,-
260 hb_codepoint_t a, hb_codepoint_t b,-
261 hb_codepoint_t *ab,-
262 void * )-
263{-
264-
265 QString s = QString::fromUcs4(&a, 1) + QString::fromUcs4(&b, 1);-
266 QString normalized = s.normalized(QString::NormalizationForm_C);-
267-
268 QStringIterator it(normalized);-
269 ((!(it.hasNext())) ? qt_assert("it.hasNext()",__FILE__,314) : qt_noop());-
270 *ab = it.next();-
271-
272 return
never executed: return !it.hasNext();
!it.hasNext();
never executed: return !it.hasNext();
0
273}-
274-
275static hb_bool_t-
276_hb_qt_unicode_decompose(hb_unicode_funcs_t * ,-
277 hb_codepoint_t ab,-
278 hb_codepoint_t *a, hb_codepoint_t *b,-
279 void * )-
280{-
281-
282 if (QChar::decompositionTag(ab) != QChar::Canonical
QChar::decompo...har::CanonicalDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
283 return
never executed: return false;
false;
never executed: return false;
0
284-
285 QString normalized = QChar::decomposition(ab);-
286 if (normalized.isEmpty()
normalized.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
287 return
never executed: return false;
false;
never executed: return false;
0
288-
289 QStringIterator it(normalized);-
290 ((!(it.hasNext())) ? qt_assert("it.hasNext()",__FILE__,335) : qt_noop());-
291 *a = it.next();-
292-
293 if (!it.hasNext()
!it.hasNext()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
294 *b = 0;-
295 return
never executed: return *a != ab;
*a != ab;
never executed: return *a != ab;
0
296 }-
297-
298-
299 *b = it.next();-
300 if (!it.hasNext()
!it.hasNext()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
301-
302-
303-
304 const QString recomposed = normalized.normalized(QString::NormalizationForm_C);-
305 QStringIterator jt(recomposed);-
306 ((!(jt.hasNext())) ? qt_assert("jt.hasNext()",__FILE__,351) : qt_noop());-
307 const hb_codepoint_t c = jt.next();-
308 if (c != *a
c != *aDescription
TRUEnever evaluated
FALSEnever evaluated
&& c != ab
c != abDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
309 *a = c;-
310 *b = 0;-
311 }
never executed: end of block
0
312 return
never executed: return true;
true;
never executed: return true;
0
313 }-
314-
315-
316-
317-
318 do {-
319 *b = it.next();-
320 }
never executed: end of block
while (it.hasNext()
it.hasNext()Description
TRUEnever evaluated
FALSEnever evaluated
);
0
321 normalized.chop(QChar::requiresSurrogates(*b) ? 2 : 1);-
322 const QString recomposed = normalized.normalized(QString::NormalizationForm_C);-
323 QStringIterator jt(recomposed);-
324 ((!(jt.hasNext())) ? qt_assert("jt.hasNext()",__FILE__,369) : qt_noop());-
325-
326 *a = jt.next();-
327 return
never executed: return true;
true;
never executed: return true;
0
328}-
329-
330static unsigned int-
331_hb_qt_unicode_decompose_compatibility(hb_unicode_funcs_t * ,-
332 hb_codepoint_t u,-
333 hb_codepoint_t *decomposed,-
334 void * )-
335{-
336 const QString normalized = QChar::decomposition(u);-
337-
338 uint outlen = 0;-
339 QStringIterator it(normalized);-
340 while (it.hasNext()
it.hasNext()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
341 ((!(outlen < (18+1))) ? qt_assert("outlen < HB_UNICODE_MAX_DECOMPOSITION_LEN",__FILE__,386) : qt_noop());-
342 decomposed[outlen++] = it.next();-
343 }
never executed: end of block
0
344-
345 return
never executed: return outlen;
outlen;
never executed: return outlen;
0
346}-
347-
348-
349struct _hb_unicode_funcs_t {-
350 _hb_unicode_funcs_t()-
351 {-
352 funcs = hb_unicode_funcs_create(__null);-
353 hb_unicode_funcs_set_combining_class_func(funcs, _hb_qt_unicode_combining_class, __null, __null);-
354 hb_unicode_funcs_set_eastasian_width_func(funcs, _hb_qt_unicode_eastasian_width, __null, __null);-
355 hb_unicode_funcs_set_general_category_func(funcs, _hb_qt_unicode_general_category, __null, __null);-
356 hb_unicode_funcs_set_mirroring_func(funcs, _hb_qt_unicode_mirroring, __null, __null);-
357 hb_unicode_funcs_set_script_func(funcs, _hb_qt_unicode_script, __null, __null);-
358 hb_unicode_funcs_set_compose_func(funcs, _hb_qt_unicode_compose, __null, __null);-
359 hb_unicode_funcs_set_decompose_func(funcs, _hb_qt_unicode_decompose, __null, __null);-
360 hb_unicode_funcs_set_decompose_compatibility_func(funcs, _hb_qt_unicode_decompose_compatibility, __null, __null);-
361 }
never executed: end of block
0
362 ~_hb_unicode_funcs_t()-
363 {-
364 hb_unicode_funcs_destroy(funcs);-
365 }
never executed: end of block
0
366-
367 hb_unicode_funcs_t *funcs;-
368};-
369-
370namespace { namespace Q_QGS_qt_ufuncs { typedef _hb_unicode_funcs_t Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
never executed: guard.store(QtGlobalStatic::Destroyed);
}
never executed: end of block
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
never executed: return &holder.value;
&holder.value;
never executed: return &holder.value;
} } } static QGlobalStatic<_hb_unicode_funcs_t, Q_QGS_qt_ufuncs::innerFunction, Q_QGS_qt_ufuncs::guard> qt_ufuncs;
0
371-
372hb_unicode_funcs_t *hb_qt_get_unicode_funcs()-
373{-
374 return
never executed: return qt_ufuncs()->funcs;
qt_ufuncs()->funcs;
never executed: return qt_ufuncs()->funcs;
0
375}-
376-
377-
378-
379-
380static hb_bool_t-
381_hb_qt_font_get_glyph(hb_font_t * , void *font_data,-
382 hb_codepoint_t unicode, hb_codepoint_t ,-
383 hb_codepoint_t *glyph,-
384 void * )-
385{-
386 QFontEngine *fe = static_cast<QFontEngine *>(font_data);-
387 ((!(fe)) ? qt_assert("fe",__FILE__,432) : qt_noop());-
388-
389 *glyph = fe->glyphIndex(unicode);-
390-
391 return
never executed: return true;
true;
never executed: return true;
0
392}-
393-
394static hb_position_t-
395_hb_qt_font_get_glyph_h_advance(hb_font_t *font, void *font_data,-
396 hb_codepoint_t glyph,-
397 void * )-
398{-
399 QFontEngine *fe = static_cast<QFontEngine *>(font_data);-
400 ((!(fe)) ? qt_assert("fe",__FILE__,445) : qt_noop());-
401-
402 QFixed advance;-
403-
404 QGlyphLayout g;-
405 g.numGlyphs = 1;-
406 g.glyphs = &glyph;-
407 g.advances = &advance;-
408-
409 fe->recalcAdvances(&g, QFontEngine::ShaperFlags(hb_qt_font_get_use_design_metrics(font)));-
410-
411 return
never executed: return advance.value();
advance.value();
never executed: return advance.value();
0
412}-
413-
414static hb_position_t-
415_hb_qt_font_get_glyph_v_advance(hb_font_t * , void * ,-
416 hb_codepoint_t ,-
417 void * )-
418{-
419 QMessageLogger(__FILE__, 464, __PRETTY_FUNCTION__).critical("hb_qt_font_get_glyph_v_advance: vertical writing isn't supported!");-
420 return
never executed: return 0;
0;
never executed: return 0;
0
421}-
422-
423static hb_bool_t-
424_hb_qt_font_get_glyph_h_origin(hb_font_t * , void * ,-
425 hb_codepoint_t ,-
426 hb_position_t * , hb_position_t * ,-
427 void * )-
428{-
429 return
never executed: return true;
true;
never executed: return true;
0
430}-
431-
432static hb_bool_t-
433_hb_qt_font_get_glyph_v_origin(hb_font_t * , void * ,-
434 hb_codepoint_t ,-
435 hb_position_t * , hb_position_t * ,-
436 void * )-
437{-
438 QMessageLogger(__FILE__, 483, __PRETTY_FUNCTION__).critical("hb_qt_get_glyph_v_origin: vertical writing isn't supported!");-
439 return
never executed: return false;
false;
never executed: return false;
0
440}-
441-
442static hb_position_t-
443_hb_qt_font_get_glyph_h_kerning(hb_font_t *font, void *font_data,-
444 hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,-
445 void * )-
446{-
447 QFontEngine *fe = static_cast<QFontEngine *>(font_data);-
448 ((!(fe)) ? qt_assert("fe",__FILE__,493) : qt_noop());-
449-
450 glyph_t glyphs[2] = { first_glyph, second_glyph };-
451 QFixed advance;-
452-
453 QGlyphLayout g;-
454 g.numGlyphs = 2;-
455 g.glyphs = glyphs;-
456 g.advances = &advance;-
457-
458 fe->doKerning(&g, QFontEngine::ShaperFlags(hb_qt_font_get_use_design_metrics(font)));-
459-
460 return
never executed: return advance.value();
advance.value();
never executed: return advance.value();
0
461}-
462-
463static hb_position_t-
464_hb_qt_font_get_glyph_v_kerning(hb_font_t * , void * ,-
465 hb_codepoint_t , hb_codepoint_t ,-
466 void * )-
467{-
468 QMessageLogger(__FILE__, 513, __PRETTY_FUNCTION__).critical("hb_qt_get_glyph_v_kerning: vertical writing isn't supported!");-
469 return
never executed: return 0;
0;
never executed: return 0;
0
470}-
471-
472static hb_bool_t-
473_hb_qt_font_get_glyph_extents(hb_font_t * , void *font_data,-
474 hb_codepoint_t glyph,-
475 hb_glyph_extents_t *extents,-
476 void * )-
477{-
478 QFontEngine *fe = static_cast<QFontEngine *>(font_data);-
479 ((!(fe)) ? qt_assert("fe",__FILE__,524) : qt_noop());-
480-
481 glyph_metrics_t gm = fe->boundingBox(glyph);-
482-
483 extents->x_bearing = gm.x.value();-
484 extents->y_bearing = gm.y.value();-
485 extents->width = gm.width.value();-
486 extents->height = gm.height.value();-
487-
488 return
never executed: return true;
true;
never executed: return true;
0
489}-
490-
491static hb_bool_t-
492_hb_qt_font_get_glyph_contour_point(hb_font_t * , void *font_data,-
493 hb_codepoint_t glyph,-
494 unsigned int point_index, hb_position_t *x, hb_position_t *y,-
495 void * )-
496{-
497 QFontEngine *fe = static_cast<QFontEngine *>(font_data);-
498 ((!(fe)) ? qt_assert("fe",__FILE__,543) : qt_noop());-
499-
500 QFixed xpos, ypos;-
501 quint32 numPoints = 1;-
502 if (__builtin_expect(!!(fe->getPointInOutline(glyph, 0, point_index, &xpos, &ypos, &numPoints) == 0), true)
__builtin_expe...) == 0), true)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
503 *x = xpos.value();-
504 *y = ypos.value();-
505 return
never executed: return true;
true;
never executed: return true;
0
506 }-
507-
508 *x = *y = 0;-
509 return
never executed: return false;
false;
never executed: return false;
0
510}-
511-
512static hb_bool_t-
513_hb_qt_font_get_glyph_name(hb_font_t * , void * ,-
514 hb_codepoint_t ,-
515 char *name, unsigned int size,-
516 void * )-
517{-
518 QMessageLogger(__FILE__, 563, __PRETTY_FUNCTION__).critical("hb_qt_font_get_glyph_name: not implemented!");-
519 if (size
sizeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
520 *
never executed: *name = '\0';
name = '\0';
never executed: *name = '\0';
0
521 return
never executed: return false;
false;
never executed: return false;
0
522}-
523-
524static hb_bool_t-
525_hb_qt_font_get_glyph_from_name(hb_font_t * , void * ,-
526 const char * , int ,-
527 hb_codepoint_t *glyph,-
528 void * )-
529{-
530 QMessageLogger(__FILE__, 575, __PRETTY_FUNCTION__).critical("hb_qt_font_get_glyph_from_name: not implemented!");-
531 *glyph = 0;-
532 return
never executed: return false;
false;
never executed: return false;
0
533}-
534-
535-
536static hb_user_data_key_t _useDesignMetricsKey;-
537-
538void hb_qt_font_set_use_design_metrics(hb_font_t *font, uint value)-
539{-
540 hb_font_set_user_data(font, &_useDesignMetricsKey, (void *)quintptr(value), __null, true);-
541}
never executed: end of block
0
542-
543uint hb_qt_font_get_use_design_metrics(hb_font_t *font)-
544{-
545 return
never executed: return quintptr(hb_font_get_user_data(font, &_useDesignMetricsKey));
quintptr(hb_font_get_user_data(font, &_useDesignMetricsKey));
never executed: return quintptr(hb_font_get_user_data(font, &_useDesignMetricsKey));
0
546}-
547-
548-
549struct _hb_qt_font_funcs_t {-
550 _hb_qt_font_funcs_t()-
551 {-
552 funcs = hb_font_funcs_create();-
553 hb_font_funcs_set_glyph_func(funcs, _hb_qt_font_get_glyph, __null, __null);-
554 hb_font_funcs_set_glyph_h_advance_func(funcs, _hb_qt_font_get_glyph_h_advance, __null, __null);-
555 hb_font_funcs_set_glyph_v_advance_func(funcs, _hb_qt_font_get_glyph_v_advance, __null, __null);-
556 hb_font_funcs_set_glyph_h_origin_func(funcs, _hb_qt_font_get_glyph_h_origin, __null, __null);-
557 hb_font_funcs_set_glyph_v_origin_func(funcs, _hb_qt_font_get_glyph_v_origin, __null, __null);-
558 hb_font_funcs_set_glyph_h_kerning_func(funcs, _hb_qt_font_get_glyph_h_kerning, __null, __null);-
559 hb_font_funcs_set_glyph_v_kerning_func(funcs, _hb_qt_font_get_glyph_v_kerning, __null, __null);-
560 hb_font_funcs_set_glyph_extents_func(funcs, _hb_qt_font_get_glyph_extents, __null, __null);-
561 hb_font_funcs_set_glyph_contour_point_func(funcs, _hb_qt_font_get_glyph_contour_point, __null, __null);-
562 hb_font_funcs_set_glyph_name_func(funcs, _hb_qt_font_get_glyph_name, __null, __null);-
563 hb_font_funcs_set_glyph_from_name_func(funcs, _hb_qt_font_get_glyph_from_name, __null, __null);-
564 }
never executed: end of block
0
565 ~_hb_qt_font_funcs_t()-
566 {-
567 hb_font_funcs_destroy(funcs);-
568 }
never executed: end of block
0
569-
570 hb_font_funcs_t *funcs;-
571};-
572-
573namespace { namespace Q_QGS_qt_ffuncs { typedef _hb_qt_font_funcs_t Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
never executed: guard.store(QtGlobalStatic::Destroyed);
}
never executed: end of block
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
never executed: return &holder.value;
&holder.value;
never executed: return &holder.value;
} } } static QGlobalStatic<_hb_qt_font_funcs_t, Q_QGS_qt_ffuncs::innerFunction, Q_QGS_qt_ffuncs::guard> qt_ffuncs;
0
574-
575hb_font_funcs_t *hb_qt_get_font_funcs()-
576{-
577 return
never executed: return qt_ffuncs()->funcs;
qt_ffuncs()->funcs;
never executed: return qt_ffuncs()->funcs;
0
578}-
579-
580-
581static hb_blob_t *-
582_hb_qt_reference_table(hb_face_t * , hb_tag_t tag, void *user_data)-
583{-
584 QFontEngine::FaceData *data = static_cast<QFontEngine::FaceData *>(user_data);-
585 ((!(data)) ? qt_assert("data",__FILE__,630) : qt_noop());-
586-
587 qt_get_font_table_func_t get_font_table = data->get_font_table;-
588 ((!(get_font_table)) ? qt_assert("get_font_table",__FILE__,633) : qt_noop());-
589-
590 uint length = 0;-
591 if (__builtin_expect(!!(!get_font_table(data->user_data, tag, 0, &length)), false)
__builtin_expe...ngth)), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
592 return
never executed: return hb_blob_get_empty();
hb_blob_get_empty();
never executed: return hb_blob_get_empty();
0
593-
594 char *buffer = static_cast<char *>(malloc(length));-
595 do {if(!(buffer)
!(buffer)Description
TRUEnever evaluated
FALSEnever evaluated
)qt_check_pointer(__FILE__,640);
never executed: qt_check_pointer(__FILE__,640);
} while (0);
0
596-
597 if (__builtin_expect(!!(!get_font_table(data->user_data, tag, reinterpret_cast<uchar *>(buffer), &length)), false)
__builtin_expe...ngth)), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
598 length = 0;
never executed: length = 0;
0
599-
600 return
never executed: return hb_blob_create(const_cast<const char *>(buffer), length, HB_MEMORY_MODE_READONLY, buffer, free);
hb_blob_create(const_cast<const char *>(buffer), length,
never executed: return hb_blob_create(const_cast<const char *>(buffer), length, HB_MEMORY_MODE_READONLY, buffer, free);
0
601 HB_MEMORY_MODE_READONLY,
never executed: return hb_blob_create(const_cast<const char *>(buffer), length, HB_MEMORY_MODE_READONLY, buffer, free);
0
602 buffer, free);
never executed: return hb_blob_create(const_cast<const char *>(buffer), length, HB_MEMORY_MODE_READONLY, buffer, free);
0
603}-
604-
605static inline hb_face_t *-
606_hb_qt_face_create(QFontEngine *fe)-
607{-
608 QFontEngine::FaceData *data = static_cast<QFontEngine::FaceData *>(malloc(sizeof(QFontEngine::FaceData)));-
609 do {if(!(data)
!(data)Description
TRUEnever evaluated
FALSEnever evaluated
)qt_check_pointer(__FILE__,654);
never executed: qt_check_pointer(__FILE__,654);
} while (0);
0
610 data->user_data = fe->faceData.user_data;-
611 data->get_font_table = fe->faceData.get_font_table;-
612-
613 hb_face_t *face = hb_face_create_for_tables(_hb_qt_reference_table, (void *)data, free);-
614 if (__builtin_expect(!!(hb_face_is_immutable(face)), false)
__builtin_expe...face)), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
615 hb_face_destroy(face);-
616 return
never executed: return __null;
__null;
never executed: return __null;
0
617 }-
618-
619 hb_face_set_index(face, fe->faceId().index);-
620 hb_face_set_upem(face, fe->emSquareSize().truncate());-
621-
622 return
never executed: return face;
face;
never executed: return face;
0
623}-
624-
625static void-
626_hb_qt_face_release(void *user_data)-
627{-
628 if (__builtin_expect(!!(user_data), true)
__builtin_expe...r_data), true)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
629 hb_face_destroy(static_cast<hb_face_t *>(user_data));
never executed: hb_face_destroy(static_cast<hb_face_t *>(user_data));
0
630}
never executed: end of block
0
631-
632hb_face_t *hb_qt_face_get_for_engine(QFontEngine *fe)-
633{-
634 ((!(fe && fe->type() != QFontEngine::Multi)) ? qt_assert("fe && fe->type() != QFontEngine::Multi",__FILE__,679) : qt_noop());-
635-
636 if (__builtin_expect(!!(!fe->face_), false)
__builtin_expe...face_), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
637 fe->face_ = QFontEngine::Holder(_hb_qt_face_create(fe), _hb_qt_face_release);
never executed: fe->face_ = QFontEngine::Holder(_hb_qt_face_create(fe), _hb_qt_face_release);
0
638-
639 return
never executed: return static_cast<hb_face_t *>(fe->face_.get());
static_cast<hb_face_t *>(fe->face_.get());
never executed: return static_cast<hb_face_t *>(fe->face_.get());
0
640}-
641-
642-
643static inline hb_font_t *-
644_hb_qt_font_create(QFontEngine *fe)-
645{-
646 hb_face_t *face = hb_qt_face_get_for_engine(fe);-
647 if (__builtin_expect(!!(!face), false)
__builtin_expe...!face), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
648 return
never executed: return __null;
__null;
never executed: return __null;
0
649-
650 hb_font_t *font = hb_font_create(face);-
651-
652 if (__builtin_expect(!!(hb_font_is_immutable(font)), false)
__builtin_expe...font)), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
653 hb_font_destroy(font);-
654 return
never executed: return __null;
__null;
never executed: return __null;
0
655 }-
656-
657 const int y_ppem = fe->fontDef.pixelSize;-
658 const int x_ppem = (fe->fontDef.pixelSize * fe->fontDef.stretch) / 100;-
659-
660 hb_font_set_funcs(font, hb_qt_get_font_funcs(), (void *)fe, __null);-
661-
662-
663-
664 hb_font_set_scale(font, QFixed(x_ppem).value(), -QFixed(y_ppem).value());-
665-
666 hb_font_set_ppem(font, x_ppem, y_ppem);-
667-
668 return
never executed: return font;
font;
never executed: return font;
0
669}-
670-
671static void-
672_hb_qt_font_release(void *user_data)-
673{-
674 if (__builtin_expect(!!(user_data), true)
__builtin_expe...r_data), true)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
675 hb_font_destroy(static_cast<hb_font_t *>(user_data));
never executed: hb_font_destroy(static_cast<hb_font_t *>(user_data));
0
676}
never executed: end of block
0
677-
678hb_font_t *hb_qt_font_get_for_engine(QFontEngine *fe)-
679{-
680 ((!(fe && fe->type() != QFontEngine::Multi)) ? qt_assert("fe && fe->type() != QFontEngine::Multi",__FILE__,725) : qt_noop());-
681-
682 if (__builtin_expect(!!(!fe->font_), false)
__builtin_expe...font_), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
683 fe->font_ = QFontEngine::Holder(_hb_qt_font_create(fe), _hb_qt_font_release);
never executed: fe->font_ = QFontEngine::Holder(_hb_qt_font_create(fe), _hb_qt_font_release);
0
684-
685 return
never executed: return static_cast<hb_font_t *>(fe->font_.get());
static_cast<hb_font_t *>(fe->font_.get());
never executed: return static_cast<hb_font_t *>(fe->font_.get());
0
686}-
687-
688-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9