qfontdatabase.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/text/qfontdatabase.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8bool qt_enable_test_font = false;-
9-
10__attribute__((visibility("default"))) void qt_setQtEnableTestFont(bool value)-
11{-
12 qt_enable_test_font = value;-
13}
never executed: end of block
0
14-
15-
16static int getFontWeight(const QString &weightString)-
17{-
18 QString s = weightString.toLower();-
19 if (s == QLatin1String("normal")
s == QLatin1String("normal")Description
TRUEnever evaluated
FALSEnever evaluated
|| s == QLatin1String("regular")
s == QLatin1String("regular")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
20 return
never executed: return QFont::Normal;
QFont::Normal;
never executed: return QFont::Normal;
0
21 if (s == QLatin1String("bold")
s == QLatin1String("bold")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
22 return
never executed: return QFont::Bold;
QFont::Bold;
never executed: return QFont::Bold;
0
23 if (s == QLatin1String("semibold")
s == QLatin1String("semibold")Description
TRUEnever evaluated
FALSEnever evaluated
|| s == QLatin1String("semi bold")
s == QLatin1St...g("semi bold")Description
TRUEnever evaluated
FALSEnever evaluated
0
24 || s == QLatin1String("demibold")
s == QLatin1String("demibold")Description
TRUEnever evaluated
FALSEnever evaluated
|| s == QLatin1String("demi bold")
s == QLatin1St...g("demi bold")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
25 return
never executed: return QFont::DemiBold;
QFont::DemiBold;
never executed: return QFont::DemiBold;
0
26 if (s == QLatin1String("medium")
s == QLatin1String("medium")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
27 return
never executed: return QFont::Medium;
QFont::Medium;
never executed: return QFont::Medium;
0
28 if (s == QLatin1String("black")
s == QLatin1String("black")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
29 return
never executed: return QFont::Black;
QFont::Black;
never executed: return QFont::Black;
0
30 if (s == QLatin1String("light")
s == QLatin1String("light")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
31 return
never executed: return QFont::Light;
QFont::Light;
never executed: return QFont::Light;
0
32 if (s == QLatin1String("thin")
s == QLatin1String("thin")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
33 return
never executed: return QFont::Thin;
QFont::Thin;
never executed: return QFont::Thin;
0
34 const QStringRef s2 = s.midRef(2);-
35 if (s.startsWith(QLatin1String("ex"))
s.startsWith(Q...1String("ex"))Description
TRUEnever evaluated
FALSEnever evaluated
|| s.startsWith(QLatin1String("ul"))
s.startsWith(Q...1String("ul"))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
36 if (s2 == QLatin1String("tralight")
s2 == QLatin1S...ng("tralight")Description
TRUEnever evaluated
FALSEnever evaluated
|| s == QLatin1String("tra light")
s == QLatin1St...g("tra light")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
37 return
never executed: return QFont::ExtraLight;
QFont::ExtraLight;
never executed: return QFont::ExtraLight;
0
38 if (s2 == QLatin1String("trabold")
s2 == QLatin1String("trabold")Description
TRUEnever evaluated
FALSEnever evaluated
|| s2 == QLatin1String("tra bold")
s2 == QLatin1S...ng("tra bold")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
39 return
never executed: return QFont::ExtraBold;
QFont::ExtraBold;
never executed: return QFont::ExtraBold;
0
40 }
never executed: end of block
0
41-
42-
43-
44 if (s.contains(QLatin1String("bold"))
s.contains(QLa...tring("bold"))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
45 if (s.contains(QLatin1String("demi"))
s.contains(QLa...tring("demi"))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
46 return
never executed: return QFont::DemiBold;
QFont::DemiBold;
never executed: return QFont::DemiBold;
0
47 return
never executed: return QFont::Bold;
QFont::Bold;
never executed: return QFont::Bold;
0
48 }-
49 if (s.contains(QLatin1String("thin"))
s.contains(QLa...tring("thin"))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
50 return
never executed: return QFont::Thin;
QFont::Thin;
never executed: return QFont::Thin;
0
51 if (s.contains(QLatin1String("light"))
s.contains(QLa...ring("light"))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
52 return
never executed: return QFont::Light;
QFont::Light;
never executed: return QFont::Light;
0
53 if (s.contains(QLatin1String("black"))
s.contains(QLa...ring("black"))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
54 return
never executed: return QFont::Black;
QFont::Black;
never executed: return QFont::Black;
0
55-
56-
57-
58-
59-
60 if (s.compare(QCoreApplication::translate("QFontDatabase", "Normal", "The Normal or Regular font weight"), Qt::CaseInsensitive) == 0
s.compare(QCor...ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
61 return
never executed: return QFont::Normal;
QFont::Normal;
never executed: return QFont::Normal;
0
62 const QString translatedBold = QCoreApplication::translate("QFontDatabase", "Bold").toLower();-
63 if (s == translatedBold
s == translatedBoldDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
64 return
never executed: return QFont::Bold;
QFont::Bold;
never executed: return QFont::Bold;
0
65 if (s.compare(QCoreApplication::translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0
s.compare(QCor...ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
66 return
never executed: return QFont::DemiBold;
QFont::DemiBold;
never executed: return QFont::DemiBold;
0
67 if (s.compare(QCoreApplication::translate("QFontDatabase", "Medium", "The Medium font weight"), Qt::CaseInsensitive) == 0
s.compare(QCor...ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
68 return
never executed: return QFont::Medium;
QFont::Medium;
never executed: return QFont::Medium;
0
69 if (s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0
s.compare(QCor...ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
70 return
never executed: return QFont::Black;
QFont::Black;
never executed: return QFont::Black;
0
71 const QString translatedLight = QCoreApplication::translate("QFontDatabase", "Light").toLower();-
72 if (s == translatedLight
s == translatedLightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
73 return
never executed: return QFont::Light;
QFont::Light;
never executed: return QFont::Light;
0
74 if (s.compare(QCoreApplication::translate("QFontDatabase", "Thin"), Qt::CaseInsensitive) == 0
s.compare(QCor...ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
75 return
never executed: return QFont::Thin;
QFont::Thin;
never executed: return QFont::Thin;
0
76 if (s.compare(QCoreApplication::translate("QFontDatabase", "Extra Light"), Qt::CaseInsensitive) == 0
s.compare(QCor...ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
77 return
never executed: return QFont::ExtraLight;
QFont::ExtraLight;
never executed: return QFont::ExtraLight;
0
78 if (s.compare(QCoreApplication::translate("QFontDatabase", "Extra Bold"), Qt::CaseInsensitive) == 0
s.compare(QCor...ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
79 return
never executed: return QFont::ExtraBold;
QFont::ExtraBold;
never executed: return QFont::ExtraBold;
0
80-
81-
82-
83 const QString translatedExtra = QCoreApplication::translate("QFontDatabase", "Extra").toLower();-
84 if (s.contains(translatedBold)
s.contains(translatedBold)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
85-
86 QString translatedDemi = QCoreApplication::translate("QFontDatabase", "Demi").toLower();-
87 if (s .contains(translatedDemi)
s .contains(translatedDemi)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
88 return
never executed: return QFont::DemiBold;
QFont::DemiBold;
never executed: return QFont::DemiBold;
0
89 if (s.contains(translatedExtra)
s.contains(translatedExtra)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
90 return
never executed: return QFont::ExtraBold;
QFont::ExtraBold;
never executed: return QFont::ExtraBold;
0
91 return
never executed: return QFont::Bold;
QFont::Bold;
never executed: return QFont::Bold;
0
92 }-
93-
94 if (s.contains(translatedLight)
s.contains(translatedLight)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
95 if (s.contains(translatedExtra)
s.contains(translatedExtra)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
96 return
never executed: return QFont::ExtraLight;
QFont::ExtraLight;
never executed: return QFont::ExtraLight;
0
97 return
never executed: return QFont::Light;
QFont::Light;
never executed: return QFont::Light;
0
98 }-
99 return
never executed: return QFont::Normal;
QFont::Normal;
never executed: return QFont::Normal;
0
100}-
101-
102-
103struct QtFontSize-
104{-
105-
106 void *handle;-
107-
108 unsigned short pixelSize : 16;-
109};-
110-
111-
112-
113struct QtFontStyle-
114{-
115 struct Key {-
116 Key(const QString &styleString);-
117 Key() : style(QFont::StyleNormal),-
118 weight(QFont::Normal), stretch(0) { }
never executed: end of block
0
119 Key(const Key &o) : style(o.style), weight(o.weight), stretch(o.stretch) { }
never executed: end of block
0
120 uint style : 2;-
121 signed int weight : 8;-
122 signed int stretch : 12;-
123-
124 bool operator==(const Key & other) {-
125 return
never executed: return (style == other.style && weight == other.weight && (stretch == 0 || other.stretch == 0 || stretch == other.stretch));
(style == other.style && weight == other.weight &&
never executed: return (style == other.style && weight == other.weight && (stretch == 0 || other.stretch == 0 || stretch == other.stretch));
0
126 (stretch == 0 || other.stretch == 0 || stretch == other.stretch));
never executed: return (style == other.style && weight == other.weight && (stretch == 0 || other.stretch == 0 || stretch == other.stretch));
0
127 }-
128 bool operator!=(const Key &other) {-
129 return
never executed: return !operator==(other);
!operator==(other);
never executed: return !operator==(other);
0
130 }-
131 bool operator <(const Key &o) {-
132 int x = (style << 12) + (weight << 14) + stretch;-
133 int y = (o.style << 12) + (o.weight << 14) + o.stretch;-
134 return
never executed: return (x < y);
(x < y);
never executed: return (x < y);
0
135 }-
136 };-
137-
138 QtFontStyle(const Key &k)-
139 : key(k), bitmapScalable(false), smoothScalable(false),-
140 count(0), pixelSizes(0)-
141 {-
142 }
never executed: end of block
0
143-
144 ~QtFontStyle() {-
145 while (count
countDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
146-
147 count--;-
148 QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();-
149 if (integration
integrationDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
150 integration->fontDatabase()->releaseHandle(pixelSizes[count].handle);-
151 }
never executed: end of block
0
152 }
never executed: end of block
0
153 free(pixelSizes);-
154 }
never executed: end of block
0
155-
156 Key key;-
157 bool bitmapScalable : 1;-
158 bool smoothScalable : 1;-
159 signed int count : 30;-
160 QtFontSize *pixelSizes;-
161 QString styleName;-
162-
163 bool antialiased;-
164-
165 QtFontSize *pixelSize(unsigned short size, bool = false);-
166};-
167-
168QtFontStyle::Key::Key(const QString &styleString)-
169 : style(QFont::StyleNormal), weight(QFont::Normal), stretch(0)-
170{-
171 weight = getFontWeight(styleString);-
172-
173 if (!styleString.isEmpty()
!styleString.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
174-
175 if (styleString.contains(QLatin1String("Italic"))
styleString.co...ing("Italic"))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
176 style = QFont::StyleItalic;
never executed: style = QFont::StyleItalic;
0
177 else if (styleString.contains(QLatin1String("Oblique"))
styleString.co...ng("Oblique"))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
178 style = QFont::StyleOblique;
never executed: style = QFont::StyleOblique;
0
179-
180-
181 else if (styleString.contains(QCoreApplication::translate("QFontDatabase", "Italic"))
styleString.co...e", "Italic"))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
182 style = QFont::StyleItalic;
never executed: style = QFont::StyleItalic;
0
183 else if (styleString.contains(QCoreApplication::translate("QFontDatabase", "Oblique"))
styleString.co...", "Oblique"))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
184 style = QFont::StyleOblique;
never executed: style = QFont::StyleOblique;
0
185 }
never executed: end of block
0
186}
never executed: end of block
0
187-
188QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add)-
189{-
190 for (int i = 0; i < count
i < countDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
191 if (pixelSizes[i].pixelSize == size
pixelSizes[i]....elSize == sizeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
192 return
never executed: return pixelSizes + i;
pixelSizes + i;
never executed: return pixelSizes + i;
0
193 }
never executed: end of block
0
194 if (!add
!addDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
195 return
never executed: return 0;
0;
never executed: return 0;
0
196-
197 if (!pixelSizes
!pixelSizesDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
198-
199 QtFontSize *newPixelSizes = (QtFontSize *)malloc(sizeof(QtFontSize));-
200 do {if(!(newPixelSizes)
!(newPixelSizes)Description
TRUEnever evaluated
FALSEnever evaluated
)qt_check_pointer(__FILE__,284);
never executed: qt_check_pointer(__FILE__,284);
} while (0);
0
201 pixelSizes = newPixelSizes;-
202 }
never executed: end of block
else if (!(count % 8)
!(count % 8)Description
TRUEnever evaluated
FALSEnever evaluated
|| count == 1
count == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
203 QtFontSize *newPixelSizes = (QtFontSize *)-
204 realloc(pixelSizes,-
205 (((count+8) >> 3) << 3) * sizeof(QtFontSize));-
206 do {if(!(newPixelSizes)
!(newPixelSizes)Description
TRUEnever evaluated
FALSEnever evaluated
)qt_check_pointer(__FILE__,290);
never executed: qt_check_pointer(__FILE__,290);
} while (0);
0
207 pixelSizes = newPixelSizes;-
208 }
never executed: end of block
0
209 pixelSizes[count].pixelSize = size;-
210 pixelSizes[count].handle = 0;-
211 return
never executed: return pixelSizes + (count++);
pixelSizes + (count++);
never executed: return pixelSizes + (count++);
0
212}-
213-
214struct QtFontFoundry-
215{-
216 QtFontFoundry(const QString &n) : name(n), count(0), styles(0) {}
never executed: end of block
0
217 ~QtFontFoundry() {-
218 while (count--
count--Description
TRUEnever evaluated
FALSEnever evaluated
)
0
219 delete styles[count];
never executed: delete styles[count];
0
220 free(styles);-
221 }
never executed: end of block
0
222-
223 QString name;-
224-
225 int count;-
226 QtFontStyle **styles;-
227 QtFontStyle *style(const QtFontStyle::Key &, const QString & = QString(), bool = false);-
228};-
229-
230QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, const QString &styleName, bool create)-
231{-
232 int pos = 0;-
233 for (; pos < count
pos < countDescription
TRUEnever evaluated
FALSEnever evaluated
; pos++) {
0
234 bool hasStyleName = !styleName.isEmpty();-
235 if (hasStyleName
hasStyleNameDescription
TRUEnever evaluated
FALSEnever evaluated
&& !styles[pos]->styleName.isEmpty()
!styles[pos]->...Name.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
236 if (styles[pos]->styleName == styleName
styles[pos]->s...e == styleNameDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
237 return
never executed: return styles[pos];
styles[pos];
never executed: return styles[pos];
0
238 }
never executed: end of block
else {
0
239 if (styles[pos]->key == key
styles[pos]->key == keyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
240 return
never executed: return styles[pos];
styles[pos];
never executed: return styles[pos];
0
241 }
never executed: end of block
0
242 }-
243 if (!create
!createDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
244 return
never executed: return 0;
0;
never executed: return 0;
0
245-
246-
247 if (!(count % 8)
!(count % 8)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
248 QtFontStyle **newStyles = (QtFontStyle **)-
249 realloc(styles, (((count+8) >> 3) << 3) * sizeof(QtFontStyle *));-
250 do {if(!(newStyles)
!(newStyles)Description
TRUEnever evaluated
FALSEnever evaluated
)qt_check_pointer(__FILE__,334);
never executed: qt_check_pointer(__FILE__,334);
} while (0);
0
251 styles = newStyles;-
252 }
never executed: end of block
0
253-
254 QtFontStyle *style = new QtFontStyle(key);-
255 style->styleName = styleName;-
256 styles[pos] = style;-
257 count++;-
258 return
never executed: return styles[pos];
styles[pos];
never executed: return styles[pos];
0
259}-
260-
261-
262struct QtFontFamily-
263{-
264 enum WritingSystemStatus {-
265 Unknown = 0,-
266 Supported = 1,-
267 UnsupportedFT = 2,-
268 Unsupported = UnsupportedFT-
269 };-
270-
271 QtFontFamily(const QString &n)-
272 :-
273 populated(false),-
274 fixedPitch(false),-
275 name(n), count(0), foundries(0)-
276 {-
277 memset(writingSystems, 0, sizeof(writingSystems));-
278 }
never executed: end of block
0
279 ~QtFontFamily() {-
280 while (count--
count--Description
TRUEnever evaluated
FALSEnever evaluated
)
0
281 delete foundries[count];
never executed: delete foundries[count];
0
282 free(foundries);-
283 }
never executed: end of block
0
284-
285 bool populated : 1;-
286 bool fixedPitch : 1;-
287-
288 QString name;-
289 QStringList aliases;-
290 int count;-
291 QtFontFoundry **foundries;-
292-
293 unsigned char writingSystems[QFontDatabase::WritingSystemsCount];-
294-
295 bool matchesFamilyName(const QString &familyName) const;-
296 QtFontFoundry *foundry(const QString &f, bool = false);-
297-
298 void ensurePopulated();-
299};-
300-
301QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create)-
302{-
303 if (f.isNull()
f.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
&& count == 1
count == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
304 return
never executed: return foundries[0];
foundries[0];
never executed: return foundries[0];
0
305-
306 for (int i = 0; i < count
i < countDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
307 if (foundries[i]->name.compare(f, Qt::CaseInsensitive) == 0
foundries[i]->...ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
308 return
never executed: return foundries[i];
foundries[i];
never executed: return foundries[i];
0
309 }
never executed: end of block
0
310 if (!create
!createDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
311 return
never executed: return 0;
0;
never executed: return 0;
0
312-
313 if (!(count % 8)
!(count % 8)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
314 QtFontFoundry **newFoundries = (QtFontFoundry **)-
315 realloc(foundries,-
316 (((count+8) >> 3) << 3) * sizeof(QtFontFoundry *));-
317 do {if(!(newFoundries)
!(newFoundries)Description
TRUEnever evaluated
FALSEnever evaluated
)qt_check_pointer(__FILE__,401);
never executed: qt_check_pointer(__FILE__,401);
} while (0);
0
318 foundries = newFoundries;-
319 }
never executed: end of block
0
320-
321 foundries[count] = new QtFontFoundry(f);-
322 return
never executed: return foundries[count++];
foundries[count++];
never executed: return foundries[count++];
0
323}-
324-
325bool QtFontFamily::matchesFamilyName(const QString &familyName) const-
326{-
327 return
never executed: return name.compare(familyName, Qt::CaseInsensitive) == 0 || aliases.contains(familyName, Qt::CaseInsensitive);
name.compare(familyName, Qt::CaseInsensitive) == 0 || aliases.contains(familyName, Qt::CaseInsensitive);
never executed: return name.compare(familyName, Qt::CaseInsensitive) == 0 || aliases.contains(familyName, Qt::CaseInsensitive);
0
328}-
329-
330void QtFontFamily::ensurePopulated()-
331{-
332 if (populated
populatedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
333 return;
never executed: return;
0
334-
335 QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFamily(name);-
336 ((!(populated)) ? qt_assert_x(__PRETTY_FUNCTION__, QString(name).toLocal8Bit().constData(),__FILE__,420) : qt_noop());-
337}
never executed: end of block
0
338-
339-
340struct FallbacksCacheKey {-
341 QString family;-
342 QFont::Style style;-
343 QFont::StyleHint styleHint;-
344 QChar::Script script;-
345};-
346-
347inline bool operator==(const FallbacksCacheKey &lhs, const FallbacksCacheKey &rhs) noexcept-
348{-
349 return
never executed: return lhs.script == rhs.script && lhs.styleHint == rhs.styleHint && lhs.style == rhs.style && lhs.family == rhs.family;
lhs.script == rhs.script &&
never executed: return lhs.script == rhs.script && lhs.styleHint == rhs.styleHint && lhs.style == rhs.style && lhs.family == rhs.family;
0
350 lhs.styleHint == rhs.styleHint &&
never executed: return lhs.script == rhs.script && lhs.styleHint == rhs.styleHint && lhs.style == rhs.style && lhs.family == rhs.family;
0
351 lhs.style == rhs.style &&
never executed: return lhs.script == rhs.script && lhs.styleHint == rhs.styleHint && lhs.style == rhs.style && lhs.family == rhs.family;
0
352 lhs.family == rhs.family;
never executed: return lhs.script == rhs.script && lhs.styleHint == rhs.styleHint && lhs.style == rhs.style && lhs.family == rhs.family;
0
353}-
354-
355inline bool operator!=(const FallbacksCacheKey &lhs, const FallbacksCacheKey &rhs) noexcept-
356{-
357 return
never executed: return !operator==(lhs, rhs);
!operator==(lhs, rhs);
never executed: return !operator==(lhs, rhs);
0
358}-
359-
360inline uint qHash(const FallbacksCacheKey &key, uint seed = 0) noexcept-
361{-
362 QtPrivate::QHashCombine hash;-
363 seed = hash(seed, key.family);-
364 seed = hash(seed, int(key.style));-
365 seed = hash(seed, int(key.styleHint));-
366 seed = hash(seed, int(key.script));-
367 return
never executed: return seed;
seed;
never executed: return seed;
0
368}-
369-
370-
371class QFontDatabasePrivate-
372{-
373public:-
374 QFontDatabasePrivate()-
375 : count(0), families(0),-
376 fallbacksCache(64),-
377 reregisterAppFonts(false)-
378 { }
never executed: end of block
0
379-
380 ~QFontDatabasePrivate() {-
381 free();-
382 }
never executed: end of block
0
383-
384 enum FamilyRequestFlags {-
385 RequestFamily = 0,-
386 EnsureCreated,-
387 EnsurePopulated-
388 };-
389-
390 QtFontFamily *family(const QString &f, FamilyRequestFlags flags = EnsurePopulated);-
391 void free() {-
392 while (count--
count--Description
TRUEnever evaluated
FALSEnever evaluated
)
0
393 delete families[count];
never executed: delete families[count];
0
394 ::free(families);-
395 families = 0;-
396 count = 0;-
397-
398 }
never executed: end of block
0
399-
400 int count;-
401 QtFontFamily **families;-
402-
403 QCache<FallbacksCacheKey, QStringList> fallbacksCache;-
404-
405-
406 struct ApplicationFont {-
407 QString fileName;-
408 QByteArray data;-
409 QStringList families;-
410 };-
411 QVector<ApplicationFont> applicationFonts;-
412 int addAppFont(const QByteArray &fontData, const QString &fileName);-
413 bool reregisterAppFonts;-
414 bool isApplicationFont(const QString &fileName);-
415-
416 void invalidate();-
417};-
418template<> class QTypeInfo<QFontDatabasePrivate::ApplicationFont > { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isRelocatable = !isStatic || ((Q_MOVABLE_TYPE) & Q_RELOCATABLE_TYPE), isLarge = (sizeof(QFontDatabasePrivate::ApplicationFont)>sizeof(void*)), isPointer = false, isIntegral = QtPrivate::is_integral< QFontDatabasePrivate::ApplicationFont >::value, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QFontDatabasePrivate::ApplicationFont) }; static inline const char *name() { return "QFontDatabasePrivate::ApplicationFont"; } };-
419-
420void QFontDatabasePrivate::invalidate()-
421{-
422 QFontCache::instance()->clear();-
423-
424 fallbacksCache.clear();-
425 free();-
426 QGuiApplicationPrivate::platformIntegration()->fontDatabase()->invalidate();-
427 static_cast<QGuiApplication *>(QCoreApplication::instance())->fontDatabaseChanged();-
428}
never executed: end of block
0
429-
430QtFontFamily *QFontDatabasePrivate::family(const QString &f, FamilyRequestFlags flags)-
431{-
432 QtFontFamily *fam = 0;-
433-
434 int low = 0;-
435 int high = count;-
436 int pos = count / 2;-
437 int res = 1;-
438 if (count
countDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
439 while ((
(res = familie...eInsensitive))Description
TRUEnever evaluated
FALSEnever evaluated
res = families[pos]->name.compare(f, Qt::CaseInsensitive))
(res = familie...eInsensitive))Description
TRUEnever evaluated
FALSEnever evaluated
&& pos != low
pos != lowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
440 if (res > 0
res > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
441 high = pos;
never executed: high = pos;
0
442 else-
443 low = pos;
never executed: low = pos;
0
444 pos = (high + low) / 2;-
445 }
never executed: end of block
0
446 if (!res
!resDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
447 fam = families[pos];
never executed: fam = families[pos];
0
448 }
never executed: end of block
0
449-
450 if (!fam
!famDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(flags & EnsureCreated)Description
TRUEnever evaluated
FALSEnever evaluated
flags & EnsureCreated)
(flags & EnsureCreated)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
451 if (res < 0
res < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
452 pos++;
never executed: pos++;
0
453-
454-
455 if (!(count % 8)
!(count % 8)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
456 QtFontFamily **newFamilies = (QtFontFamily **)-
457 realloc(families,-
458 (((count+8) >> 3) << 3) * sizeof(QtFontFamily *));-
459 do {if(!(newFamilies)
!(newFamilies)Description
TRUEnever evaluated
FALSEnever evaluated
)qt_check_pointer(__FILE__,543);
never executed: qt_check_pointer(__FILE__,543);
} while (0);
0
460 families = newFamilies;-
461 }
never executed: end of block
0
462-
463 QtFontFamily *family = new QtFontFamily(f);-
464 memmove(families + pos + 1, families + pos, (count-pos)*sizeof(QtFontFamily *));-
465 families[pos] = family;-
466 count++;-
467-
468 fam = families[pos];-
469 }
never executed: end of block
0
470-
471 if (fam
famDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(flags & EnsurePopulated)Description
TRUEnever evaluated
FALSEnever evaluated
flags & EnsurePopulated)
(flags & EnsurePopulated)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
472 fam->ensurePopulated();
never executed: fam->ensurePopulated();
0
473-
474 return
never executed: return fam;
fam;
never executed: return fam;
0
475}-
476-
477-
478-
479static const int scriptForWritingSystem[] = {-
480 QChar::Script_Common,-
481 QChar::Script_Latin,-
482 QChar::Script_Greek,-
483 QChar::Script_Cyrillic,-
484 QChar::Script_Armenian,-
485 QChar::Script_Hebrew,-
486 QChar::Script_Arabic,-
487 QChar::Script_Syriac,-
488 QChar::Script_Thaana,-
489 QChar::Script_Devanagari,-
490 QChar::Script_Bengali,-
491 QChar::Script_Gurmukhi,-
492 QChar::Script_Gujarati,-
493 QChar::Script_Oriya,-
494 QChar::Script_Tamil,-
495 QChar::Script_Telugu,-
496 QChar::Script_Kannada,-
497 QChar::Script_Malayalam,-
498 QChar::Script_Sinhala,-
499 QChar::Script_Thai,-
500 QChar::Script_Lao,-
501 QChar::Script_Tibetan,-
502 QChar::Script_Myanmar,-
503 QChar::Script_Georgian,-
504 QChar::Script_Khmer,-
505 QChar::Script_Han,-
506 QChar::Script_Han,-
507 QChar::Script_Han,-
508 QChar::Script_Hangul,-
509 QChar::Script_Latin,-
510 QChar::Script_Common,-
511 QChar::Script_Ogham,-
512 QChar::Script_Runic,-
513 QChar::Script_Nko-
514};-
515-
516static_assert(bool(sizeof(scriptForWritingSystem) / sizeof(scriptForWritingSystem[0]) == QFontDatabase::WritingSystemsCount), "sizeof(scriptForWritingSystem) / sizeof(scriptForWritingSystem[0]) == QFontDatabase::WritingSystemsCount");-
517-
518__attribute__((visibility("default"))) int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem)-
519{-
520 return
never executed: return scriptForWritingSystem[writingSystem];
scriptForWritingSystem[writingSystem];
never executed: return scriptForWritingSystem[writingSystem];
0
521}-
522static void parseFontName(const QString &name, QString &foundry, QString &family)-
523{-
524 int i = name.indexOf(QLatin1Char('['));-
525 int li = name.lastIndexOf(QLatin1Char(']'));-
526 if (i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& li >= 0
li >= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& i < li
i < liDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
527 foundry = name.mid(i + 1, li - i - 1);-
528 if (i > 0
i > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& name[i - 1] == QLatin1Char(' ')
name[i - 1] ==...atin1Char(' ')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
529 i--;
never executed: i--;
0
530 family = name.left(i);-
531 }
never executed: end of block
else {
0
532 foundry.clear();-
533 family = name;-
534 }
never executed: end of block
0
535-
536-
537 bool space = true;-
538 QChar *s = family.data();-
539 int len = family.length();-
540 while(len--
len--Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
541 if (space
spaceDescription
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *s = s->toUpper();
s = s->toUpper();
never executed: *s = s->toUpper();
0
542 space = s->isSpace();-
543 ++s;-
544 }
never executed: end of block
0
545-
546 space = true;-
547 s = foundry.data();-
548 len = foundry.length();-
549 while(len--
len--Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
550 if (space
spaceDescription
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *s = s->toUpper();
s = s->toUpper();
never executed: *s = s->toUpper();
0
551 space = s->isSpace();-
552 ++s;-
553 }
never executed: end of block
0
554}
never executed: end of block
0
555-
556-
557struct QtFontDesc-
558{-
559 inline QtFontDesc() : family(0), foundry(0), style(0), size(0) {}
never executed: end of block
0
560 QtFontFamily *family;-
561 QtFontFoundry *foundry;-
562 QtFontStyle *style;-
563 QtFontSize *size;-
564};-
565-
566static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef, bool multi)-
567{-
568 fontDef->family = desc.family->name;-
569 if (! desc.foundry->name.isEmpty()
! desc.foundry->name.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& desc.family->count > 1
desc.family->count > 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
570 fontDef->family += QString::fromLatin1(" [");-
571 fontDef->family += desc.foundry->name;-
572 fontDef->family += QLatin1Char(']');-
573 }
never executed: end of block
0
574-
575 if (desc.style->smoothScalable
desc.style->smoothScalableDescription
TRUEnever evaluated
FALSEnever evaluated
0
576 || QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()
QGuiApplicatio...waysScalable()Description
TRUEnever evaluated
FALSEnever evaluated
0
577 || (desc.style->bitmapScalable
desc.style->bitmapScalableDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(request.style...::PreferMatch)Description
TRUEnever evaluated
FALSEnever evaluated
request.styleStrategy & QFont::PreferMatch)
(request.style...::PreferMatch)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
578 fontDef->pixelSize = request.pixelSize;-
579 }
never executed: end of block
else {
0
580 fontDef->pixelSize = desc.size->pixelSize;-
581 }
never executed: end of block
0
582 fontDef->pointSize = request.pointSize;-
583-
584 fontDef->styleHint = request.styleHint;-
585 fontDef->styleStrategy = request.styleStrategy;-
586-
587 if (!multi
!multiDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
588 fontDef->weight = desc.style->key.weight;
never executed: fontDef->weight = desc.style->key.weight;
0
589 if (!multi
!multiDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
590 fontDef->style = desc.style->key.style;
never executed: fontDef->style = desc.style->key.style;
0
591 fontDef->fixedPitch = desc.family->fixedPitch;-
592 fontDef->stretch = desc.style->key.stretch;-
593 fontDef->ignorePitch = false;-
594}
never executed: end of block
0
595-
596static QStringList familyList(const QFontDef &req)-
597{-
598-
599 QStringList family_list;-
600 if (req.family.isEmpty()
req.family.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
601 return
never executed: return family_list;
family_list;
never executed: return family_list;
0
602-
603 const auto list = req.family.splitRef(QLatin1Char(','));-
604 const int numFamilies = list.size();-
605 family_list.reserve(numFamilies);-
606 for (int i = 0; i < numFamilies
i < numFamiliesDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
607 QStringRef str = list.at(i).trimmed();-
608 if ((str.startsWith(QLatin1Char('"'))
str.startsWith...tin1Char('"'))Description
TRUEnever evaluated
FALSEnever evaluated
&& str.endsWith(QLatin1Char('"'))
str.endsWith(QLatin1Char('"'))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
609 || (str.startsWith(QLatin1Char('\''))
str.startsWith...in1Char('\''))Description
TRUEnever evaluated
FALSEnever evaluated
&& str.endsWith(QLatin1Char('\''))
str.endsWith(Q...in1Char('\''))Description
TRUEnever evaluated
FALSEnever evaluated
))
0
610 str = str.mid(1, str.length() - 2);
never executed: str = str.mid(1, str.length() - 2);
0
611 family_list << str.toString();-
612 }
never executed: end of block
0
613-
614-
615 for (int i = 0, size = family_list.size(); i < size
i < sizeDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
616 family_list += QFont::substitutes(family_list.at(i));
never executed: family_list += QFont::substitutes(family_list.at(i));
0
617-
618 return
never executed: return family_list;
family_list;
never executed: return family_list;
0
619}-
620-
621namespace { namespace Q_QGS_privateDb { typedef QFontDatabasePrivate 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<QFontDatabasePrivate, Q_QGS_privateDb::innerFunction, Q_QGS_privateDb::guard> privateDb;
0
622namespace { namespace Q_QGS_fontDatabaseMutex { typedef QMutex 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 (QMutex::Recursive))) : value (QMutex::Recursive) { guard.store(QtGlobalStatic::Initialized); } } holder; return
never executed: return &holder.value;
&holder.value;
never executed: return &holder.value;
} } } static QGlobalStatic<QMutex, Q_QGS_fontDatabaseMutex::innerFunction, Q_QGS_fontDatabaseMutex::guard> fontDatabaseMutex;
0
623-
624-
625void qt_cleanupFontDatabase()-
626{-
627 QFontDatabasePrivate *db = privateDb();-
628 if (db
dbDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
629 db->fallbacksCache.clear();-
630 db->free();-
631 }
never executed: end of block
0
632}
never executed: end of block
0
633-
634-
635QMutex *qt_fontdatabase_mutex()-
636{-
637 return
never executed: return fontDatabaseMutex();
fontDatabaseMutex();
never executed: return fontDatabaseMutex();
0
638}-
639-
640-
641void qt_registerFont(const QString &familyName, const QString &stylename,-
642 const QString &foundryname, int weight,-
643 QFont::Style style, int stretch, bool antialiased,-
644 bool scalable, int pixelSize, bool fixedPitch,-
645 const QSupportedWritingSystems &writingSystems, void *handle)-
646{-
647 QFontDatabasePrivate *d = privateDb();-
648-
649 QtFontStyle::Key styleKey;-
650 styleKey.style = style;-
651 styleKey.weight = weight;-
652 styleKey.stretch = stretch;-
653 QtFontFamily *f = d->family(familyName, QFontDatabasePrivate::EnsureCreated);-
654 f->fixedPitch = fixedPitch;-
655-
656 for (int i = 0; i < QFontDatabase::WritingSystemsCount
i < QFontDatab...ngSystemsCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
657 if (writingSystems.supported(QFontDatabase::WritingSystem(i))
writingSystems...tingSystem(i))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
658 f->writingSystems[i] = QtFontFamily::Supported;
never executed: f->writingSystems[i] = QtFontFamily::Supported;
0
659 }
never executed: end of block
0
660-
661 QtFontFoundry *foundry = f->foundry(foundryname, true);-
662 QtFontStyle *fontStyle = foundry->style(styleKey, stylename, true);-
663 fontStyle->smoothScalable = scalable;-
664 fontStyle->antialiased = antialiased;-
665 QtFontSize *size = fontStyle->pixelSize(pixelSize ? pixelSize : 0xffff, true);-
666 if (size->handle
size->handleDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
667 QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();-
668 if (integration
integrationDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
669 integration->fontDatabase()->releaseHandle(size->handle);
never executed: integration->fontDatabase()->releaseHandle(size->handle);
0
670 }
never executed: end of block
0
671 size->handle = handle;-
672 f->populated = true;-
673}
never executed: end of block
0
674-
675void qt_registerFontFamily(const QString &familyName)-
676{-
677-
678 privateDb()->family(familyName, QFontDatabasePrivate::EnsureCreated);-
679}
never executed: end of block
0
680-
681void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias)-
682{-
683 if (alias.isEmpty()
alias.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
684 return;
never executed: return;
0
685-
686 QFontDatabasePrivate *d = privateDb();-
687 QtFontFamily *f = d->family(familyName, QFontDatabasePrivate::RequestFamily);-
688 if (!f
!fDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
689 return;
never executed: return;
0
690-
691 if (f->aliases.contains(alias, Qt::CaseInsensitive)
f->aliases.con...seInsensitive)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
692 return;
never executed: return;
0
693-
694 f->aliases.push_back(alias);-
695}
never executed: end of block
0
696-
697QString qt_resolveFontFamilyAlias(const QString &alias)-
698{-
699 if (!alias.isEmpty()
!alias.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
700 const QFontDatabasePrivate *d = privateDb();-
701 for (int i = 0; i < d->count
i < d->countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
702 if (d->families[i]->matchesFamilyName(alias)
d->families[i]...ilyName(alias)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
703 return
never executed: return d->families[i]->name;
d->families[i]->name;
never executed: return d->families[i]->name;
0
704 }
never executed: end of block
0
705 return
never executed: return alias;
alias;
never executed: return alias;
0
706}-
707-
708QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const-
709{-
710 (void)family;;-
711 (void)styleHint;;-
712-
713 QStringList preferredFallbacks;-
714 QStringList otherFallbacks;-
715-
716 size_t writingSystem = std::find(scriptForWritingSystem,-
717 scriptForWritingSystem + QFontDatabase::WritingSystemsCount,-
718 script) - scriptForWritingSystem;-
719 if (writingSystem >= QFontDatabase::WritingSystemsCount
writingSystem ...ngSystemsCountDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
720 writingSystem = QFontDatabase::Any;
never executed: writingSystem = QFontDatabase::Any;
0
721-
722 QFontDatabasePrivate *db = privateDb();-
723 for (int i = 0; i < db->count
i < db->countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
724 QtFontFamily *f = db->families[i];-
725-
726 f->ensurePopulated();-
727-
728 if (writingSystem > QFontDatabase::Any
writingSystem ...tDatabase::AnyDescription
TRUEnever evaluated
FALSEnever evaluated
&& f->writingSystems[writingSystem] != QtFontFamily::Supported
f->writingSyst...ily::SupportedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
729 continue;
never executed: continue;
0
730-
731 for (int j = 0; j < f->count
j < f->countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++j) {
0
732 QtFontFoundry *foundry = f->foundries[j];-
733-
734 for (int k = 0; k < foundry->count
k < foundry->countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++k) {
0
735 QString name = foundry->name.isEmpty()
foundry->name.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
736 ? f->name-
737 : f->name + QLatin1String(" [") + foundry->name + QLatin1Char(']');-
738 if (style == foundry->styles[k]->key.style
style == found...[k]->key.styleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
739 preferredFallbacks.append(name);
never executed: preferredFallbacks.append(name);
0
740 else-
741 otherFallbacks.append(name);
never executed: otherFallbacks.append(name);
0
742 }-
743 }
never executed: end of block
0
744 }
never executed: end of block
0
745-
746 return
never executed: return preferredFallbacks + otherFallbacks;
preferredFallbacks + otherFallbacks;
never executed: return preferredFallbacks + otherFallbacks;
0
747}-
748-
749static void initializeDb();-
750-
751static QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)-
752{-
753 QFontDatabasePrivate *db = privateDb();-
754 if (!db->count
!db->countDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
755 initializeDb();
never executed: initializeDb();
0
756-
757 const FallbacksCacheKey cacheKey = { family, style, styleHint, script };-
758-
759 if (const
const QStringL...ject(cacheKey)Description
TRUEnever evaluated
FALSEnever evaluated
QStringList *fallbacks = db->fallbacksCache.object(cacheKey)
const QStringL...ject(cacheKey)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
760 return
never executed: return *fallbacks;
*fallbacks;
never executed: return *fallbacks;
0
761-
762-
763 QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);-
764-
765 QStringList::iterator i;-
766 for (i = retList.begin(); i != retList.end()
i != retList.end()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
767 bool contains = false;-
768 for (int j = 0; j < db->count
j < db->countDescription
TRUEnever evaluated
FALSEnever evaluated
; j++) {
0
769 if (db->families[j]->matchesFamilyName(*i)
db->families[j...FamilyName(*i)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
770 contains = true;-
771 break;
never executed: break;
0
772 }-
773 }
never executed: end of block
0
774 if (!contains
!containsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
775 i = retList.erase(i);-
776 --i;-
777 }
never executed: end of block
0
778 }
never executed: end of block
0
779-
780 db->fallbacksCache.insert(cacheKey, new QStringList(retList));-
781-
782 return
never executed: return retList;
retList;
never executed: return retList;
0
783}-
784-
785QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)-
786{-
787 QMutexLocker locker(fontDatabaseMutex());-
788 return
never executed: return fallbacksForFamily(family, style, styleHint, script);
fallbacksForFamily(family, style, styleHint, script);
never executed: return fallbacksForFamily(family, style, styleHint, script);
0
789}-
790-
791static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt);-
792-
793static void initializeDb()-
794{-
795 QFontDatabasePrivate *db = privateDb();-
796-
797-
798 if (!db->count
!db->countDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
799 QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
never executed: QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
0
800-
801 if (db->reregisterAppFonts
db->reregisterAppFontsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
802 for (int i = 0; i < db->applicationFonts.count()
i < db->applic...nFonts.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
803 if (!db->applicationFonts.at(i).families.isEmpty()
!db->applicati...lies.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
804 registerFont(&db->applicationFonts[i]);
never executed: registerFont(&db->applicationFonts[i]);
0
805 }
never executed: end of block
0
806 db->reregisterAppFonts = false;-
807 }
never executed: end of block
0
808}
never executed: end of block
0
809-
810static inline void load(const QString & = QString(), int = -1)-
811{-
812-
813 if (!privateDb()->count
!privateDb()->countDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
814 initializeDb();
never executed: initializeDb();
0
815}
never executed: end of block
0
816-
817static-
818QFontEngine *loadSingleEngine(int script,-
819 const QFontDef &request,-
820 QtFontFamily *family, QtFontFoundry *foundry,-
821 QtFontStyle *style, QtFontSize *size)-
822{-
823 (void)foundry;;-
824-
825 ((!(size)) ? qt_assert("size",__FILE__,922) : qt_noop());-
826 QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();-
827 int pixelSize = size->pixelSize;-
828 if (!pixelSize
!pixelSizeDescription
TRUEnever evaluated
FALSEnever evaluated
|| (style->smoothScalable
style->smoothScalableDescription
TRUEnever evaluated
FALSEnever evaluated
&& pixelSize == 0xffff
pixelSize == 0xffffDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
829 || pfdb->fontsAlwaysScalable()
pfdb->fontsAlwaysScalable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
830 pixelSize = request.pixelSize;-
831 }
never executed: end of block
0
832-
833 QFontDef def = request;-
834 def.pixelSize = pixelSize;-
835-
836 QFontCache *fontCache = QFontCache::instance();-
837-
838 QFontCache::Key key(def,script);-
839 QFontEngine *engine = fontCache->findEngine(key);-
840 if (!engine
!engineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
841 const bool cacheForCommonScript = script != QChar::Script_Common
script != QChar::Script_CommonDescription
TRUEnever evaluated
FALSEnever evaluated
0
842 && (
(family->writi...upported) != 0Description
TRUEnever evaluated
FALSEnever evaluated
family->writingSystems[QFontDatabase::Latin] & QtFontFamily::Supported) != 0
(family->writi...upported) != 0Description
TRUEnever evaluated
FALSEnever evaluated
;
0
843-
844 if (__builtin_expect(!!(cacheForCommonScript), true)
__builtin_expe...Script), true)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
845-
846 key.script = QChar::Script_Common;-
847 engine = fontCache->findEngine(key);-
848 key.script = script;-
849 if (engine
engineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
850-
851 if (__builtin_expect(!!(!engine->supportsScript(QChar::Script(script))), false)
__builtin_expe...ipt))), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
852 QMessageLogger(__FILE__, 949, __PRETTY_FUNCTION__).warning(" OpenType support missing for script %d", script);-
853 return
never executed: return 0;
0;
never executed: return 0;
0
854 }-
855-
856 engine->isSmoothlyScalable = style->smoothScalable;-
857 fontCache->insertEngine(key, engine);-
858 return
never executed: return engine;
engine;
never executed: return engine;
0
859 }-
860 }
never executed: end of block
0
861-
862-
863-
864-
865 if (style->key.stretch != 0
style->key.stretch != 0Description
TRUEnever evaluated
FALSEnever evaluated
&& request.stretch != 0
request.stretch != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
866 && (request.styleName.isEmpty()
request.styleName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| request.styleName != style->styleName
request.styleN...yle->styleNameDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
867 def.stretch = (request.stretch * 100 + 50) / style->key.stretch;-
868 }
never executed: end of block
0
869-
870 engine = pfdb->fontEngine(def, size->handle);-
871 if (engine
engineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
872-
873 if (!engine->supportsScript(QChar::Script(script))
!engine->suppo...cript(script))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
874 QMessageLogger(__FILE__, 971, __PRETTY_FUNCTION__).warning(" OpenType support missing for script %d", script);-
875 if (engine->ref.load() == 0
engine->ref.load() == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
876 delete engine;
never executed: delete engine;
0
877 return
never executed: return 0;
0;
never executed: return 0;
0
878 }-
879-
880 engine->isSmoothlyScalable = style->smoothScalable;-
881 fontCache->insertEngine(key, engine);-
882-
883 if (__builtin_expect(!!(cacheForCommonScript && !engine->symbol), true)
__builtin_expe...symbol), true)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
884-
885 key.script = QChar::Script_Common;-
886 if (!fontCache->findEngine(key)
!fontCache->findEngine(key)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
887 fontCache->insertEngine(key, engine);
never executed: fontCache->insertEngine(key, engine);
0
888 }
never executed: end of block
0
889 }
never executed: end of block
0
890 }
never executed: end of block
0
891 return
never executed: return engine;
engine;
never executed: return engine;
0
892}-
893-
894static-
895QFontEngine *loadEngine(int script, const QFontDef &request,-
896 QtFontFamily *family, QtFontFoundry *foundry,-
897 QtFontStyle *style, QtFontSize *size)-
898{-
899 QFontEngine *engine = loadSingleEngine(script, request, family, foundry, style, size);-
900-
901 if (engine
engineDescription
TRUEnever evaluated
FALSEnever evaluated
&& !(request.styleStrategy & QFont::NoFontMerging)
!(request.styl...NoFontMerging)Description
TRUEnever evaluated
FALSEnever evaluated
&& !engine->symbol
!engine->symbolDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
902 QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();-
903 QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script));-
904 if (!request.fallBackFamilies.isEmpty()
!request.fallB...lies.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
905 QStringList fallbacks = request.fallBackFamilies;-
906-
907 QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);-
908 if (styleHint == QFont::AnyStyle
styleHint == QFont::AnyStyleDescription
TRUEnever evaluated
FALSEnever evaluated
&& request.fixedPitch
request.fixedPitchDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
909 styleHint = QFont::TypeWriter;
never executed: styleHint = QFont::TypeWriter;
0
910-
911 fallbacks += fallbacksForFamily(family->name, QFont::Style(style->key.style), styleHint, QChar::Script(script));-
912-
913 pfMultiEngine->setFallbackFamiliesList(fallbacks);-
914 }
never executed: end of block
0
915 engine = pfMultiEngine;-
916-
917-
918-
919 QFontCache::Key key(request, script, 1);-
920 QFontCache::instance()->insertEngine(key, engine);-
921 }
never executed: end of block
0
922-
923 return
never executed: return engine;
engine;
never executed: return engine;
0
924}-
925-
926static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)-
927{-
928 QFontDatabasePrivate *db = privateDb();-
929-
930 fnt->families = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName);-
931-
932 db->reregisterAppFonts = true;-
933}
never executed: end of block
0
934-
935static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey,-
936 const QString &styleName = QString())-
937{-
938 int best = 0;-
939 int dist = 0xffff;-
940-
941 for ( int i = 0; i < foundry->count
i < foundry->countDescription
TRUEnever evaluated
FALSEnever evaluated
; i++ ) {
0
942 QtFontStyle *style = foundry->styles[i];-
943-
944 if (!styleName.isEmpty()
!styleName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& styleName == style->styleName
styleName == style->styleNameDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
945 dist = 0;-
946 best = i;-
947 break;
never executed: break;
0
948 }-
949-
950 int d = qAbs( styleKey.weight - style->key.weight );-
951-
952 if ( styleKey.stretch != 0
styleKey.stretch != 0Description
TRUEnever evaluated
FALSEnever evaluated
&& style->key.stretch != 0
style->key.stretch != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
953 d += qAbs( styleKey.stretch - style->key.stretch );-
954 }
never executed: end of block
0
955-
956 if (styleKey.style != style->key.style
styleKey.style...yle->key.styleDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
957 if (styleKey.style != QFont::StyleNormal
styleKey.style...t::StyleNormalDescription
TRUEnever evaluated
FALSEnever evaluated
&& style->key.style != QFont::StyleNormal
style->key.sty...t::StyleNormalDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
958-
959 d += 0x0001;
never executed: d += 0x0001;
0
960 else-
961 d += 0x1000;
never executed: d += 0x1000;
0
962 }-
963-
964 if ( d < dist
d < distDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
965 best = i;-
966 dist = d;-
967 }
never executed: end of block
0
968 }
never executed: end of block
0
969-
970 if (false) QMessageLogger(__FILE__, 1067, __PRETTY_FUNCTION__).debug( " best style has distance 0x%x", dist );
dead code: QMessageLogger(__FILE__, 1067, __PRETTY_FUNCTION__).debug( " best style has distance 0x%x", dist );
-
971 return
never executed: return foundry->styles[best];
foundry->styles[best];
never executed: return foundry->styles[best];
0
972}-
973-
974-
975static-
976unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,-
977 const QtFontFamily *family, const QString &foundry_name,-
978 QtFontStyle::Key styleKey, int pixelSize, char pitch,-
979 QtFontDesc *desc, const QString &styleName = QString())-
980{-
981 (void)script;;-
982 (void)pitch;;-
983-
984 desc->foundry = 0;-
985 desc->style = 0;-
986 desc->size = 0;-
987-
988-
989 if (false) QMessageLogger(__FILE__, 1086, __PRETTY_FUNCTION__).debug(" REMARK: looking for best foundry for family '%s' [%d]", family->name.toLatin1().constData(), family->count);
dead code: QMessageLogger(__FILE__, 1086, __PRETTY_FUNCTION__).debug(" REMARK: looking for best foundry for family '%s' [%d]", family->name.toLatin1().constData(), family->count);
-
990-
991 for (int x = 0; x < family->count
x < family->countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
992 QtFontFoundry *foundry = family->foundries[x];-
993 if (!foundry_name.isEmpty()
!foundry_name.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& foundry->name.compare(foundry_name, Qt::CaseInsensitive) != 0
foundry->name....ensitive) != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
994 continue;
never executed: continue;
0
995-
996 if (false) QMessageLogger(__FILE__, 1093, __PRETTY_FUNCTION__).debug(" looking for matching style in foundry '%s' %d",
dead code: QMessageLogger(__FILE__, 1093, __PRETTY_FUNCTION__).debug(" looking for matching style in foundry '%s' %d", foundry->name.isEmpty() ? "-- none --" : foundry->name.toLatin1().constData(), foundry->count);
-
997 foundry->name.isEmpty() ? "-- none --" : foundry->name.toLatin1().constData(), foundry->count);
dead code: QMessageLogger(__FILE__, 1093, __PRETTY_FUNCTION__).debug(" looking for matching style in foundry '%s' %d", foundry->name.isEmpty() ? "-- none --" : foundry->name.toLatin1().constData(), foundry->count);
-
998-
999 QtFontStyle *style = bestStyle(foundry, styleKey, styleName);-
1000-
1001 if (!style->smoothScalable
!style->smoothScalableDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(styleStrategy...:ForceOutline)Description
TRUEnever evaluated
FALSEnever evaluated
styleStrategy & QFont::ForceOutline)
(styleStrategy...:ForceOutline)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1002 if (false) QMessageLogger(__FILE__, 1099, __PRETTY_FUNCTION__).debug(" ForceOutline set, but not smoothly scalable");
dead code: QMessageLogger(__FILE__, 1099, __PRETTY_FUNCTION__).debug(" ForceOutline set, but not smoothly scalable");
-
1003 continue;
never executed: continue;
0
1004 }-
1005-
1006 int px = -1;-
1007 QtFontSize *size = 0;-
1008-
1009-
1010 if (!(styleStrategy & QFont::ForceOutline)
!(styleStrateg...:ForceOutline)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1011 size = style->pixelSize(pixelSize);-
1012 if (size
sizeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1013 if (false) QMessageLogger(__FILE__, 1110, __PRETTY_FUNCTION__).debug(" found exact size match (%d pixels)", size->pixelSize);
dead code: QMessageLogger(__FILE__, 1110, __PRETTY_FUNCTION__).debug(" found exact size match (%d pixels)", size->pixelSize);
-
1014 px = size->pixelSize;-
1015 }
never executed: end of block
0
1016 }
never executed: end of block
0
1017-
1018-
1019 if (!size
!sizeDescription
TRUEnever evaluated
FALSEnever evaluated
&& style->smoothScalable
style->smoothScalableDescription
TRUEnever evaluated
FALSEnever evaluated
&& ! (styleStrategy & QFont::PreferBitmap)
! (styleStrate...:PreferBitmap)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1020 size = style->pixelSize(0xffff);-
1021 if (size
sizeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1022 if (false) QMessageLogger(__FILE__, 1119, __PRETTY_FUNCTION__).debug(" found smoothly scalable font (%d pixels)", pixelSize);
dead code: QMessageLogger(__FILE__, 1119, __PRETTY_FUNCTION__).debug(" found smoothly scalable font (%d pixels)", pixelSize);
-
1023 px = pixelSize;-
1024 }
never executed: end of block
0
1025 }
never executed: end of block
0
1026-
1027-
1028 if (!size
!sizeDescription
TRUEnever evaluated
FALSEnever evaluated
&& style->bitmapScalable
style->bitmapScalableDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(styleStrategy...::PreferMatch)Description
TRUEnever evaluated
FALSEnever evaluated
styleStrategy & QFont::PreferMatch)
(styleStrategy...::PreferMatch)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1029 size = style->pixelSize(0);-
1030 if (size
sizeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1031 if (false) QMessageLogger(__FILE__, 1128, __PRETTY_FUNCTION__).debug(" found bitmap scalable font (%d pixels)", pixelSize);
dead code: QMessageLogger(__FILE__, 1128, __PRETTY_FUNCTION__).debug(" found bitmap scalable font (%d pixels)", pixelSize);
-
1032 px = pixelSize;-
1033 }
never executed: end of block
0
1034 }
never executed: end of block
0
1035-
1036-
1037-
1038 if (! size
! sizeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1039 unsigned int distance = ~0u;-
1040 for (int x = 0; x < style->count
x < style->countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
1041-
1042 unsigned int d;-
1043 if (style->pixelSizes[x].pixelSize < pixelSize
style->pixelSi...ze < pixelSizeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1044-
1045-
1046-
1047 d = pixelSize - style->pixelSizes[x].pixelSize + 1;-
1048 }
never executed: end of block
else {
0
1049 d = style->pixelSizes[x].pixelSize - pixelSize;-
1050 }
never executed: end of block
0
1051-
1052 if (d < distance
d < distanceDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1053 distance = d;-
1054 size = style->pixelSizes + x;-
1055 if (false) QMessageLogger(__FILE__, 1152, __PRETTY_FUNCTION__).debug(" best size so far: %3d (%d)", size->pixelSize, pixelSize);
dead code: QMessageLogger(__FILE__, 1152, __PRETTY_FUNCTION__).debug(" best size so far: %3d (%d)", size->pixelSize, pixelSize);
-
1056 }
never executed: end of block
0
1057 }
never executed: end of block
0
1058-
1059 if (!size
!sizeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1060 if (false) QMessageLogger(__FILE__, 1157, __PRETTY_FUNCTION__).debug(" no size supports the script we want");
dead code: QMessageLogger(__FILE__, 1157, __PRETTY_FUNCTION__).debug(" no size supports the script we want");
-
1061 continue;
never executed: continue;
0
1062 }-
1063-
1064 if (style->bitmapScalable
style->bitmapScalableDescription
TRUEnever evaluated
FALSEnever evaluated
&& ! (styleStrategy & QFont::PreferQuality)
! (styleStrate...PreferQuality)Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
1065 (
(distance * 10...ixelSize) >= 2Description
TRUEnever evaluated
FALSEnever evaluated
distance * 10 / pixelSize) >= 2
(distance * 10...ixelSize) >= 2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1066-
1067-
1068 size = style->pixelSize(0);-
1069 px = pixelSize;-
1070 }
never executed: end of block
else {
0
1071 px = size->pixelSize;-
1072 }
never executed: end of block
0
1073 }-
1074-
1075-
1076 unsigned int this_score = 0x0000;-
1077 enum {-
1078 PitchMismatch = 0x4000,-
1079 StyleMismatch = 0x2000,-
1080 BitmapScaledPenalty = 0x1000-
1081 };-
1082 if (pitch != '*'
pitch != '*'Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1083 if ((pitch == 'm'
pitch == 'm'Description
TRUEnever evaluated
FALSEnever evaluated
&& !family->fixedPitch
!family->fixedPitchDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1084 || (pitch == 'p'
pitch == 'p'Description
TRUEnever evaluated
FALSEnever evaluated
&& family->fixedPitch
family->fixedPitchDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
1085 this_score += PitchMismatch;
never executed: this_score += PitchMismatch;
0
1086 }
never executed: end of block
0
1087 if (styleKey != style->key
styleKey != style->keyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1088 this_score += StyleMismatch;
never executed: this_score += StyleMismatch;
0
1089 if (!style->smoothScalable
!style->smoothScalableDescription
TRUEnever evaluated
FALSEnever evaluated
&& px != size->pixelSize
px != size->pixelSizeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1090 this_score += BitmapScaledPenalty;
never executed: this_score += BitmapScaledPenalty;
0
1091 if (px != pixelSize
px != pixelSizeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1092 this_score += qAbs(px - pixelSize);
never executed: this_score += qAbs(px - pixelSize);
0
1093-
1094 if (this_score < score
this_score < scoreDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1095 if (false) QMessageLogger(__FILE__, 1192, __PRETTY_FUNCTION__).debug(" found a match: score %x best score so far %x",
dead code: QMessageLogger(__FILE__, 1192, __PRETTY_FUNCTION__).debug(" found a match: score %x best score so far %x", this_score, score);
-
1096 this_score, score);
dead code: QMessageLogger(__FILE__, 1192, __PRETTY_FUNCTION__).debug(" found a match: score %x best score so far %x", this_score, score);
-
1097-
1098 score = this_score;-
1099 desc->foundry = foundry;-
1100 desc->style = style;-
1101 desc->size = size;-
1102 }
never executed: end of block
else {
0
1103 if (false) QMessageLogger(__FILE__, 1200, __PRETTY_FUNCTION__).debug(" score %x no better than best %x", this_score, score);
dead code: QMessageLogger(__FILE__, 1200, __PRETTY_FUNCTION__).debug(" score %x no better than best %x", this_score, score);
-
1104 }
never executed: end of block
0
1105 }-
1106-
1107 return
never executed: return score;
score;
never executed: return score;
0
1108}-
1109-
1110static bool matchFamilyName(const QString &familyName, QtFontFamily *f)-
1111{-
1112 if (familyName.isEmpty()
familyName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1113 return
never executed: return true;
true;
never executed: return true;
0
1114 return
never executed: return f->matchesFamilyName(familyName);
f->matchesFamilyName(familyName);
never executed: return f->matchesFamilyName(familyName);
0
1115}-
1116-
1117-
1118-
1119-
1120-
1121-
1122static int match(int script, const QFontDef &request,-
1123 const QString &family_name, const QString &foundry_name,-
1124 QtFontDesc *desc, const QList<int> &blacklistedFamilies)-
1125{-
1126 int result = -1;-
1127-
1128 QtFontStyle::Key styleKey;-
1129 styleKey.style = request.style;-
1130 styleKey.weight = request.weight;-
1131 styleKey.stretch = request.stretch;-
1132 char pitch = request.ignorePitch
request.ignorePitchDescription
TRUEnever evaluated
FALSEnever evaluated
? '*' : request.fixedPitch
request.fixedPitchDescription
TRUEnever evaluated
FALSEnever evaluated
? 'm' : 'p';
0
1133-
1134-
1135 if (false) QMessageLogger(__FILE__, 1232, __PRETTY_FUNCTION__).debug("QFontDatabase::match\n"
dead code: QMessageLogger(__FILE__, 1232, __PRETTY_FUNCTION__).debug("QFontDatabase::match\n" " request:\n" " family: %s [%s], script: %d\n" " weight: %d, style: %d\n" " stretch: %d\n" " pixelSize: %g\n" " pitch: %c", family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
-
1136 " request:\n"
dead code: QMessageLogger(__FILE__, 1232, __PRETTY_FUNCTION__).debug("QFontDatabase::match\n" " request:\n" " family: %s [%s], script: %d\n" " weight: %d, style: %d\n" " stretch: %d\n" " pixelSize: %g\n" " pitch: %c", family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
-
1137 " family: %s [%s], script: %d\n"
dead code: QMessageLogger(__FILE__, 1232, __PRETTY_FUNCTION__).debug("QFontDatabase::match\n" " request:\n" " family: %s [%s], script: %d\n" " weight: %d, style: %d\n" " stretch: %d\n" " pixelSize: %g\n" " pitch: %c", family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
-
1138 " weight: %d, style: %d\n"
dead code: QMessageLogger(__FILE__, 1232, __PRETTY_FUNCTION__).debug("QFontDatabase::match\n" " request:\n" " family: %s [%s], script: %d\n" " weight: %d, style: %d\n" " stretch: %d\n" " pixelSize: %g\n" " pitch: %c", family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
-
1139 " stretch: %d\n"
dead code: QMessageLogger(__FILE__, 1232, __PRETTY_FUNCTION__).debug("QFontDatabase::match\n" " request:\n" " family: %s [%s], script: %d\n" " weight: %d, style: %d\n" " stretch: %d\n" " pixelSize: %g\n" " pitch: %c", family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
-
1140 " pixelSize: %g\n"
dead code: QMessageLogger(__FILE__, 1232, __PRETTY_FUNCTION__).debug("QFontDatabase::match\n" " request:\n" " family: %s [%s], script: %d\n" " weight: %d, style: %d\n" " stretch: %d\n" " pixelSize: %g\n" " pitch: %c", family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
-
1141 " pitch: %c",
dead code: QMessageLogger(__FILE__, 1232, __PRETTY_FUNCTION__).debug("QFontDatabase::match\n" " request:\n" " family: %s [%s], script: %d\n" " weight: %d, style: %d\n" " stretch: %d\n" " pixelSize: %g\n" " pitch: %c", family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
-
1142 family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(),
dead code: QMessageLogger(__FILE__, 1232, __PRETTY_FUNCTION__).debug("QFontDatabase::match\n" " request:\n" " family: %s [%s], script: %d\n" " weight: %d, style: %d\n" " stretch: %d\n" " pixelSize: %g\n" " pitch: %c", family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
-
1143 foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(),
dead code: QMessageLogger(__FILE__, 1232, __PRETTY_FUNCTION__).debug("QFontDatabase::match\n" " request:\n" " family: %s [%s], script: %d\n" " weight: %d, style: %d\n" " stretch: %d\n" " pixelSize: %g\n" " pitch: %c", family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
-
1144 script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
dead code: QMessageLogger(__FILE__, 1232, __PRETTY_FUNCTION__).debug("QFontDatabase::match\n" " request:\n" " family: %s [%s], script: %d\n" " weight: %d, style: %d\n" " stretch: %d\n" " pixelSize: %g\n" " pitch: %c", family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
-
1145-
1146 desc->family = 0;-
1147 desc->foundry = 0;-
1148 desc->style = 0;-
1149 desc->size = 0;-
1150-
1151 unsigned int score = ~0u;-
1152-
1153 load(family_name, script);-
1154-
1155 size_t writingSystem = std::find(scriptForWritingSystem, scriptForWritingSystem +-
1156 QFontDatabase::WritingSystemsCount, script) - scriptForWritingSystem;-
1157 if (writingSystem >= QFontDatabase::WritingSystemsCount
writingSystem ...ngSystemsCountDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1158 writingSystem = QFontDatabase::Any;
never executed: writingSystem = QFontDatabase::Any;
0
1159-
1160 QFontDatabasePrivate *db = privateDb();-
1161 for (int x = 0; x < db->count
x < db->countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
1162 if (blacklistedFamilies.contains(x)
blacklistedFam...es.contains(x)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1163 continue;
never executed: continue;
0
1164 QtFontDesc test;-
1165 test.family = db->families[x];-
1166-
1167 if (!matchFamilyName(family_name, test.family)
!matchFamilyNa..., test.family)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1168 continue;
never executed: continue;
0
1169-
1170 test.family->ensurePopulated();-
1171-
1172-
1173 if (writingSystem != QFontDatabase::Any
writingSystem ...tDatabase::AnyDescription
TRUEnever evaluated
FALSEnever evaluated
&& !(test.family->writingSystems[writingSystem] & QtFontFamily::Supported)
!(test.family-...ly::Supported)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1174 continue;
never executed: continue;
0
1175-
1176-
1177-
1178 unsigned int newscore =-
1179 bestFoundry(script, score, request.styleStrategy,-
1180 test.family, foundry_name, styleKey, request.pixelSize, pitch,-
1181 &test, request.styleName);-
1182 if (test.foundry == 0
test.foundry == 0Description
TRUEnever evaluated
FALSEnever evaluated
&& !foundry_name.isEmpty()
!foundry_name.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1183-
1184-
1185 newscore = bestFoundry(script, score, request.styleStrategy, test.family,-
1186 QString(), styleKey, request.pixelSize,-
1187 pitch, &test, request.styleName);-
1188 }
never executed: end of block
0
1189-
1190 if (newscore < score
newscore < scoreDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1191 result = x;-
1192 score = newscore;-
1193 *desc = test;-
1194 }
never executed: end of block
0
1195 if (newscore < 10
newscore < 10Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1196 break;
never executed: break;
0
1197 }
never executed: end of block
0
1198 return
never executed: return result;
result;
never executed: return result;
0
1199}-
1200-
1201static QString styleStringHelper(int weight, QFont::Style style)-
1202{-
1203 QString result;-
1204 if (weight > QFont::Normal
weight > QFont::NormalDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1205 if (weight >= QFont::Black
weight >= QFont::BlackDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1206 result = QCoreApplication::translate("QFontDatabase", "Black");
never executed: result = QCoreApplication::translate("QFontDatabase", "Black");
0
1207 else if (weight >= QFont::ExtraBold
weight >= QFont::ExtraBoldDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1208 result = QCoreApplication::translate("QFontDatabase", "Extra Bold");
never executed: result = QCoreApplication::translate("QFontDatabase", "Extra Bold");
0
1209 else if (weight >= QFont::Bold
weight >= QFont::BoldDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1210 result = QCoreApplication::translate("QFontDatabase", "Bold");
never executed: result = QCoreApplication::translate("QFontDatabase", "Bold");
0
1211 else if (weight >= QFont::DemiBold
weight >= QFont::DemiBoldDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1212 result = QCoreApplication::translate("QFontDatabase", "Demi Bold");
never executed: result = QCoreApplication::translate("QFontDatabase", "Demi Bold");
0
1213 else if (weight >= QFont::Medium
weight >= QFont::MediumDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1214 result = QCoreApplication::translate("QFontDatabase", "Medium", "The Medium font weight");
never executed: result = QCoreApplication::translate("QFontDatabase", "Medium", "The Medium font weight");
0
1215 }
never executed: end of block
else {
0
1216 if (weight <= QFont::Thin
weight <= QFont::ThinDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1217 result = QCoreApplication::translate("QFontDatabase", "Thin");
never executed: result = QCoreApplication::translate("QFontDatabase", "Thin");
0
1218 else if (weight <= QFont::ExtraLight
weight <= QFont::ExtraLightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1219 result = QCoreApplication::translate("QFontDatabase", "Extra Light");
never executed: result = QCoreApplication::translate("QFontDatabase", "Extra Light");
0
1220 else if (weight <= QFont::Light
weight <= QFont::LightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1221 result = QCoreApplication::translate("QFontDatabase", "Light");
never executed: result = QCoreApplication::translate("QFontDatabase", "Light");
0
1222 }
never executed: end of block
0
1223-
1224 if (style == QFont::StyleItalic
style == QFont::StyleItalicDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1225 result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Italic");
never executed: result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Italic");
0
1226 else if (style == QFont::StyleOblique
style == QFont::StyleObliqueDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1227 result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Oblique");
never executed: result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Oblique");
0
1228-
1229 if (result.isEmpty()
result.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1230 result = QCoreApplication::translate("QFontDatabase", "Normal", "The Normal or Regular font weight");
never executed: result = QCoreApplication::translate("QFontDatabase", "Normal", "The Normal or Regular font weight");
0
1231-
1232 return
never executed: return result.simplified();
result.simplified();
never executed: return result.simplified();
0
1233}-
1234-
1235-
1236-
1237-
1238-
1239-
1240QString QFontDatabase::styleString(const QFont &font)-
1241{-
1242 return
never executed: return font.styleName().isEmpty() ? styleStringHelper(font.weight(), font.style()) : font.styleName();
font.styleName().isEmpty() ? styleStringHelper(font.weight(), font.style())
never executed: return font.styleName().isEmpty() ? styleStringHelper(font.weight(), font.style()) : font.styleName();
0
1243 : font.styleName();
never executed: return font.styleName().isEmpty() ? styleStringHelper(font.weight(), font.style()) : font.styleName();
0
1244}-
1245-
1246-
1247-
1248-
1249-
1250-
1251QString QFontDatabase::styleString(const QFontInfo &fontInfo)-
1252{-
1253 return
never executed: return fontInfo.styleName().isEmpty() ? styleStringHelper(fontInfo.weight(), fontInfo.style()) : fontInfo.styleName();
fontInfo.styleName().isEmpty() ? styleStringHelper(fontInfo.weight(), fontInfo.style())
never executed: return fontInfo.styleName().isEmpty() ? styleStringHelper(fontInfo.weight(), fontInfo.style()) : fontInfo.styleName();
0
1254 : fontInfo.styleName();
never executed: return fontInfo.styleName().isEmpty() ? styleStringHelper(fontInfo.weight(), fontInfo.style()) : fontInfo.styleName();
0
1255}-
1256QFontDatabase::QFontDatabase()-
1257{-
1258 if (__builtin_expect(!!(!(static_cast<QGuiApplication *>(QCoreApplication::instance())) || !QGuiApplicationPrivate::platformIntegration()), false)
__builtin_expe...ion()), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1259 QMessageLogger(__FILE__, 1413, __PRETTY_FUNCTION__).fatal("QFontDatabase: Must construct a QGuiApplication before accessing QFontDatabase");
never executed: QMessageLogger(__FILE__, 1413, __PRETTY_FUNCTION__).fatal("QFontDatabase: Must construct a QGuiApplication before accessing QFontDatabase");
0
1260-
1261 QMutexLocker locker(fontDatabaseMutex());-
1262 createDatabase();-
1263 d = privateDb();-
1264}
never executed: end of block
0
1265QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems() const-
1266{-
1267 QMutexLocker locker(fontDatabaseMutex());-
1268-
1269 ::load();-
1270-
1271 quint64 writingSystemsFound = 0;-
1272 static_assert(bool(WritingSystemsCount < 64), "WritingSystemsCount < 64");-
1273-
1274 for (int i = 0; i < d->count
i < d->countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1275 QtFontFamily *family = d->families[i];-
1276 family->ensurePopulated();-
1277-
1278 if (family->count == 0
family->count == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1279 continue;
never executed: continue;
0
1280 for (uint x = Latin; x < uint(WritingSystemsCount)
x < uint(WritingSystemsCount)Description
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
1281 if (family->writingSystems[x] & QtFontFamily::Supported
family->writin...ily::SupportedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1282 writingSystemsFound |= quint64(1) << x;
never executed: writingSystemsFound |= quint64(1) << x;
0
1283 }
never executed: end of block
0
1284 }
never executed: end of block
0
1285-
1286-
1287 locker.unlock();-
1288-
1289 QList<WritingSystem> list;-
1290 list.reserve(qPopulationCount(writingSystemsFound));-
1291 for (uint x = Latin ; x < uint(WritingSystemsCount)
x < uint(WritingSystemsCount)Description
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
1292 if (writingSystemsFound & (quint64(1) << x)
writingSystems...int64(1) << x)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1293 list.push_back(WritingSystem(x));
never executed: list.push_back(WritingSystem(x));
0
1294 }
never executed: end of block
0
1295 return
never executed: return list;
list;
never executed: return list;
0
1296}-
1297QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems(const QString &family) const-
1298{-
1299 QString familyName, foundryName;-
1300 parseFontName(family, foundryName, familyName);-
1301-
1302 QMutexLocker locker(fontDatabaseMutex());-
1303-
1304 ::load();-
1305-
1306 QList<WritingSystem> list;-
1307 QtFontFamily *f = d->family(familyName);-
1308 if (!f
!fDescription
TRUEnever evaluated
FALSEnever evaluated
|| f->count == 0
f->count == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1309 return
never executed: return list;
list;
never executed: return list;
0
1310-
1311 for (int x = Latin; x < WritingSystemsCount
x < WritingSystemsCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
1312 const WritingSystem writingSystem = WritingSystem(x);-
1313 if (f->writingSystems[writingSystem] & QtFontFamily::Supported
f->writingSyst...ily::SupportedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1314 list.append(writingSystem);
never executed: list.append(writingSystem);
0
1315 }
never executed: end of block
0
1316 return
never executed: return list;
list;
never executed: return list;
0
1317}-
1318QStringList QFontDatabase::families(WritingSystem writingSystem) const-
1319{-
1320 QMutexLocker locker(fontDatabaseMutex());-
1321-
1322 ::load();-
1323-
1324 QStringList flist;-
1325 for (int i = 0; i < d->count
i < d->countDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
1326 QtFontFamily *f = d->families[i];-
1327 if (f->populated
f->populatedDescription
TRUEnever evaluated
FALSEnever evaluated
&& f->count == 0
f->count == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1328 continue;
never executed: continue;
0
1329 if (writingSystem != Any
writingSystem != AnyDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1330 f->ensurePopulated();-
1331 if (f->writingSystems[writingSystem] != QtFontFamily::Supported
f->writingSyst...ily::SupportedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1332 continue;
never executed: continue;
0
1333 }
never executed: end of block
0
1334 if (!f->populated
!f->populatedDescription
TRUEnever evaluated
FALSEnever evaluated
|| f->count == 1
f->count == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1335 flist.append(f->name);-
1336 }
never executed: end of block
else {
0
1337 for (int j = 0; j < f->count
j < f->countDescription
TRUEnever evaluated
FALSEnever evaluated
; j++) {
0
1338 QString str = f->name;-
1339 QString foundry = f->foundries[j]->name;-
1340 if (!foundry.isEmpty()
!foundry.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1341 str += QLatin1String(" [");-
1342 str += foundry;-
1343 str += QLatin1Char(']');-
1344 }
never executed: end of block
0
1345 flist.append(str);-
1346 }
never executed: end of block
0
1347 }
never executed: end of block
0
1348 }-
1349 return
never executed: return flist;
flist;
never executed: return flist;
0
1350}-
1351QStringList QFontDatabase::styles(const QString &family) const-
1352{-
1353 QString familyName, foundryName;-
1354 parseFontName(family, foundryName, familyName);-
1355-
1356 QMutexLocker locker(fontDatabaseMutex());-
1357-
1358 ::load(familyName);-
1359-
1360 QStringList l;-
1361 QtFontFamily *f = d->family(familyName);-
1362 if (!f
!fDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1363 return
never executed: return l;
l;
never executed: return l;
0
1364-
1365 QtFontFoundry allStyles(foundryName);-
1366 for (int j = 0; j < f->count
j < f->countDescription
TRUEnever evaluated
FALSEnever evaluated
; j++) {
0
1367 QtFontFoundry *foundry = f->foundries[j];-
1368 if (foundryName.isEmpty()
foundryName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
foundry->name....ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1369 for (int k = 0; k < foundry->count
k < foundry->countDescription
TRUEnever evaluated
FALSEnever evaluated
; k++) {
0
1370 QtFontStyle::Key ke(foundry->styles[k]->key);-
1371 ke.stretch = 0;-
1372 allStyles.style(ke, foundry->styles[k]->styleName, true);-
1373 }
never executed: end of block
0
1374 }
never executed: end of block
0
1375 }
never executed: end of block
0
1376-
1377 l.reserve(allStyles.count);-
1378 for (int i = 0; i < allStyles.count
i < allStyles.countDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
1379 l.append(allStyles.styles[i]->styleName.isEmpty() ?-
1380 styleStringHelper(allStyles.styles[i]->key.weight,-
1381 (QFont::Style)allStyles.styles[i]->key.style) :-
1382 allStyles.styles[i]->styleName);-
1383 }
never executed: end of block
0
1384 return
never executed: return l;
l;
never executed: return l;
0
1385}-
1386-
1387-
1388-
1389-
1390-
1391-
1392bool QFontDatabase::isFixedPitch(const QString &family,-
1393 const QString &style) const-
1394{-
1395 (void)style;;-
1396-
1397 QString familyName, foundryName;-
1398 parseFontName(family, foundryName, familyName);-
1399-
1400 QMutexLocker locker(fontDatabaseMutex());-
1401-
1402 ::load(familyName);-
1403-
1404 QtFontFamily *f = d->family(familyName);-
1405 return
never executed: return (f && f->fixedPitch);
(f && f->fixedPitch);
never executed: return (f && f->fixedPitch);
0
1406}-
1407bool QFontDatabase::isBitmapScalable(const QString &family,-
1408 const QString &style) const-
1409{-
1410 bool bitmapScalable = false;-
1411 QString familyName, foundryName;-
1412 parseFontName(family, foundryName, familyName);-
1413-
1414 QMutexLocker locker(fontDatabaseMutex());-
1415-
1416 ::load(familyName);-
1417-
1418 QtFontFamily *f = d->family(familyName);-
1419 if (!f
!fDescription
TRUEnever evaluated
FALSEnever evaluated
) return
never executed: return bitmapScalable;
bitmapScalable;
never executed: return bitmapScalable;
0
1420-
1421 QtFontStyle::Key styleKey(style);-
1422 for (int j = 0; j < f->count
j < f->countDescription
TRUEnever evaluated
FALSEnever evaluated
; j++) {
0
1423 QtFontFoundry *foundry = f->foundries[j];-
1424 if (foundryName.isEmpty()
foundryName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
foundry->name....ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1425 for (int k = 0; k < foundry->count
k < foundry->countDescription
TRUEnever evaluated
FALSEnever evaluated
; k++)
0
1426 if ((style.isEmpty()
style.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
||
0
1427 foundry->styles[k]->styleName == style
foundry->style...eName == styleDescription
TRUEnever evaluated
FALSEnever evaluated
||
0
1428 foundry->styles[k]->key == styleKey
foundry->style...ey == styleKeyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1429 && foundry->styles[k]->bitmapScalable
foundry->style...bitmapScalableDescription
TRUEnever evaluated
FALSEnever evaluated
&& !foundry->styles[k]->smoothScalable
!foundry->styl...smoothScalableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1430 bitmapScalable = true;-
1431 goto
never executed: goto end;
end;
never executed: goto end;
0
1432 }-
1433 }
never executed: end of block
0
1434 }
never executed: end of block
0
1435 end:
code before this statement never executed: end:
0
1436 return
never executed: return bitmapScalable;
bitmapScalable;
never executed: return bitmapScalable;
0
1437}-
1438bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &style) const-
1439{-
1440 bool smoothScalable = false;-
1441 QString familyName, foundryName;-
1442 parseFontName(family, foundryName, familyName);-
1443-
1444 QMutexLocker locker(fontDatabaseMutex());-
1445-
1446 ::load(familyName);-
1447-
1448 QtFontFamily *f = d->family(familyName);-
1449 if (!f
!fDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1450 for (int i = 0; i < d->count
i < d->countDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
1451 if (d->families[i]->matchesFamilyName(familyName)
d->families[i]...me(familyName)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1452 f = d->families[i];-
1453 f->ensurePopulated();-
1454 break;
never executed: break;
0
1455 }-
1456 }
never executed: end of block
0
1457 }
never executed: end of block
0
1458 if (!f
!fDescription
TRUEnever evaluated
FALSEnever evaluated
) return
never executed: return smoothScalable;
smoothScalable;
never executed: return smoothScalable;
0
1459-
1460 QtFontStyle::Key styleKey(style);-
1461 for (int j = 0; j < f->count
j < f->countDescription
TRUEnever evaluated
FALSEnever evaluated
; j++) {
0
1462 QtFontFoundry *foundry = f->foundries[j];-
1463 if (foundryName.isEmpty()
foundryName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
foundry->name....ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1464 for (int k = 0; k < foundry->count
k < foundry->countDescription
TRUEnever evaluated
FALSEnever evaluated
; k++)
0
1465 if ((style.isEmpty()
style.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
||
0
1466 foundry->styles[k]->styleName == style
foundry->style...eName == styleDescription
TRUEnever evaluated
FALSEnever evaluated
||
0
1467 foundry->styles[k]->key == styleKey
foundry->style...ey == styleKeyDescription
TRUEnever evaluated
FALSEnever evaluated
) && foundry->styles[k]->smoothScalable
foundry->style...smoothScalableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1468 smoothScalable = true;-
1469 goto
never executed: goto end;
end;
never executed: goto end;
0
1470 }-
1471 }
never executed: end of block
0
1472 }
never executed: end of block
0
1473 end:
code before this statement never executed: end:
0
1474 return
never executed: return smoothScalable;
smoothScalable;
never executed: return smoothScalable;
0
1475}-
1476-
1477-
1478-
1479-
1480-
1481-
1482-
1483bool QFontDatabase::isScalable(const QString &family,-
1484 const QString &style) const-
1485{-
1486 QMutexLocker locker(fontDatabaseMutex());-
1487 if (isSmoothlyScalable(family, style)
isSmoothlyScal...family, style)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1488 return
never executed: return true;
true;
never executed: return true;
0
1489 return
never executed: return isBitmapScalable(family, style);
isBitmapScalable(family, style);
never executed: return isBitmapScalable(family, style);
0
1490}-
1491QList<int> QFontDatabase::pointSizes(const QString &family,-
1492 const QString &styleName)-
1493{-
1494 if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()
QGuiApplicatio...waysScalable()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1495 return
never executed: return standardSizes();
standardSizes();
never executed: return standardSizes();
0
1496-
1497 bool smoothScalable = false;-
1498 QString familyName, foundryName;-
1499 parseFontName(family, foundryName, familyName);-
1500-
1501 QMutexLocker locker(fontDatabaseMutex());-
1502-
1503 ::load(familyName);-
1504-
1505 QList<int> sizes;-
1506-
1507 QtFontFamily *fam = d->family(familyName);-
1508 if (!fam
!famDescription
TRUEnever evaluated
FALSEnever evaluated
) return
never executed: return sizes;
sizes;
never executed: return sizes;
0
1509-
1510-
1511 const int dpi = qt_defaultDpiY();-
1512-
1513 QtFontStyle::Key styleKey(styleName);-
1514 for (int j = 0; j < fam->count
j < fam->countDescription
TRUEnever evaluated
FALSEnever evaluated
; j++) {
0
1515 QtFontFoundry *foundry = fam->foundries[j];-
1516 if (foundryName.isEmpty()
foundryName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
foundry->name....ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1517 QtFontStyle *style = foundry->style(styleKey, styleName);-
1518 if (!style
!styleDescription
TRUEnever evaluated
FALSEnever evaluated
) continue;
never executed: continue;
0
1519-
1520 if (style->smoothScalable
style->smoothScalableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1521 smoothScalable = true;-
1522 goto
never executed: goto end;
end;
never executed: goto end;
0
1523 }-
1524 for (int l = 0; l < style->count
l < style->countDescription
TRUEnever evaluated
FALSEnever evaluated
; l++) {
0
1525 const QtFontSize *size = style->pixelSizes + l;-
1526-
1527 if (size->pixelSize != 0
size->pixelSize != 0Description
TRUEnever evaluated
FALSEnever evaluated
&& size->pixelSize != 0xffff
size->pixelSize != 0xffffDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1528 const uint pointSize = qRound(size->pixelSize * 72.0 / dpi);-
1529 if (! sizes.contains(pointSize)
! sizes.contains(pointSize)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1530 sizes.append(pointSize);
never executed: sizes.append(pointSize);
0
1531 }
never executed: end of block
0
1532 }
never executed: end of block
0
1533 }
never executed: end of block
0
1534 }
never executed: end of block
0
1535 end:
code before this statement never executed: end:
0
1536 if (smoothScalable
smoothScalableDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1537 return
never executed: return standardSizes();
standardSizes();
never executed: return standardSizes();
0
1538-
1539 std::sort(sizes.begin(), sizes.end());-
1540 return
never executed: return sizes;
sizes;
never executed: return sizes;
0
1541}-
1542-
1543-
1544-
1545-
1546-
1547-
1548-
1549QFont QFontDatabase::font(const QString &family, const QString &style,-
1550 int pointSize) const-
1551{-
1552 QString familyName, foundryName;-
1553 parseFontName(family, foundryName, familyName);-
1554-
1555 QMutexLocker locker(fontDatabaseMutex());-
1556-
1557 ::load(familyName);-
1558-
1559 QtFontFoundry allStyles(foundryName);-
1560 QtFontFamily *f = d->family(familyName);-
1561 if (!f
!fDescription
TRUEnever evaluated
FALSEnever evaluated
) return
never executed: return QGuiApplication::font();
QGuiApplication::font();
never executed: return QGuiApplication::font();
0
1562-
1563 for (int j = 0; j < f->count
j < f->countDescription
TRUEnever evaluated
FALSEnever evaluated
; j++) {
0
1564 QtFontFoundry *foundry = f->foundries[j];-
1565 if (foundryName.isEmpty()
foundryName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
foundry->name....ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1566 for (int k = 0; k < foundry->count
k < foundry->countDescription
TRUEnever evaluated
FALSEnever evaluated
; k++)
0
1567 allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
never executed: allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
0
1568 }
never executed: end of block
0
1569 }
never executed: end of block
0
1570-
1571 QtFontStyle::Key styleKey(style);-
1572 QtFontStyle *s = bestStyle(&allStyles, styleKey, style);-
1573-
1574 if (!s
!sDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1575 return
never executed: return QGuiApplication::font();
QGuiApplication::font();
never executed: return QGuiApplication::font();
0
1576-
1577 QFont fnt(family, pointSize, s->key.weight);-
1578 fnt.setStyle((QFont::Style)s->key.style);-
1579 if (!s->styleName.isEmpty()
!s->styleName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1580 fnt.setStyleName(s->styleName);
never executed: fnt.setStyleName(s->styleName);
0
1581 return
never executed: return fnt;
fnt;
never executed: return fnt;
0
1582}-
1583QList<int> QFontDatabase::smoothSizes(const QString &family,-
1584 const QString &styleName)-
1585{-
1586 if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()
QGuiApplicatio...waysScalable()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1587 return
never executed: return standardSizes();
standardSizes();
never executed: return standardSizes();
0
1588-
1589 bool smoothScalable = false;-
1590 QString familyName, foundryName;-
1591 parseFontName(family, foundryName, familyName);-
1592-
1593 QMutexLocker locker(fontDatabaseMutex());-
1594-
1595 ::load(familyName);-
1596-
1597 QList<int> sizes;-
1598-
1599 QtFontFamily *fam = d->family(familyName);-
1600 if (!fam
!famDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1601 return
never executed: return sizes;
sizes;
never executed: return sizes;
0
1602-
1603 const int dpi = qt_defaultDpiY();-
1604-
1605 QtFontStyle::Key styleKey(styleName);-
1606 for (int j = 0; j < fam->count
j < fam->countDescription
TRUEnever evaluated
FALSEnever evaluated
; j++) {
0
1607 QtFontFoundry *foundry = fam->foundries[j];-
1608 if (foundryName.isEmpty()
foundryName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
foundry->name....ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1609 QtFontStyle *style = foundry->style(styleKey, styleName);-
1610 if (!style
!styleDescription
TRUEnever evaluated
FALSEnever evaluated
) continue;
never executed: continue;
0
1611-
1612 if (style->smoothScalable
style->smoothScalableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1613 smoothScalable = true;-
1614 goto
never executed: goto end;
end;
never executed: goto end;
0
1615 }-
1616 for (int l = 0; l < style->count
l < style->countDescription
TRUEnever evaluated
FALSEnever evaluated
; l++) {
0
1617 const QtFontSize *size = style->pixelSizes + l;-
1618-
1619 if (size->pixelSize != 0
size->pixelSize != 0Description
TRUEnever evaluated
FALSEnever evaluated
&& size->pixelSize != 0xffff
size->pixelSize != 0xffffDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1620 const uint pointSize = qRound(size->pixelSize * 72.0 / dpi);-
1621 if (! sizes.contains(pointSize)
! sizes.contains(pointSize)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1622 sizes.append(pointSize);
never executed: sizes.append(pointSize);
0
1623 }
never executed: end of block
0
1624 }
never executed: end of block
0
1625 }
never executed: end of block
0
1626 }
never executed: end of block
0
1627 end:
code before this statement never executed: end:
0
1628 if (smoothScalable
smoothScalableDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1629 return
never executed: return QFontDatabase::standardSizes();
QFontDatabase::standardSizes();
never executed: return QFontDatabase::standardSizes();
0
1630-
1631 std::sort(sizes.begin(), sizes.end());-
1632 return
never executed: return sizes;
sizes;
never executed: return sizes;
0
1633}-
1634-
1635-
1636-
1637-
1638-
1639-
1640-
1641QList<int> QFontDatabase::standardSizes()-
1642{-
1643 return
never executed: return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->standardSizes();
QGuiApplicationPrivate::platformIntegration()->fontDatabase()->standardSizes();
never executed: return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->standardSizes();
0
1644}-
1645bool QFontDatabase::italic(const QString &family, const QString &style) const-
1646{-
1647 QString familyName, foundryName;-
1648 parseFontName(family, foundryName, familyName);-
1649-
1650 QMutexLocker locker(fontDatabaseMutex());-
1651-
1652 ::load(familyName);-
1653-
1654 QtFontFoundry allStyles(foundryName);-
1655 QtFontFamily *f = d->family(familyName);-
1656 if (!f
!fDescription
TRUEnever evaluated
FALSEnever evaluated
) return
never executed: return false;
false;
never executed: return false;
0
1657-
1658 for (int j = 0; j < f->count
j < f->countDescription
TRUEnever evaluated
FALSEnever evaluated
; j++) {
0
1659 QtFontFoundry *foundry = f->foundries[j];-
1660 if (foundryName.isEmpty()
foundryName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
foundry->name....ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1661 for (int k = 0; k < foundry->count
k < foundry->countDescription
TRUEnever evaluated
FALSEnever evaluated
; k++)
0
1662 allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
never executed: allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
0
1663 }
never executed: end of block
0
1664 }
never executed: end of block
0
1665-
1666 QtFontStyle::Key styleKey(style);-
1667 QtFontStyle *s = allStyles.style(styleKey, style);-
1668 return
never executed: return s && s->key.style == QFont::StyleItalic;
s && s->key.style == QFont::StyleItalic;
never executed: return s && s->key.style == QFont::StyleItalic;
0
1669}-
1670bool QFontDatabase::bold(const QString &family,-
1671 const QString &style) const-
1672{-
1673 QString familyName, foundryName;-
1674 parseFontName(family, foundryName, familyName);-
1675-
1676 QMutexLocker locker(fontDatabaseMutex());-
1677-
1678 ::load(familyName);-
1679-
1680 QtFontFoundry allStyles(foundryName);-
1681 QtFontFamily *f = d->family(familyName);-
1682 if (!f
!fDescription
TRUEnever evaluated
FALSEnever evaluated
) return
never executed: return false;
false;
never executed: return false;
0
1683-
1684 for (int j = 0; j < f->count
j < f->countDescription
TRUEnever evaluated
FALSEnever evaluated
; j++) {
0
1685 QtFontFoundry *foundry = f->foundries[j];-
1686 if (foundryName.isEmpty()
foundryName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
||
0
1687 foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
foundry->name....ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1688 for (int k = 0; k < foundry->count
k < foundry->countDescription
TRUEnever evaluated
FALSEnever evaluated
; k++)
0
1689 allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
never executed: allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
0
1690 }
never executed: end of block
0
1691 }
never executed: end of block
0
1692-
1693 QtFontStyle::Key styleKey(style);-
1694 QtFontStyle *s = allStyles.style(styleKey, style);-
1695 return
never executed: return s && s->key.weight >= QFont::Bold;
s && s->key.weight >= QFont::Bold;
never executed: return s && s->key.weight >= QFont::Bold;
0
1696}-
1697int QFontDatabase::weight(const QString &family,-
1698 const QString &style) const-
1699{-
1700 QString familyName, foundryName;-
1701 parseFontName(family, foundryName, familyName);-
1702-
1703 QMutexLocker locker(fontDatabaseMutex());-
1704-
1705 ::load(familyName);-
1706-
1707 QtFontFoundry allStyles(foundryName);-
1708 QtFontFamily *f = d->family(familyName);-
1709 if (!f
!fDescription
TRUEnever evaluated
FALSEnever evaluated
) return
never executed: return -1;
-1;
never executed: return -1;
0
1710-
1711 for (int j = 0; j < f->count
j < f->countDescription
TRUEnever evaluated
FALSEnever evaluated
; j++) {
0
1712 QtFontFoundry *foundry = f->foundries[j];-
1713 if (foundryName.isEmpty()
foundryName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
||
0
1714 foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
foundry->name....ensitive) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1715 for (int k = 0; k < foundry->count
k < foundry->countDescription
TRUEnever evaluated
FALSEnever evaluated
; k++)
0
1716 allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
never executed: allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
0
1717 }
never executed: end of block
0
1718 }
never executed: end of block
0
1719-
1720 QtFontStyle::Key styleKey(style);-
1721 QtFontStyle *s = allStyles.style(styleKey, style);-
1722 return
never executed: return s ? s->key.weight : -1;
s ? s->key.weight : -1;
never executed: return s ? s->key.weight : -1;
0
1723}-
1724-
1725-
1726-
1727bool QFontDatabase::hasFamily(const QString &family) const-
1728{-
1729 QString parsedFamily, foundry;-
1730 parseFontName(family, foundry, parsedFamily);-
1731 const QString familyAlias = resolveFontFamilyAlias(parsedFamily);-
1732 return
never executed: return families().contains(familyAlias, Qt::CaseInsensitive);
families().contains(familyAlias, Qt::CaseInsensitive);
never executed: return families().contains(familyAlias, Qt::CaseInsensitive);
0
1733}-
1734bool QFontDatabase::isPrivateFamily(const QString &family) const-
1735{-
1736 return
never executed: return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->isPrivateFontFamily(family);
QGuiApplicationPrivate::platformIntegration()->fontDatabase()->isPrivateFontFamily(family);
never executed: return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->isPrivateFontFamily(family);
0
1737}-
1738-
1739-
1740-
1741-
1742-
1743-
1744QString QFontDatabase::writingSystemName(WritingSystem writingSystem)-
1745{-
1746 const char *name = 0;-
1747 switch (writingSystem) {-
1748 case
never executed: case Any:
Any:
never executed: case Any:
0
1749 name = "Any";-
1750 break;
never executed: break;
0
1751 case
never executed: case Latin:
Latin:
never executed: case Latin:
0
1752 name = "Latin";-
1753 break;
never executed: break;
0
1754 case
never executed: case Greek:
Greek:
never executed: case Greek:
0
1755 name = "Greek";-
1756 break;
never executed: break;
0
1757 case
never executed: case Cyrillic:
Cyrillic:
never executed: case Cyrillic:
0
1758 name = "Cyrillic";-
1759 break;
never executed: break;
0
1760 case
never executed: case Armenian:
Armenian:
never executed: case Armenian:
0
1761 name = "Armenian";-
1762 break;
never executed: break;
0
1763 case
never executed: case Hebrew:
Hebrew:
never executed: case Hebrew:
0
1764 name = "Hebrew";-
1765 break;
never executed: break;
0
1766 case
never executed: case Arabic:
Arabic:
never executed: case Arabic:
0
1767 name = "Arabic";-
1768 break;
never executed: break;
0
1769 case
never executed: case Syriac:
Syriac:
never executed: case Syriac:
0
1770 name = "Syriac";-
1771 break;
never executed: break;
0
1772 case
never executed: case Thaana:
Thaana:
never executed: case Thaana:
0
1773 name = "Thaana";-
1774 break;
never executed: break;
0
1775 case
never executed: case Devanagari:
Devanagari:
never executed: case Devanagari:
0
1776 name = "Devanagari";-
1777 break;
never executed: break;
0
1778 case
never executed: case Bengali:
Bengali:
never executed: case Bengali:
0
1779 name = "Bengali";-
1780 break;
never executed: break;
0
1781 case
never executed: case Gurmukhi:
Gurmukhi:
never executed: case Gurmukhi:
0
1782 name = "Gurmukhi";-
1783 break;
never executed: break;
0
1784 case
never executed: case Gujarati:
Gujarati:
never executed: case Gujarati:
0
1785 name = "Gujarati";-
1786 break;
never executed: break;
0
1787 case
never executed: case Oriya:
Oriya:
never executed: case Oriya:
0
1788 name = "Oriya";-
1789 break;
never executed: break;
0
1790 case
never executed: case Tamil:
Tamil:
never executed: case Tamil:
0
1791 name = "Tamil";-
1792 break;
never executed: break;
0
1793 case
never executed: case Telugu:
Telugu:
never executed: case Telugu:
0
1794 name = "Telugu";-
1795 break;
never executed: break;
0
1796 case
never executed: case Kannada:
Kannada:
never executed: case Kannada:
0
1797 name = "Kannada";-
1798 break;
never executed: break;
0
1799 case
never executed: case Malayalam:
Malayalam:
never executed: case Malayalam:
0
1800 name = "Malayalam";-
1801 break;
never executed: break;
0
1802 case
never executed: case Sinhala:
Sinhala:
never executed: case Sinhala:
0
1803 name = "Sinhala";-
1804 break;
never executed: break;
0
1805 case
never executed: case Thai:
Thai:
never executed: case Thai:
0
1806 name = "Thai";-
1807 break;
never executed: break;
0
1808 case
never executed: case Lao:
Lao:
never executed: case Lao:
0
1809 name = "Lao";-
1810 break;
never executed: break;
0
1811 case
never executed: case Tibetan:
Tibetan:
never executed: case Tibetan:
0
1812 name = "Tibetan";-
1813 break;
never executed: break;
0
1814 case
never executed: case Myanmar:
Myanmar:
never executed: case Myanmar:
0
1815 name = "Myanmar";-
1816 break;
never executed: break;
0
1817 case
never executed: case Georgian:
Georgian:
never executed: case Georgian:
0
1818 name = "Georgian";-
1819 break;
never executed: break;
0
1820 case
never executed: case Khmer:
Khmer:
never executed: case Khmer:
0
1821 name = "Khmer";-
1822 break;
never executed: break;
0
1823 case
never executed: case SimplifiedChinese:
SimplifiedChinese:
never executed: case SimplifiedChinese:
0
1824 name = "Simplified Chinese";-
1825 break;
never executed: break;
0
1826 case
never executed: case TraditionalChinese:
TraditionalChinese:
never executed: case TraditionalChinese:
0
1827 name = "Traditional Chinese";-
1828 break;
never executed: break;
0
1829 case
never executed: case Japanese:
Japanese:
never executed: case Japanese:
0
1830 name = "Japanese";-
1831 break;
never executed: break;
0
1832 case
never executed: case Korean:
Korean:
never executed: case Korean:
0
1833 name = "Korean";-
1834 break;
never executed: break;
0
1835 case
never executed: case Vietnamese:
Vietnamese:
never executed: case Vietnamese:
0
1836 name = "Vietnamese";-
1837 break;
never executed: break;
0
1838 case
never executed: case Symbol:
Symbol:
never executed: case Symbol:
0
1839 name = "Symbol";-
1840 break;
never executed: break;
0
1841 case
never executed: case Ogham:
Ogham:
never executed: case Ogham:
0
1842 name = "Ogham";-
1843 break;
never executed: break;
0
1844 case
never executed: case Runic:
Runic:
never executed: case Runic:
0
1845 name = "Runic";-
1846 break;
never executed: break;
0
1847 case
never executed: case Nko:
Nko:
never executed: case Nko:
0
1848 name = "N'Ko";-
1849 break;
never executed: break;
0
1850 default
never executed: default:
:
never executed: default:
0
1851 ((!(false)) ? qt_assert_x("QFontDatabase::writingSystemName", "invalid 'writingSystem' parameter",__FILE__,2172) : qt_noop());-
1852 break;
never executed: break;
0
1853 }-
1854 return
never executed: return QCoreApplication::translate("QFontDatabase", name);
QCoreApplication::translate("QFontDatabase", name);
never executed: return QCoreApplication::translate("QFontDatabase", name);
0
1855}-
1856-
1857-
1858-
1859-
1860-
1861QString QFontDatabase::writingSystemSample(WritingSystem writingSystem)-
1862{-
1863 QString sample;-
1864 switch (writingSystem) {-
1865 case
never executed: case Any:
Any:
never executed: case Any:
0
1866 case
never executed: case Symbol:
Symbol:
never executed: case Symbol:
0
1867-
1868 sample += QLatin1String("AaBbzZ");-
1869 break;
never executed: break;
0
1870 case
never executed: case Latin:
Latin:
never executed: case Latin:
0
1871-
1872-
1873 sample = QLatin1String("Aa");-
1874 sample += QChar(0x00C3);-
1875 sample += QChar(0x00E1);-
1876 sample += QLatin1String("Zz");-
1877 break;
never executed: break;
0
1878 case
never executed: case Greek:
Greek:
never executed: case Greek:
0
1879 sample += QChar(0x0393);-
1880 sample += QChar(0x03B1);-
1881 sample += QChar(0x03A9);-
1882 sample += QChar(0x03C9);-
1883 break;
never executed: break;
0
1884 case
never executed: case Cyrillic:
Cyrillic:
never executed: case Cyrillic:
0
1885 sample += QChar(0x0414);-
1886 sample += QChar(0x0434);-
1887 sample += QChar(0x0436);-
1888 sample += QChar(0x044f);-
1889 break;
never executed: break;
0
1890 case
never executed: case Armenian:
Armenian:
never executed: case Armenian:
0
1891 sample += QChar(0x053f);-
1892 sample += QChar(0x054f);-
1893 sample += QChar(0x056f);-
1894 sample += QChar(0x057f);-
1895 break;
never executed: break;
0
1896 case
never executed: case Hebrew:
Hebrew:
never executed: case Hebrew:
0
1897 sample += QChar(0x05D0);-
1898 sample += QChar(0x05D1);-
1899 sample += QChar(0x05D2);-
1900 sample += QChar(0x05D3);-
1901 break;
never executed: break;
0
1902 case
never executed: case Arabic:
Arabic:
never executed: case Arabic:
0
1903 sample += QChar(0x0628);-
1904 sample += QChar(0x0629);-
1905 sample += QChar(0x062A);-
1906 sample += QChar(0x063A);-
1907 break;
never executed: break;
0
1908 case
never executed: case Syriac:
Syriac:
never executed: case Syriac:
0
1909 sample += QChar(0x0715);-
1910 sample += QChar(0x0725);-
1911 sample += QChar(0x0716);-
1912 sample += QChar(0x0726);-
1913 break;
never executed: break;
0
1914 case
never executed: case Thaana:
Thaana:
never executed: case Thaana:
0
1915 sample += QChar(0x0784);-
1916 sample += QChar(0x0794);-
1917 sample += QChar(0x078c);-
1918 sample += QChar(0x078d);-
1919 break;
never executed: break;
0
1920 case
never executed: case Devanagari:
Devanagari:
never executed: case Devanagari:
0
1921 sample += QChar(0x0905);-
1922 sample += QChar(0x0915);-
1923 sample += QChar(0x0925);-
1924 sample += QChar(0x0935);-
1925 break;
never executed: break;
0
1926 case
never executed: case Bengali:
Bengali:
never executed: case Bengali:
0
1927 sample += QChar(0x0986);-
1928 sample += QChar(0x0996);-
1929 sample += QChar(0x09a6);-
1930 sample += QChar(0x09b6);-
1931 break;
never executed: break;
0
1932 case
never executed: case Gurmukhi:
Gurmukhi:
never executed: case Gurmukhi:
0
1933 sample += QChar(0x0a05);-
1934 sample += QChar(0x0a15);-
1935 sample += QChar(0x0a25);-
1936 sample += QChar(0x0a35);-
1937 break;
never executed: break;
0
1938 case
never executed: case Gujarati:
Gujarati:
never executed: case Gujarati:
0
1939 sample += QChar(0x0a85);-
1940 sample += QChar(0x0a95);-
1941 sample += QChar(0x0aa5);-
1942 sample += QChar(0x0ab5);-
1943 break;
never executed: break;
0
1944 case
never executed: case Oriya:
Oriya:
never executed: case Oriya:
0
1945 sample += QChar(0x0b06);-
1946 sample += QChar(0x0b16);-
1947 sample += QChar(0x0b2b);-
1948 sample += QChar(0x0b36);-
1949 break;
never executed: break;
0
1950 case
never executed: case Tamil:
Tamil:
never executed: case Tamil:
0
1951 sample += QChar(0x0b89);-
1952 sample += QChar(0x0b99);-
1953 sample += QChar(0x0ba9);-
1954 sample += QChar(0x0bb9);-
1955 break;
never executed: break;
0
1956 case
never executed: case Telugu:
Telugu:
never executed: case Telugu:
0
1957 sample += QChar(0x0c05);-
1958 sample += QChar(0x0c15);-
1959 sample += QChar(0x0c25);-
1960 sample += QChar(0x0c35);-
1961 break;
never executed: break;
0
1962 case
never executed: case Kannada:
Kannada:
never executed: case Kannada:
0
1963 sample += QChar(0x0c85);-
1964 sample += QChar(0x0c95);-
1965 sample += QChar(0x0ca5);-
1966 sample += QChar(0x0cb5);-
1967 break;
never executed: break;
0
1968 case
never executed: case Malayalam:
Malayalam:
never executed: case Malayalam:
0
1969 sample += QChar(0x0d05);-
1970 sample += QChar(0x0d15);-
1971 sample += QChar(0x0d25);-
1972 sample += QChar(0x0d35);-
1973 break;
never executed: break;
0
1974 case
never executed: case Sinhala:
Sinhala:
never executed: case Sinhala:
0
1975 sample += QChar(0x0d90);-
1976 sample += QChar(0x0da0);-
1977 sample += QChar(0x0db0);-
1978 sample += QChar(0x0dc0);-
1979 break;
never executed: break;
0
1980 case
never executed: case Thai:
Thai:
never executed: case Thai:
0
1981 sample += QChar(0x0e02);-
1982 sample += QChar(0x0e12);-
1983 sample += QChar(0x0e22);-
1984 sample += QChar(0x0e32);-
1985 break;
never executed: break;
0
1986 case
never executed: case Lao:
Lao:
never executed: case Lao:
0
1987 sample += QChar(0x0e8d);-
1988 sample += QChar(0x0e9d);-
1989 sample += QChar(0x0ead);-
1990 sample += QChar(0x0ebd);-
1991 break;
never executed: break;
0
1992 case
never executed: case Tibetan:
Tibetan:
never executed: case Tibetan:
0
1993 sample += QChar(0x0f00);-
1994 sample += QChar(0x0f01);-
1995 sample += QChar(0x0f02);-
1996 sample += QChar(0x0f03);-
1997 break;
never executed: break;
0
1998 case
never executed: case Myanmar:
Myanmar:
never executed: case Myanmar:
0
1999 sample += QChar(0x1000);-
2000 sample += QChar(0x1001);-
2001 sample += QChar(0x1002);-
2002 sample += QChar(0x1003);-
2003 break;
never executed: break;
0
2004 case
never executed: case Georgian:
Georgian:
never executed: case Georgian:
0
2005 sample += QChar(0x10a0);-
2006 sample += QChar(0x10b0);-
2007 sample += QChar(0x10c0);-
2008 sample += QChar(0x10d0);-
2009 break;
never executed: break;
0
2010 case
never executed: case Khmer:
Khmer:
never executed: case Khmer:
0
2011 sample += QChar(0x1780);-
2012 sample += QChar(0x1790);-
2013 sample += QChar(0x17b0);-
2014 sample += QChar(0x17c0);-
2015 break;
never executed: break;
0
2016 case
never executed: case SimplifiedChinese:
SimplifiedChinese:
never executed: case SimplifiedChinese:
0
2017 sample += QChar(0x4e2d);-
2018 sample += QChar(0x6587);-
2019 sample += QChar(0x8303);-
2020 sample += QChar(0x4f8b);-
2021 break;
never executed: break;
0
2022 case
never executed: case TraditionalChinese:
TraditionalChinese:
never executed: case TraditionalChinese:
0
2023 sample += QChar(0x4e2d);-
2024 sample += QChar(0x6587);-
2025 sample += QChar(0x7bc4);-
2026 sample += QChar(0x4f8b);-
2027 break;
never executed: break;
0
2028 case
never executed: case Japanese:
Japanese:
never executed: case Japanese:
0
2029 sample += QChar(0x30b5);-
2030 sample += QChar(0x30f3);-
2031 sample += QChar(0x30d7);-
2032 sample += QChar(0x30eb);-
2033 sample += QChar(0x3067);-
2034 sample += QChar(0x3059);-
2035 break;
never executed: break;
0
2036 case
never executed: case Korean:
Korean:
never executed: case Korean:
0
2037 sample += QChar(0xac00);-
2038 sample += QChar(0xac11);-
2039 sample += QChar(0xac1a);-
2040 sample += QChar(0xac2f);-
2041 break;
never executed: break;
0
2042 case
never executed: case Vietnamese:
Vietnamese:
never executed: case Vietnamese:
0
2043 {-
2044 static const char vietnameseUtf8[] = {-
2045 char(0xef), char(0xbb), char(0xbf), char(0xe1), char(0xbb), char(0x97),-
2046 char(0xe1), char(0xbb), char(0x99),-
2047 char(0xe1), char(0xbb), char(0x91),-
2048 char(0xe1), char(0xbb), char(0x93),-
2049 };-
2050 sample += QString::fromUtf8(vietnameseUtf8, sizeof(vietnameseUtf8));-
2051 break;
never executed: break;
0
2052 }-
2053 case
never executed: case Ogham:
Ogham:
never executed: case Ogham:
0
2054 sample += QChar(0x1681);-
2055 sample += QChar(0x1682);-
2056 sample += QChar(0x1683);-
2057 sample += QChar(0x1684);-
2058 break;
never executed: break;
0
2059 case
never executed: case Runic:
Runic:
never executed: case Runic:
0
2060 sample += QChar(0x16a0);-
2061 sample += QChar(0x16a1);-
2062 sample += QChar(0x16a2);-
2063 sample += QChar(0x16a3);-
2064 break;
never executed: break;
0
2065 case
never executed: case Nko:
Nko:
never executed: case Nko:
0
2066 sample += QChar(0x7ca);-
2067 sample += QChar(0x7cb);-
2068 sample += QChar(0x7cc);-
2069 sample += QChar(0x7cd);-
2070 break;
never executed: break;
0
2071 default
never executed: default:
:
never executed: default:
0
2072 break;
never executed: break;
0
2073 }-
2074 return
never executed: return sample;
sample;
never executed: return sample;
0
2075}-
2076-
2077-
2078void QFontDatabase::parseFontName(const QString &name, QString &foundry, QString &family)-
2079{-
2080 ::parseFontName(name, foundry, family);-
2081}
never executed: end of block
0
2082-
2083void QFontDatabase::createDatabase()-
2084{ initializeDb(); }
never executed: end of block
0
2085-
2086-
2087__attribute__((visibility("default"))) QByteArray qt_fontdata_from_index(int index)-
2088{-
2089 QMutexLocker locker(fontDatabaseMutex());-
2090 return
never executed: return privateDb()->applicationFonts.value(index).data;
privateDb()->applicationFonts.value(index).data;
never executed: return privateDb()->applicationFonts.value(index).data;
0
2091}-
2092-
2093int QFontDatabasePrivate::addAppFont(const QByteArray &fontData, const QString &fileName)-
2094{-
2095 QFontDatabasePrivate::ApplicationFont font;-
2096 font.data = fontData;-
2097 font.fileName = fileName;-
2098-
2099 int i;-
2100 for (i = 0; i < applicationFonts.count()
i < applicationFonts.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
2101 if (applicationFonts.at(i).families.isEmpty()
applicationFon...lies.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2102 break;
never executed: break;
0
2103 if (i >= applicationFonts.count()
i >= applicationFonts.count()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2104 applicationFonts.append(ApplicationFont());-
2105 i = applicationFonts.count() - 1;-
2106 }
never executed: end of block
0
2107-
2108 if (font.fileName.isEmpty()
font.fileName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& !fontData.isEmpty()
!fontData.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2109 font.fileName = QString::fromLatin1(":qmemoryfonts/") + QString::number(i);
never executed: font.fileName = QString::fromLatin1(":qmemoryfonts/") + QString::number(i);
0
2110-
2111 registerFont(&font);-
2112 if (font.families.isEmpty()
font.families.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2113 return
never executed: return -1;
-1;
never executed: return -1;
0
2114-
2115 applicationFonts[i] = font;-
2116-
2117 invalidate();-
2118 return
never executed: return i;
i;
never executed: return i;
0
2119}-
2120-
2121bool QFontDatabasePrivate::isApplicationFont(const QString &fileName)-
2122{-
2123 for (int i = 0; i < applicationFonts.count()
i < applicationFonts.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
2124 if (applicationFonts.at(i).fileName == fileName
applicationFon...me == fileNameDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2125 return
never executed: return true;
true;
never executed: return true;
0
2126 return
never executed: return false;
false;
never executed: return false;
0
2127}-
2128int QFontDatabase::addApplicationFont(const QString &fileName)-
2129{-
2130 QByteArray data;-
2131 if (!QFileInfo(fileName).isNativePath()
!QFileInfo(fil...isNativePath()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2132 QFile f(fileName);-
2133 if (!f.open(QIODevice::ReadOnly)
!f.open(QIODevice::ReadOnly)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2134 return
never executed: return -1;
-1;
never executed: return -1;
0
2135 data = f.readAll();-
2136 }
never executed: end of block
0
2137 QMutexLocker locker(fontDatabaseMutex());-
2138 return
never executed: return privateDb()->addAppFont(data, fileName);
privateDb()->addAppFont(data, fileName);
never executed: return privateDb()->addAppFont(data, fileName);
0
2139}-
2140int QFontDatabase::addApplicationFontFromData(const QByteArray &fontData)-
2141{-
2142 QMutexLocker locker(fontDatabaseMutex());-
2143 return
never executed: return privateDb()->addAppFont(fontData, QString() );
privateDb()->addAppFont(fontData, QString() );
never executed: return privateDb()->addAppFont(fontData, QString() );
0
2144}-
2145QStringList QFontDatabase::applicationFontFamilies(int id)-
2146{-
2147 QMutexLocker locker(fontDatabaseMutex());-
2148 return
never executed: return privateDb()->applicationFonts.value(id).families;
privateDb()->applicationFonts.value(id).families;
never executed: return privateDb()->applicationFonts.value(id).families;
0
2149}-
2150QFont QFontDatabase::systemFont(QFontDatabase::SystemFont type)-
2151{-
2152 const QFont *font = 0;-
2153 if (const
const QPlatfor...latformTheme()Description
TRUEnever evaluated
FALSEnever evaluated
QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()
const QPlatfor...latformTheme()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2154 switch (type) {-
2155 case
never executed: case GeneralFont:
GeneralFont:
never executed: case GeneralFont:
0
2156 font = theme->font(QPlatformTheme::SystemFont);-
2157 break;
never executed: break;
0
2158 case
never executed: case FixedFont:
FixedFont:
never executed: case FixedFont:
0
2159 font = theme->font(QPlatformTheme::FixedFont);-
2160 break;
never executed: break;
0
2161 case
never executed: case TitleFont:
TitleFont:
never executed: case TitleFont:
0
2162 font = theme->font(QPlatformTheme::TitleBarFont);-
2163 break;
never executed: break;
0
2164 case
never executed: case SmallestReadableFont:
SmallestReadableFont:
never executed: case SmallestReadableFont:
0
2165 font = theme->font(QPlatformTheme::MiniFont);-
2166 break;
never executed: break;
0
2167 }-
2168 }
never executed: end of block
0
2169-
2170 if (font
fontDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2171 return
never executed: return *font;
*font;
never executed: return *font;
0
2172 else if (QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration()
QPlatformInteg...mIntegration()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2173 return
never executed: return integration->fontDatabase()->defaultFont();
integration->fontDatabase()->defaultFont();
never executed: return integration->fontDatabase()->defaultFont();
0
2174 else-
2175 return
never executed: return QFont();
QFont();
never executed: return QFont();
0
2176}-
2177bool QFontDatabase::removeApplicationFont(int handle)-
2178{-
2179 QMutexLocker locker(fontDatabaseMutex());-
2180-
2181 QFontDatabasePrivate *db = privateDb();-
2182 if (handle < 0
handle < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| handle >= db->applicationFonts.count()
handle >= db->...nFonts.count()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2183 return
never executed: return false;
false;
never executed: return false;
0
2184-
2185 db->applicationFonts[handle] = QFontDatabasePrivate::ApplicationFont();-
2186-
2187 db->reregisterAppFonts = true;-
2188 db->invalidate();-
2189 return
never executed: return true;
true;
never executed: return true;
0
2190}-
2191bool QFontDatabase::removeAllApplicationFonts()-
2192{-
2193 QMutexLocker locker(fontDatabaseMutex());-
2194-
2195 QFontDatabasePrivate *db = privateDb();-
2196 if (db->applicationFonts.isEmpty()
db->applicationFonts.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2197 return
never executed: return false;
false;
never executed: return false;
0
2198-
2199 db->applicationFonts.clear();-
2200 db->invalidate();-
2201 return
never executed: return true;
true;
never executed: return true;
0
2202}-
2203bool QFontDatabase::supportsThreadedFontRendering()-
2204{-
2205 return
never executed: return true;
true;
never executed: return true;
0
2206}-
2207-
2208-
2209-
2210-
2211-
2212QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)-
2213{-
2214 QMutexLocker locker(fontDatabaseMutex());-
2215-
2216 if (!privateDb()->count
!privateDb()->countDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2217 initializeDb();
never executed: initializeDb();
0
2218-
2219 QFontEngine *engine;-
2220-
2221-
2222-
2223 if (qt_enable_test_font
qt_enable_test_fontDescription
TRUEnever evaluated
FALSEnever evaluated
&& request.family == QLatin1String("__Qt__Box__Engine__")
request.family...ox__Engine__")Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2224 engine = new QTestFontEngine(request.pixelSize);-
2225 engine->fontDef = request;-
2226 return
never executed: return engine;
engine;
never executed: return engine;
0
2227 }-
2228-
2229-
2230 QFontCache *fontCache = QFontCache::instance();-
2231-
2232-
2233-
2234-
2235 bool multi = !(request.styleStrategy & QFont::NoFontMerging);-
2236 QFontCache::Key key(request, script, multi ? 1 : 0);-
2237 engine = fontCache->findEngine(key);-
2238 if (engine
engineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2239 if (false) QMessageLogger(__FILE__, 2657, __PRETTY_FUNCTION__).debug("Cache hit level 1");
dead code: QMessageLogger(__FILE__, 2657, __PRETTY_FUNCTION__).debug("Cache hit level 1");
-
2240 return
never executed: return engine;
engine;
never executed: return engine;
0
2241 }-
2242-
2243 QString family_name, foundry_name;-
2244-
2245 parseFontName(request.family, foundry_name, family_name);-
2246-
2247 QtFontDesc desc;-
2248 QList<int> blackListed;-
2249 int index = match(multi ? QChar::Script_Common : script, request, family_name, foundry_name, &desc, blackListed);-
2250 if (index >= 0
index >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2251 engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size);-
2252 if (engine
engineDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2253 initFontDef(desc, request, &engine->fontDef, multi);
never executed: initFontDef(desc, request, &engine->fontDef, multi);
0
2254 else-
2255 blackListed.append(index);
never executed: blackListed.append(index);
0
2256 } else {-
2257 if (false) QMessageLogger(__FILE__, 2675, __PRETTY_FUNCTION__).debug(" NO MATCH FOUND\n");
dead code: QMessageLogger(__FILE__, 2675, __PRETTY_FUNCTION__).debug(" NO MATCH FOUND\n");
-
2258 }
never executed: end of block
0
2259-
2260 if (!engine
!engineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2261 if (!request.family.isEmpty()
!request.family.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2262 QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);-
2263 if (styleHint == QFont::AnyStyle
styleHint == QFont::AnyStyleDescription
TRUEnever evaluated
FALSEnever evaluated
&& request.fixedPitch
request.fixedPitchDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2264 styleHint = QFont::TypeWriter;
never executed: styleHint = QFont::TypeWriter;
0
2265-
2266 QStringList fallbacks = request.fallBackFamilies-
2267 + fallbacksForFamily(request.family,-
2268 QFont::Style(request.style),-
2269 styleHint,-
2270 QChar::Script(script));-
2271 if (script > QChar::Script_Common
script > QChar::Script_CommonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2272 fallbacks += QString();
never executed: fallbacks += QString();
0
2273-
2274 for (int i = 0; !engine
!engineDescription
TRUEnever evaluated
FALSEnever evaluated
&& i < fallbacks.size()
i < fallbacks.size()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
2275 QFontDef def = request;-
2276 def.family = fallbacks.at(i);-
2277 QFontCache::Key key(def, script, multi ? 1 : 0);-
2278 engine = fontCache->findEngine(key);-
2279 if (!engine
!engineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2280 QtFontDesc desc;-
2281 do {-
2282 index = match(multi ? QChar::Script_Common : script, def, def.family, QLatin1String(""), &desc, blackListed);-
2283 if (index >= 0
index >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2284 QFontDef loadDef = def;-
2285 if (loadDef.family.isEmpty()
loadDef.family.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2286 loadDef.family = desc.family->name;
never executed: loadDef.family = desc.family->name;
0
2287 engine = loadEngine(script, loadDef, desc.family, desc.foundry, desc.style, desc.size);-
2288 if (engine
engineDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2289 initFontDef(desc, loadDef, &engine->fontDef, multi);
never executed: initFontDef(desc, loadDef, &engine->fontDef, multi);
0
2290 else-
2291 blackListed.append(index);
never executed: blackListed.append(index);
0
2292 }-
2293 }
never executed: end of block
while (index >= 0
index >= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& !engine
!engineDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
2294 }
never executed: end of block
0
2295 }
never executed: end of block
0
2296 }
never executed: end of block
0
2297-
2298 if (!engine
!engineDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2299 engine = new QFontEngineBox(request.pixelSize);
never executed: engine = new QFontEngineBox(request.pixelSize);
0
2300-
2301 if (false) QMessageLogger(__FILE__, 2719, __PRETTY_FUNCTION__).debug("returning box engine");
dead code: QMessageLogger(__FILE__, 2719, __PRETTY_FUNCTION__).debug("returning box engine");
-
2302 }
never executed: end of block
0
2303-
2304 return
never executed: return engine;
engine;
never executed: return engine;
0
2305}-
2306-
2307void QFontDatabase::load(const QFontPrivate *d, int script)-
2308{-
2309 QFontDef req = d->request;-
2310-
2311 if (req.pixelSize == -1
req.pixelSize == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2312 req.pixelSize = std::floor(((req.pointSize * d->dpi) / 72) * 100 + 0.5) / 100;-
2313 req.pixelSize = qRound(req.pixelSize);-
2314 }
never executed: end of block
0
2315 if (req.pointSize < 0
req.pointSize < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2316 req.pointSize = req.pixelSize*72.0/d->dpi;
never executed: req.pointSize = req.pixelSize*72.0/d->dpi;
0
2317 if (req.stretch == 0
req.stretch == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2318 req.stretch = 100;
never executed: req.stretch = 100;
0
2319-
2320-
2321 const QStringList fallBackFamilies = familyList(req);-
2322-
2323 if (!d->engineData
!d->engineDataDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2324 QFontCache *fontCache = QFontCache::instance();-
2325-
2326-
2327-
2328 req.family = fallBackFamilies.join(QLatin1Char(','));-
2329-
2330 d->engineData = fontCache->findEngineData(req);-
2331 if (!d->engineData
!d->engineDataDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2332-
2333 d->engineData = new QFontEngineData;-
2334 fontCache->insertEngineData(req, d->engineData);-
2335 }
never executed: end of block
0
2336 d->engineData->ref.ref();-
2337 }
never executed: end of block
0
2338-
2339-
2340 if (d->engineData->engines[script]
d->engineData->engines[script]Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2341 return;
never executed: return;
0
2342-
2343 QFontEngine *fe = nullptr;-
2344-
2345 req.fallBackFamilies = fallBackFamilies;-
2346 if (!req.fallBackFamilies.isEmpty()
!req.fallBackF...lies.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2347 req.family = req.fallBackFamilies.takeFirst();
never executed: req.family = req.fallBackFamilies.takeFirst();
0
2348-
2349-
2350 QStringList family_list;-
2351-
2352 if (!req.family.isEmpty()
!req.family.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2353-
2354 family_list << req.family;-
2355-
2356-
2357 QString defaultFamily = QGuiApplication::font().family();-
2358 if (! family_list.contains(defaultFamily)
! family_list....defaultFamily)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2359 family_list << defaultFamily;
never executed: family_list << defaultFamily;
0
2360-
2361 }
never executed: end of block
0
2362-
2363-
2364 family_list << QString();-
2365-
2366 QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd();-
2367 for (; !fe
!feDescription
TRUEnever evaluated
FALSEnever evaluated
&& it != end
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
2368 req.family = *it;-
2369-
2370 fe = QFontDatabase::findFont(req, script);-
2371 if (fe
feDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2372 if (fe->type() == QFontEngine::Box
fe->type() == QFontEngine::BoxDescription
TRUEnever evaluated
FALSEnever evaluated
&& !req.family.isEmpty()
!req.family.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2373 if (fe->ref.load() == 0
fe->ref.load() == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2374 delete fe;
never executed: delete fe;
0
2375 fe = 0;-
2376 }
never executed: end of block
else {
0
2377 if (d->dpi > 0
d->dpi > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2378 fe->fontDef.pointSize = qreal(double((fe->fontDef.pixelSize * 72) / d->dpi));
never executed: fe->fontDef.pointSize = qreal(double((fe->fontDef.pixelSize * 72) / d->dpi));
0
2379 }
never executed: end of block
0
2380 }-
2381-
2382-
2383 req.fallBackFamilies.clear();-
2384 }
never executed: end of block
0
2385-
2386 ((!(fe)) ? qt_assert("fe",__FILE__,2804) : qt_noop());-
2387 if (fe->symbol
fe->symbolDescription
TRUEnever evaluated
FALSEnever evaluated
|| (
(d->request.st...NoFontMerging)Description
TRUEnever evaluated
FALSEnever evaluated
d->request.styleStrategy & QFont::NoFontMerging)
(d->request.st...NoFontMerging)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2388 for (int i = 0; i < QChar::ScriptCount
i < QChar::ScriptCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
2389 if (!d->engineData->engines[i]
!d->engineData->engines[i]Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2390 d->engineData->engines[i] = fe;-
2391 fe->ref.ref();-
2392 }
never executed: end of block
0
2393 }
never executed: end of block
0
2394 }
never executed: end of block
else {
0
2395 d->engineData->engines[script] = fe;-
2396 fe->ref.ref();-
2397 }
never executed: end of block
0
2398}-
2399-
2400QString QFontDatabase::resolveFontFamilyAlias(const QString &family)-
2401{-
2402 return
never executed: return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->resolveFontFamilyAlias(family);
QGuiApplicationPrivate::platformIntegration()->fontDatabase()->resolveFontFamilyAlias(family);
never executed: return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->resolveFontFamilyAlias(family);
0
2403}-
2404-
2405-
2406-
Switch to Source codePreprocessed file

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