text/qfontdatabase.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qfontdatabase.h" -
43#include "qdebug.h" -
44#include "qalgorithms.h" -
45#include "qguiapplication.h" -
46#include "qvarlengtharray.h" // here or earlier - workaround for VC++6 -
47#include "qthread.h" -
48#include "qmutex.h" -
49#include "qfile.h" -
50#include "qfileinfo.h" -
51#include "private/qunicodetables_p.h" -
52#include "qfontengine_p.h" -
53#include <qpa/qplatformintegration.h> -
54 -
55#include <QtGui/private/qguiapplication_p.h> -
56#include <qpa/qplatformfontdatabase.h> -
57 -
58#include <stdlib.h> -
59#include <limits.h> -
60 -
61 -
62// #define QFONTDATABASE_DEBUG -
63#ifdef QFONTDATABASE_DEBUG -
64# define FD_DEBUG qDebug -
65#else -
66# define FD_DEBUG if (false) qDebug -
67#endif -
68 -
69// #define FONT_MATCH_DEBUG -
70#ifdef FONT_MATCH_DEBUG -
71# define FM_DEBUG qDebug -
72#else -
73# define FM_DEBUG if (false) qDebug -
74#endif -
75 -
76 -
77QT_BEGIN_NAMESPACE -
78 -
79#define SMOOTH_SCALABLE 0xffff -
80 -
81bool qt_enable_test_font = false; -
82 -
83Q_AUTOTEST_EXPORT void qt_setQtEnableTestFont(bool value) -
84{ -
85 qt_enable_test_font = value;
never executed (the execution status of this line is deduced): qt_enable_test_font = value;
-
86}
never executed: }
0
87 -
88static int getFontWeight(const QString &weightString) -
89{ -
90 QString s = weightString.toLower();
executed (the execution status of this line is deduced): QString s = weightString.toLower();
-
91 -
92 // Test in decreasing order of commonness -
93 if (s == QLatin1String("medium") ||
evaluated: s == QLatin1String("medium")
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:2124
36-2124
94 s == QLatin1String("normal")
evaluated: s == QLatin1String("normal")
TRUEFALSE
yes
Evaluation Count:106
yes
Evaluation Count:2018
106-2018
95 || s.compare(QCoreApplication::translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0)
partially evaluated: s.compare(QCoreApplication::translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2018
0-2018
96 return QFont::Normal;
executed: return QFont::Normal;
Execution Count:142
142
97 if (s == QLatin1String("bold")
evaluated: s == QLatin1String("bold")
TRUEFALSE
yes
Evaluation Count:131
yes
Evaluation Count:1887
131-1887
98 || s.compare(QCoreApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0)
partially evaluated: s.compare(QCoreApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1887
0-1887
99 return QFont::Bold;
executed: return QFont::Bold;
Execution Count:131
131
100 if (s == QLatin1String("demibold") || s == QLatin1String("demi bold")
partially evaluated: s == QLatin1String("demibold")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1887
evaluated: s == QLatin1String("demi bold")
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:1876
0-1887
101 || s.compare(QCoreApplication::translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0)
partially evaluated: s.compare(QCoreApplication::translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1876
0-1876
102 return QFont::DemiBold;
executed: return QFont::DemiBold;
Execution Count:11
11
103 if (s == QLatin1String("black")
partially evaluated: s == QLatin1String("black")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1876
0-1876
104 || s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
partially evaluated: s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1876
0-1876
105 return QFont::Black;
never executed: return QFont::Black;
0
106 if (s == QLatin1String("light"))
evaluated: s == QLatin1String("light")
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1873
3-1873
107 return QFont::Light;
executed: return QFont::Light;
Execution Count:3
3
108 -
109 if (s.contains(QLatin1String("bold"))
evaluated: s.contains(QLatin1String("bold"))
TRUEFALSE
yes
Evaluation Count:248
yes
Evaluation Count:1625
248-1625
110 || s.contains(QCoreApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)) {
partially evaluated: s.contains(QCoreApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1625
0-1625
111 if (s.contains(QLatin1String("demi"))
evaluated: s.contains(QLatin1String("demi"))
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:244
4-244
112 || s.compare(QCoreApplication::translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0)
partially evaluated: s.compare(QCoreApplication::translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:244
0-244
113 return (int) QFont::DemiBold;
executed: return (int) QFont::DemiBold;
Execution Count:4
4
114 return (int) QFont::Bold;
executed: return (int) QFont::Bold;
Execution Count:244
244
115 } -
116 -
117 if (s.contains(QLatin1String("light"))
evaluated: s.contains(QLatin1String("light"))
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1618
7-1618
118 || s.compare(QCoreApplication::translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0)
partially evaluated: s.compare(QCoreApplication::translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1618
0-1618
119 return (int) QFont::Light;
executed: return (int) QFont::Light;
Execution Count:7
7
120 -
121 if (s.contains(QLatin1String("black"))
partially evaluated: s.contains(QLatin1String("black"))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1618
0-1618
122 || s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
partially evaluated: s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1618
0-1618
123 return (int) QFont::Black;
never executed: return (int) QFont::Black;
0
124 -
125 return (int) QFont::Normal;
executed: return (int) QFont::Normal;
Execution Count:1618
1618
126} -
127 -
128// convert 0 ~ 1000 integer to QFont::Weight -
129QFont::Weight weightFromInteger(int weight) -
130{ -
131 if (weight < 400)
never evaluated: weight < 400
0
132 return QFont::Light;
never executed: return QFont::Light;
0
133 else if (weight < 600)
never evaluated: weight < 600
0
134 return QFont::Normal;
never executed: return QFont::Normal;
0
135 else if (weight < 700)
never evaluated: weight < 700
0
136 return QFont::DemiBold;
never executed: return QFont::DemiBold;
0
137 else if (weight < 800)
never evaluated: weight < 800
0
138 return QFont::Bold;
never executed: return QFont::Bold;
0
139 else -
140 return QFont::Black;
never executed: return QFont::Black;
0
141} -
142 -
143struct QtFontEncoding -
144{ -
145 signed int encoding : 16; -
146 -
147 uint xpoint : 16; -
148 uint xres : 8; -
149 uint yres : 8; -
150 uint avgwidth : 16; -
151 uchar pitch : 8; -
152}; -
153 -
154struct QtFontSize -
155{ -
156 -
157 void *handle; -
158 -
159 unsigned short pixelSize : 16; -
160}; -
161 -
162 -
163 -
164struct QtFontStyle -
165{ -
166 struct Key { -
167 Key(const QString &styleString); -
168 Key() : style(QFont::StyleNormal), -
169 weight(QFont::Normal), stretch(0) { }
executed: }
Execution Count:52580
52580
170 Key(const Key &o) : style(o.style), weight(o.weight), stretch(o.stretch) { }
executed: }
Execution Count:40323
40323
171 uint style : 2; -
172 signed int weight : 8; -
173 signed int stretch : 12; -
174 -
175 bool operator==(const Key & other) { -
176 return (style == other.style && weight == other.weight &&
executed: return (style == other.style && weight == other.weight && (stretch == 0 || other.stretch == 0 || stretch == other.stretch));
Execution Count:3202
3202
177 (stretch == 0 || other.stretch == 0 || stretch == other.stretch));
executed: return (style == other.style && weight == other.weight && (stretch == 0 || other.stretch == 0 || stretch == other.stretch));
Execution Count:3202
3202
178 } -
179 bool operator!=(const Key &other) { -
180 return !operator==(other);
executed: return !operator==(other);
Execution Count:891
891
181 } -
182 bool operator <(const Key &o) { -
183 int x = (style << 12) + (weight << 14) + stretch;
never executed (the execution status of this line is deduced): int x = (style << 12) + (weight << 14) + stretch;
-
184 int y = (o.style << 12) + (o.weight << 14) + o.stretch;
never executed (the execution status of this line is deduced): int y = (o.style << 12) + (o.weight << 14) + o.stretch;
-
185 return (x < y);
never executed: return (x < y);
0
186 } -
187 }; -
188 -
189 QtFontStyle(const Key &k) -
190 : key(k), bitmapScalable(false), smoothScalable(false), -
191 count(0), pixelSizes(0) -
192 { -
193 }
executed: }
Execution Count:38680
38680
194 -
195 ~QtFontStyle() { -
196 while (count) {
evaluated: count
TRUEFALSE
yes
Evaluation Count:35371
yes
Evaluation Count:38680
35371-38680
197 // bitfield count-- in while condition does not work correctly in mwccsym2 -
198 count--;
executed (the execution status of this line is deduced): count--;
-
199 QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();
executed (the execution status of this line is deduced): QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();
-
200 if (integration) {
partially evaluated: integration
TRUEFALSE
yes
Evaluation Count:35371
no
Evaluation Count:0
0-35371
201 integration->fontDatabase()->releaseHandle(pixelSizes[count].handle);
executed (the execution status of this line is deduced): integration->fontDatabase()->releaseHandle(pixelSizes[count].handle);
-
202 }
executed: }
Execution Count:35371
35371
203 }
executed: }
Execution Count:35371
35371
204 free(pixelSizes);
executed (the execution status of this line is deduced): free(pixelSizes);
-
205 }
executed: }
Execution Count:38680
38680
206 -
207 Key key; -
208 bool bitmapScalable : 1; -
209 bool smoothScalable : 1; -
210 signed int count : 30; -
211 QtFontSize *pixelSizes; -
212 QString styleName; -
213 -
214 bool antialiased; -
215 -
216 QtFontSize *pixelSize(unsigned short size, bool = false); -
217}; -
218 -
219QtFontStyle::Key::Key(const QString &styleString) -
220 : style(QFont::StyleNormal), weight(QFont::Normal), stretch(0) -
221{ -
222 weight = getFontWeight(styleString);
executed (the execution status of this line is deduced): weight = getFontWeight(styleString);
-
223 -
224 if (styleString.contains(QLatin1String("Italic"))
evaluated: styleString.contains(QLatin1String("Italic"))
TRUEFALSE
yes
Evaluation Count:346
yes
Evaluation Count:1814
346-1814
225 || styleString.contains(QCoreApplication::translate("QFontDatabase", "Italic")))
partially evaluated: styleString.contains(QCoreApplication::translate("QFontDatabase", "Italic"))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1814
0-1814
226 style = QFont::StyleItalic;
executed: style = QFont::StyleItalic;
Execution Count:346
346
227 else if (styleString.contains(QLatin1String("Oblique"))
evaluated: styleString.contains(QLatin1String("Oblique"))
TRUEFALSE
yes
Evaluation Count:190
yes
Evaluation Count:1624
190-1624
228 || styleString.contains(QCoreApplication::translate("QFontDatabase", "Oblique")))
partially evaluated: styleString.contains(QCoreApplication::translate("QFontDatabase", "Oblique"))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1624
0-1624
229 style = QFont::StyleOblique;
executed: style = QFont::StyleOblique;
Execution Count:190
190
230} -
231 -
232QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add) -
233{ -
234 for (int i = 0; i < count; i++) {
evaluated: i < count
TRUEFALSE
yes
Evaluation Count:17945
yes
Evaluation Count:36262
17945-36262
235 if (pixelSizes[i].pixelSize == size)
evaluated: pixelSizes[i].pixelSize == size
TRUEFALSE
yes
Evaluation Count:17054
yes
Evaluation Count:891
891-17054
236 return pixelSizes + i;
executed: return pixelSizes + i;
Execution Count:17054
17054
237 }
executed: }
Execution Count:891
891
238 if (!add)
evaluated: !add
TRUEFALSE
yes
Evaluation Count:891
yes
Evaluation Count:35371
891-35371
239 return 0;
executed: return 0;
Execution Count:891
891
240 -
241 if (!pixelSizes) {
partially evaluated: !pixelSizes
TRUEFALSE
yes
Evaluation Count:35371
no
Evaluation Count:0
0-35371
242 // Most style have only one font size, we avoid waisting memory -
243 QtFontSize *newPixelSizes = (QtFontSize *)malloc(sizeof(QtFontSize));
executed (the execution status of this line is deduced): QtFontSize *newPixelSizes = (QtFontSize *)malloc(sizeof(QtFontSize));
-
244 Q_CHECK_PTR(newPixelSizes);
executed (the execution status of this line is deduced): qt_noop();
-
245 pixelSizes = newPixelSizes;
executed (the execution status of this line is deduced): pixelSizes = newPixelSizes;
-
246 } else if (!(count % 8) || count == 1) {
executed: }
Execution Count:35371
never evaluated: !(count % 8)
never evaluated: count == 1
0-35371
247 QtFontSize *newPixelSizes = (QtFontSize *)
never executed (the execution status of this line is deduced): QtFontSize *newPixelSizes = (QtFontSize *)
-
248 realloc(pixelSizes,
never executed (the execution status of this line is deduced): realloc(pixelSizes,
-
249 (((count+8) >> 3) << 3) * sizeof(QtFontSize));
never executed (the execution status of this line is deduced): (((count+8) >> 3) << 3) * sizeof(QtFontSize));
-
250 Q_CHECK_PTR(newPixelSizes);
never executed (the execution status of this line is deduced): qt_noop();
-
251 pixelSizes = newPixelSizes;
never executed (the execution status of this line is deduced): pixelSizes = newPixelSizes;
-
252 }
never executed: }
0
253 pixelSizes[count].pixelSize = size;
executed (the execution status of this line is deduced): pixelSizes[count].pixelSize = size;
-
254 pixelSizes[count].handle = 0;
executed (the execution status of this line is deduced): pixelSizes[count].handle = 0;
-
255 return pixelSizes + (count++);
executed: return pixelSizes + (count++);
Execution Count:35371
35371
256} -
257 -
258struct QtFontFoundry -
259{ -
260 QtFontFoundry(const QString &n) : name(n), count(0), styles(0) {}
executed: }
Execution Count:14900
14900
261 ~QtFontFoundry() { -
262 while (count--)
evaluated: count--
TRUEFALSE
yes
Evaluation Count:38680
yes
Evaluation Count:14900
14900-38680
263 delete styles[count];
executed: delete styles[count];
Execution Count:38680
38680
264 free(styles);
executed (the execution status of this line is deduced): free(styles);
-
265 }
executed: }
Execution Count:14900
14900
266 -
267 QString name; -
268 -
269 int count; -
270 QtFontStyle **styles; -
271 QtFontStyle *style(const QtFontStyle::Key &, const QString & = QString(), bool = false); -
272}; -
273 -
274QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, const QString &styleName, bool create) -
275{ -
276 int pos = 0;
executed (the execution status of this line is deduced): int pos = 0;
-
277 for (; pos < count; pos++) {
evaluated: pos < count
TRUEFALSE
yes
Evaluation Count:90169
yes
Evaluation Count:38680
38680-90169
278 bool hasStyleName = !styleName.isEmpty(); // search styleName first if available
executed (the execution status of this line is deduced): bool hasStyleName = !styleName.isEmpty();
-
279 if (hasStyleName && !styles[pos]->styleName.isEmpty()) {
evaluated: hasStyleName
TRUEFALSE
yes
Evaluation Count:88534
yes
Evaluation Count:1635
evaluated: !styles[pos]->styleName.isEmpty()
TRUEFALSE
yes
Evaluation Count:88508
yes
Evaluation Count:26
26-88534
280 if (styles[pos]->styleName == styleName)
evaluated: styles[pos]->styleName == styleName
TRUEFALSE
yes
Evaluation Count:16346
yes
Evaluation Count:72162
16346-72162
281 return styles[pos];
executed: return styles[pos];
Execution Count:16346
16346
282 } else {
executed: }
Execution Count:72162
72162
283 if (styles[pos]->key == key)
evaluated: styles[pos]->key == key
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:1635
26-1635
284 return styles[pos];
executed: return styles[pos];
Execution Count:26
26
285 }
executed: }
Execution Count:1635
1635
286 } -
287 if (!create)
partially evaluated: !create
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:38680
0-38680
288 return 0;
never executed: return 0;
0
289 -
290// qDebug("adding key (weight=%d, style=%d, oblique=%d stretch=%d) at %d", key.weight, key.style, key.oblique, key.stretch, pos); -
291 if (!(count % 8)) {
evaluated: !(count % 8)
TRUEFALSE
yes
Evaluation Count:15072
yes
Evaluation Count:23608
15072-23608
292 QtFontStyle **newStyles = (QtFontStyle **)
executed (the execution status of this line is deduced): QtFontStyle **newStyles = (QtFontStyle **)
-
293 realloc(styles, (((count+8) >> 3) << 3) * sizeof(QtFontStyle *));
executed (the execution status of this line is deduced): realloc(styles, (((count+8) >> 3) << 3) * sizeof(QtFontStyle *));
-
294 Q_CHECK_PTR(newStyles);
executed (the execution status of this line is deduced): qt_noop();
-
295 styles = newStyles;
executed (the execution status of this line is deduced): styles = newStyles;
-
296 }
executed: }
Execution Count:15072
15072
297 -
298 QtFontStyle *style = new QtFontStyle(key);
executed (the execution status of this line is deduced): QtFontStyle *style = new QtFontStyle(key);
-
299 style->styleName = styleName;
executed (the execution status of this line is deduced): style->styleName = styleName;
-
300 styles[pos] = style;
executed (the execution status of this line is deduced): styles[pos] = style;
-
301 count++;
executed (the execution status of this line is deduced): count++;
-
302 return styles[pos];
executed: return styles[pos];
Execution Count:38680
38680
303} -
304 -
305 -
306struct QtFontFamily -
307{ -
308 enum WritingSystemStatus { -
309 Unknown = 0, -
310 Supported = 1, -
311 UnsupportedFT = 2, -
312 Unsupported = UnsupportedFT -
313 }; -
314 -
315 QtFontFamily(const QString &n) -
316 : -
317 fixedPitch(false), -
318#if !defined(QWS) && defined(Q_OS_MAC) -
319 fixedPitchComputed(false), -
320#endif -
321 name(n), count(0), foundries(0) -
322 , bogusWritingSystems(false) -
323 , askedForFallback(false) -
324 { -
325 memset(writingSystems, 0, sizeof(writingSystems));
executed (the execution status of this line is deduced): memset(writingSystems, 0, sizeof(writingSystems));
-
326 }
executed: }
Execution Count:13778
13778
327 ~QtFontFamily() { -
328 while (count--)
evaluated: count--
TRUEFALSE
yes
Evaluation Count:13778
yes
Evaluation Count:13778
13778
329 delete foundries[count];
executed: delete foundries[count];
Execution Count:13778
13778
330 free(foundries);
executed (the execution status of this line is deduced): free(foundries);
-
331 }
executed: }
Execution Count:13778
13778
332 -
333 bool fixedPitch : 1; -
334#if !defined(QWS) && defined(Q_OS_MAC) -
335 bool fixedPitchComputed : 1; -
336#endif -
337 -
338 QString name; -
339 QStringList aliases; -
340 int count; -
341 QtFontFoundry **foundries; -
342 -
343 bool bogusWritingSystems; -
344 QStringList fallbackFamilies; -
345 bool askedForFallback; -
346 unsigned char writingSystems[QFontDatabase::WritingSystemsCount]; -
347 -
348 QtFontFoundry *foundry(const QString &f, bool = false); -
349}; -
350 -
351#if !defined(QWS) && defined(Q_OS_MAC) -
352inline static void qt_mac_get_fixed_pitch(QtFontFamily *f) -
353{ -
354 if(f && !f->fixedPitchComputed) { -
355 QFontMetrics fm(f->name); -
356 f->fixedPitch = fm.width(QLatin1Char('i')) == fm.width(QLatin1Char('m')); -
357 f->fixedPitchComputed = true; -
358 } -
359} -
360#endif -
361 -
362 -
363QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create) -
364{ -
365 if (f.isNull() && count == 1)
evaluated: f.isNull()
TRUEFALSE
yes
Evaluation Count:1359
yes
Evaluation Count:50175
evaluated: count == 1
TRUEFALSE
yes
Evaluation Count:906
yes
Evaluation Count:453
453-50175
366 return foundries[0];
executed: return foundries[0];
Execution Count:906
906
367 -
368 for (int i = 0; i < count; i++) {
evaluated: i < count
TRUEFALSE
yes
Evaluation Count:36850
yes
Evaluation Count:13778
13778-36850
369 if (foundries[i]->name.compare(f, Qt::CaseInsensitive) == 0)
partially evaluated: foundries[i]->name.compare(f, Qt::CaseInsensitive) == 0
TRUEFALSE
yes
Evaluation Count:36850
no
Evaluation Count:0
0-36850
370 return foundries[i];
executed: return foundries[i];
Execution Count:36850
36850
371 }
never executed: }
0
372 if (!create)
partially evaluated: !create
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13778
0-13778
373 return 0;
never executed: return 0;
0
374 -
375 if (!(count % 8)) {
partially evaluated: !(count % 8)
TRUEFALSE
yes
Evaluation Count:13778
no
Evaluation Count:0
0-13778
376 QtFontFoundry **newFoundries = (QtFontFoundry **)
executed (the execution status of this line is deduced): QtFontFoundry **newFoundries = (QtFontFoundry **)
-
377 realloc(foundries,
executed (the execution status of this line is deduced): realloc(foundries,
-
378 (((count+8) >> 3) << 3) * sizeof(QtFontFoundry *));
executed (the execution status of this line is deduced): (((count+8) >> 3) << 3) * sizeof(QtFontFoundry *));
-
379 Q_CHECK_PTR(newFoundries);
executed (the execution status of this line is deduced): qt_noop();
-
380 foundries = newFoundries;
executed (the execution status of this line is deduced): foundries = newFoundries;
-
381 }
executed: }
Execution Count:13778
13778
382 -
383 foundries[count] = new QtFontFoundry(f);
executed (the execution status of this line is deduced): foundries[count] = new QtFontFoundry(f);
-
384 return foundries[count++];
executed: return foundries[count++];
Execution Count:13778
13778
385} -
386 -
387// ### copied to tools/makeqpf/qpf2.cpp -
388 -
389// see the Unicode subset bitfields in the MSDN docs -
390static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { -
391 // Any, -
392 { 127, 127 }, -
393 // Latin, -
394 { 0, 127 }, -
395 // Greek, -
396 { 7, 127 }, -
397 // Cyrillic, -
398 { 9, 127 }, -
399 // Armenian, -
400 { 10, 127 }, -
401 // Hebrew, -
402 { 11, 127 }, -
403 // Arabic, -
404 { 13, 127 }, -
405 // Syriac, -
406 { 71, 127 }, -
407 //Thaana, -
408 { 72, 127 }, -
409 //Devanagari, -
410 { 15, 127 }, -
411 //Bengali, -
412 { 16, 127 }, -
413 //Gurmukhi, -
414 { 17, 127 }, -
415 //Gujarati, -
416 { 18, 127 }, -
417 //Oriya, -
418 { 19, 127 }, -
419 //Tamil, -
420 { 20, 127 }, -
421 //Telugu, -
422 { 21, 127 }, -
423 //Kannada, -
424 { 22, 127 }, -
425 //Malayalam, -
426 { 23, 127 }, -
427 //Sinhala, -
428 { 73, 127 }, -
429 //Thai, -
430 { 24, 127 }, -
431 //Lao, -
432 { 25, 127 }, -
433 //Tibetan, -
434 { 70, 127 }, -
435 //Myanmar, -
436 { 74, 127 }, -
437 // Georgian, -
438 { 26, 127 }, -
439 // Khmer, -
440 { 80, 127 }, -
441 // SimplifiedChinese, -
442 { 126, 127 }, -
443 // TraditionalChinese, -
444 { 126, 127 }, -
445 // Japanese, -
446 { 126, 127 }, -
447 // Korean, -
448 { 56, 127 }, -
449 // Vietnamese, -
450 { 0, 127 }, // same as latin1 -
451 // Other, -
452 { 126, 127 }, -
453 // Ogham, -
454 { 78, 127 }, -
455 // Runic, -
456 { 79, 127 }, -
457 // Nko, -
458 { 14, 127 }, -
459}; -
460 -
461#define SimplifiedChineseCsbBit 18 -
462#define TraditionalChineseCsbBit 20 -
463#define JapaneseCsbBit 17 -
464#define KoreanCsbBit 21 -
465 -
466QList<QFontDatabase::WritingSystem> qt_determine_writing_systems_from_truetype_bits(quint32 unicodeRange[4], quint32 codePageRange[2]) -
467{ -
468 QList<QFontDatabase::WritingSystem> writingSystems;
executed (the execution status of this line is deduced): QList<QFontDatabase::WritingSystem> writingSystems;
-
469 bool hasScript = false;
executed (the execution status of this line is deduced): bool hasScript = false;
-
470 -
471 int i;
executed (the execution status of this line is deduced): int i;
-
472 for(i = 0; i < QFontDatabase::WritingSystemsCount; i++) {
evaluated: i < QFontDatabase::WritingSystemsCount
TRUEFALSE
yes
Evaluation Count:272
yes
Evaluation Count:8
8-272
473 int bit = requiredUnicodeBits[i][0];
executed (the execution status of this line is deduced): int bit = requiredUnicodeBits[i][0];
-
474 int index = bit/32;
executed (the execution status of this line is deduced): int index = bit/32;
-
475 int flag = 1 << (bit&31);
executed (the execution status of this line is deduced): int flag = 1 << (bit&31);
-
476 if (bit != 126 && unicodeRange[index] & flag) {
evaluated: bit != 126
TRUEFALSE
yes
Evaluation Count:240
yes
Evaluation Count:32
evaluated: unicodeRange[index] & flag
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:212
28-240
477 bit = requiredUnicodeBits[i][1];
executed (the execution status of this line is deduced): bit = requiredUnicodeBits[i][1];
-
478 index = bit/32;
executed (the execution status of this line is deduced): index = bit/32;
-
479 -
480 flag = 1 << (bit&31);
executed (the execution status of this line is deduced): flag = 1 << (bit&31);
-
481 if (bit == 127 || unicodeRange[index] & flag) {
partially evaluated: bit == 127
TRUEFALSE
yes
Evaluation Count:28
no
Evaluation Count:0
never evaluated: unicodeRange[index] & flag
0-28
482 writingSystems.append(QFontDatabase::WritingSystem(i));
executed (the execution status of this line is deduced): writingSystems.append(QFontDatabase::WritingSystem(i));
-
483 hasScript = true;
executed (the execution status of this line is deduced): hasScript = true;
-
484 // qDebug("font %s: index=%d, flag=%8x supports script %d", familyName.latin1(), index, flag, i); -
485 }
executed: }
Execution Count:28
28
486 }
executed: }
Execution Count:28
28
487 }
executed: }
Execution Count:272
272
488 if(codePageRange[0] & (1 << SimplifiedChineseCsbBit)) {
partially evaluated: codePageRange[0] & (1 << 18)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
489 writingSystems.append(QFontDatabase::SimplifiedChinese);
never executed (the execution status of this line is deduced): writingSystems.append(QFontDatabase::SimplifiedChinese);
-
490 hasScript = true;
never executed (the execution status of this line is deduced): hasScript = true;
-
491 //qDebug("font %s supports Simplified Chinese", familyName.latin1()); -
492 }
never executed: }
0
493 if(codePageRange[0] & (1 << TraditionalChineseCsbBit)) {
partially evaluated: codePageRange[0] & (1 << 20)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
494 writingSystems.append(QFontDatabase::TraditionalChinese);
never executed (the execution status of this line is deduced): writingSystems.append(QFontDatabase::TraditionalChinese);
-
495 hasScript = true;
never executed (the execution status of this line is deduced): hasScript = true;
-
496 //qDebug("font %s supports Traditional Chinese", familyName.latin1()); -
497 }
never executed: }
0
498 if(codePageRange[0] & (1 << JapaneseCsbBit)) {
partially evaluated: codePageRange[0] & (1 << 17)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
499 writingSystems.append(QFontDatabase::Japanese);
never executed (the execution status of this line is deduced): writingSystems.append(QFontDatabase::Japanese);
-
500 hasScript = true;
never executed (the execution status of this line is deduced): hasScript = true;
-
501 //qDebug("font %s supports Japanese", familyName.latin1()); -
502 }
never executed: }
0
503 if(codePageRange[0] & (1 << KoreanCsbBit)) {
partially evaluated: codePageRange[0] & (1 << 21)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
504 writingSystems.append(QFontDatabase::Korean);
never executed (the execution status of this line is deduced): writingSystems.append(QFontDatabase::Korean);
-
505 hasScript = true;
never executed (the execution status of this line is deduced): hasScript = true;
-
506 //qDebug("font %s supports Korean", familyName.latin1()); -
507 }
never executed: }
0
508 if (!hasScript)
partially evaluated: !hasScript
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
509 writingSystems.append(QFontDatabase::Symbol);
never executed: writingSystems.append(QFontDatabase::Symbol);
0
510 -
511 return writingSystems;
executed: return writingSystems;
Execution Count:8
8
512} -
513 -
514 -
515class QFontDatabasePrivate -
516{ -
517public: -
518 QFontDatabasePrivate() -
519 : count(0), families(0), reregisterAppFonts(false) -
520 { }
executed: }
Execution Count:185
185
521 -
522 ~QFontDatabasePrivate() { -
523 free();
executed (the execution status of this line is deduced): free();
-
524 }
executed: }
Execution Count:185
185
525 QtFontFamily *family(const QString &f, bool = false); -
526 void free() { -
527 while (count--)
evaluated: count--
TRUEFALSE
yes
Evaluation Count:13778
yes
Evaluation Count:514
514-13778
528 delete families[count];
executed: delete families[count];
Execution Count:13778
13778
529 ::free(families);
executed (the execution status of this line is deduced): ::free(families);
-
530 families = 0;
executed (the execution status of this line is deduced): families = 0;
-
531 count = 0;
executed (the execution status of this line is deduced): count = 0;
-
532 // don't clear the memory fonts! -
533 }
executed: }
Execution Count:514
514
534 -
535 int count; -
536 QtFontFamily **families; -
537 -
538 -
539 -
540 struct ApplicationFont { -
541 QString fileName; -
542 QByteArray data; -
543 QStringList families; -
544 }; -
545 QVector<ApplicationFont> applicationFonts; -
546 int addAppFont(const QByteArray &fontData, const QString &fileName); -
547 bool reregisterAppFonts; -
548 bool isApplicationFont(const QString &fileName); -
549 -
550 void invalidate(); -
551 -
552 QStringList fallbackFamilies; -
553}; -
554 -
555void QFontDatabasePrivate::invalidate() -
556{ -
557 QFontCache::instance()->clear();
executed (the execution status of this line is deduced): QFontCache::instance()->clear();
-
558 free();
executed (the execution status of this line is deduced): free();
-
559 emit static_cast<QGuiApplication *>(QCoreApplication::instance())->fontDatabaseChanged();
executed (the execution status of this line is deduced): static_cast<QGuiApplication *>(QCoreApplication::instance())->fontDatabaseChanged();
-
560}
executed: }
Execution Count:42
42
561 -
562QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create) -
563{ -
564 int low = 0;
executed (the execution status of this line is deduced): int low = 0;
-
565 int high = count;
executed (the execution status of this line is deduced): int high = count;
-
566 int pos = count / 2;
executed (the execution status of this line is deduced): int pos = count / 2;
-
567 int res = 1;
executed (the execution status of this line is deduced): int res = 1;
-
568 if (count) {
evaluated: count
TRUEFALSE
yes
Evaluation Count:54198
yes
Evaluation Count:151
151-54198
569 while ((res = families[pos]->name.compare(f, Qt::CaseInsensitive)) && pos != low) {
evaluated: (res = families[pos]->name.compare(f, Qt::CaseInsensitive))
TRUEFALSE
yes
Evaluation Count:265441
yes
Evaluation Count:40570
evaluated: pos != low
TRUEFALSE
yes
Evaluation Count:251813
yes
Evaluation Count:13628
13628-265441
570 if (res > 0)
evaluated: res > 0
TRUEFALSE
yes
Evaluation Count:111040
yes
Evaluation Count:140773
111040-140773
571 high = pos;
executed: high = pos;
Execution Count:111040
111040
572 else -
573 low = pos;
executed: low = pos;
Execution Count:140773
140773
574 pos = (high + low) / 2;
executed (the execution status of this line is deduced): pos = (high + low) / 2;
-
575 }
executed: }
Execution Count:251813
251813
576 if (!res)
evaluated: !res
TRUEFALSE
yes
Evaluation Count:40570
yes
Evaluation Count:13628
13628-40570
577 return families[pos];
executed: return families[pos];
Execution Count:40570
40570
578 }
executed: }
Execution Count:13628
13628
579 if (!create)
evaluated: !create
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13778
1-13778
580 return 0;
executed: return 0;
Execution Count:1
1
581 -
582 if (res < 0)
evaluated: res < 0
TRUEFALSE
yes
Evaluation Count:13174
yes
Evaluation Count:604
604-13174
583 pos++;
executed: pos++;
Execution Count:13174
13174
584 -
585 // qDebug() << "adding family " << f.toLatin1() << " at " << pos << " total=" << count; -
586 if (!(count % 8)) {
evaluated: !(count % 8)
TRUEFALSE
yes
Evaluation Count:1812
yes
Evaluation Count:11966
1812-11966
587 QtFontFamily **newFamilies = (QtFontFamily **)
executed (the execution status of this line is deduced): QtFontFamily **newFamilies = (QtFontFamily **)
-
588 realloc(families,
executed (the execution status of this line is deduced): realloc(families,
-
589 (((count+8) >> 3) << 3) * sizeof(QtFontFamily *));
executed (the execution status of this line is deduced): (((count+8) >> 3) << 3) * sizeof(QtFontFamily *));
-
590 Q_CHECK_PTR(newFamilies);
executed (the execution status of this line is deduced): qt_noop();
-
591 families = newFamilies;
executed (the execution status of this line is deduced): families = newFamilies;
-
592 }
executed: }
Execution Count:1812
1812
593 -
594 QtFontFamily *family = new QtFontFamily(f);
executed (the execution status of this line is deduced): QtFontFamily *family = new QtFontFamily(f);
-
595 memmove(families + pos + 1, families + pos, (count-pos)*sizeof(QtFontFamily *));
executed (the execution status of this line is deduced): memmove(families + pos + 1, families + pos, (count-pos)*sizeof(QtFontFamily *));
-
596 families[pos] = family;
executed (the execution status of this line is deduced): families[pos] = family;
-
597 count++;
executed (the execution status of this line is deduced): count++;
-
598 return families[pos];
executed: return families[pos];
Execution Count:13778
13778
599} -
600 -
601 -
602 -
603static const int scriptForWritingSystem[] = { -
604 QUnicodeTables::Common, // Any -
605 QUnicodeTables::Latin, // Latin -
606 QUnicodeTables::Greek, // Greek -
607 QUnicodeTables::Cyrillic, // Cyrillic -
608 QUnicodeTables::Armenian, // Armenian -
609 QUnicodeTables::Hebrew, // Hebrew -
610 QUnicodeTables::Arabic, // Arabic -
611 QUnicodeTables::Syriac, // Syriac -
612 QUnicodeTables::Thaana, // Thaana -
613 QUnicodeTables::Devanagari, // Devanagari -
614 QUnicodeTables::Bengali, // Bengali -
615 QUnicodeTables::Gurmukhi, // Gurmukhi -
616 QUnicodeTables::Gujarati, // Gujarati -
617 QUnicodeTables::Oriya, // Oriya -
618 QUnicodeTables::Tamil, // Tamil -
619 QUnicodeTables::Telugu, // Telugu -
620 QUnicodeTables::Kannada, // Kannada -
621 QUnicodeTables::Malayalam, // Malayalam -
622 QUnicodeTables::Sinhala, // Sinhala -
623 QUnicodeTables::Thai, // Thai -
624 QUnicodeTables::Lao, // Lao -
625 QUnicodeTables::Tibetan, // Tibetan -
626 QUnicodeTables::Myanmar, // Myanmar -
627 QUnicodeTables::Georgian, // Georgian -
628 QUnicodeTables::Khmer, // Khmer -
629 QUnicodeTables::Common, // SimplifiedChinese -
630 QUnicodeTables::Common, // TraditionalChinese -
631 QUnicodeTables::Common, // Japanese -
632 QUnicodeTables::Hangul, // Korean -
633 QUnicodeTables::Common, // Vietnamese -
634 QUnicodeTables::Common, // Yi -
635 QUnicodeTables::Common, // Tagalog -
636 QUnicodeTables::Common, // Hanunoo -
637 QUnicodeTables::Common, // Buhid -
638 QUnicodeTables::Common, // Tagbanwa -
639 QUnicodeTables::Common, // Limbu -
640 QUnicodeTables::Common, // TaiLe -
641 QUnicodeTables::Common, // Braille -
642 QUnicodeTables::Common, // Symbol -
643 QUnicodeTables::Ogham, // Ogham -
644 QUnicodeTables::Runic, // Runic -
645 QUnicodeTables::Nko // Nko -
646}; -
647 -
648int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem) -
649{ -
650 return scriptForWritingSystem[writingSystem];
executed: return scriptForWritingSystem[writingSystem];
Execution Count:32
32
651} -
652 -
653 -
654 -
655 -
656/*! -
657 \internal -
658 -
659 This makes sense of the font family name: -
660 -
661 if the family name contains a '[' and a ']', then we take the text -
662 between the square brackets as the foundry, and the text before the -
663 square brackets as the family (ie. "Arial [Monotype]") -
664*/ -
665static void parseFontName(const QString &name, QString &foundry, QString &family) -
666{ -
667 int i = name.indexOf(QLatin1Char('['));
executed (the execution status of this line is deduced): int i = name.indexOf(QLatin1Char('['));
-
668 int li = name.lastIndexOf(QLatin1Char(']'));
executed (the execution status of this line is deduced): int li = name.lastIndexOf(QLatin1Char(']'));
-
669 if (i >= 0 && li >= 0 && i < li) {
partially evaluated: i >= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3908
never evaluated: li >= 0
never evaluated: i < li
0-3908
670 foundry = name.mid(i + 1, li - i - 1);
never executed (the execution status of this line is deduced): foundry = name.mid(i + 1, li - i - 1);
-
671 if (i > 0 && name[i - 1] == QLatin1Char(' '))
never evaluated: i > 0
never evaluated: name[i - 1] == QLatin1Char(' ')
0
672 i--;
never executed: i--;
0
673 family = name.left(i);
never executed (the execution status of this line is deduced): family = name.left(i);
-
674 } else {
never executed: }
0
675 foundry.clear();
executed (the execution status of this line is deduced): foundry.clear();
-
676 family = name;
executed (the execution status of this line is deduced): family = name;
-
677 }
executed: }
Execution Count:3908
3908
678 -
679 // capitalize the family/foundry names -
680 bool space = true;
executed (the execution status of this line is deduced): bool space = true;
-
681 QChar *s = family.data();
executed (the execution status of this line is deduced): QChar *s = family.data();
-
682 int len = family.length();
executed (the execution status of this line is deduced): int len = family.length();
-
683 while(len--) {
evaluated: len--
TRUEFALSE
yes
Evaluation Count:46622
yes
Evaluation Count:3908
3908-46622
684 if (space) *s = s->toUpper();
executed: *s = s->toUpper();
Execution Count:5882
evaluated: space
TRUEFALSE
yes
Evaluation Count:5882
yes
Evaluation Count:40740
5882-40740
685 space = s->isSpace();
executed (the execution status of this line is deduced): space = s->isSpace();
-
686 ++s;
executed (the execution status of this line is deduced): ++s;
-
687 }
executed: }
Execution Count:46622
46622
688 -
689 space = true;
executed (the execution status of this line is deduced): space = true;
-
690 s = foundry.data();
executed (the execution status of this line is deduced): s = foundry.data();
-
691 len = foundry.length();
executed (the execution status of this line is deduced): len = foundry.length();
-
692 while(len--) {
partially evaluated: len--
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3908
0-3908
693 if (space) *s = s->toUpper();
never executed: *s = s->toUpper();
never evaluated: space
0
694 space = s->isSpace();
never executed (the execution status of this line is deduced): space = s->isSpace();
-
695 ++s;
never executed (the execution status of this line is deduced): ++s;
-
696 }
never executed: }
0
697}
executed: }
Execution Count:3908
3908
698 -
699 -
700struct QtFontDesc -
701{ -
702 inline QtFontDesc() : family(0), foundry(0), style(0), size(0), encoding(0), familyIndex(-1) {}
executed: }
Execution Count:59016
59016
703 QtFontFamily *family; -
704 QtFontFoundry *foundry; -
705 QtFontStyle *style; -
706 QtFontSize *size; -
707 QtFontEncoding *encoding; -
708 int familyIndex; -
709}; -
710 -
711static void match(int script, const QFontDef &request, -
712 const QString &family_name, const QString &foundry_name, int force_encoding_id, -
713 QtFontDesc *desc, const QList<int> &blacklistedFamilies = QList<int>()); -
714 -
715static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef, bool multi) -
716{ -
717 fontDef->family = desc.family->name;
executed (the execution status of this line is deduced): fontDef->family = desc.family->name;
-
718 if (! desc.foundry->name.isEmpty() && desc.family->count > 1) {
partially evaluated: ! desc.foundry->name.isEmpty()
TRUEFALSE
yes
Evaluation Count:626
no
Evaluation Count:0
partially evaluated: desc.family->count > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:626
0-626
719 fontDef->family += QString::fromLatin1(" [");
never executed (the execution status of this line is deduced): fontDef->family += QString::fromLatin1(" [");
-
720 fontDef->family += desc.foundry->name;
never executed (the execution status of this line is deduced): fontDef->family += desc.foundry->name;
-
721 fontDef->family += QLatin1Char(']');
never executed (the execution status of this line is deduced): fontDef->family += QLatin1Char(']');
-
722 }
never executed: }
0
723 -
724 if (desc.style->smoothScalable
partially evaluated: desc.style->smoothScalable
TRUEFALSE
yes
Evaluation Count:626
no
Evaluation Count:0
0-626
725 || QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()
never evaluated: QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()
0
726 || (desc.style->bitmapScalable && (request.styleStrategy & QFont::PreferMatch))) {
never evaluated: desc.style->bitmapScalable
never evaluated: (request.styleStrategy & QFont::PreferMatch)
0
727 fontDef->pixelSize = request.pixelSize;
executed (the execution status of this line is deduced): fontDef->pixelSize = request.pixelSize;
-
728 } else {
executed: }
Execution Count:626
626
729 fontDef->pixelSize = desc.size->pixelSize;
never executed (the execution status of this line is deduced): fontDef->pixelSize = desc.size->pixelSize;
-
730 }
never executed: }
0
731 -
732 fontDef->styleHint = request.styleHint;
executed (the execution status of this line is deduced): fontDef->styleHint = request.styleHint;
-
733 fontDef->styleStrategy = request.styleStrategy;
executed (the execution status of this line is deduced): fontDef->styleStrategy = request.styleStrategy;
-
734 -
735 if (!multi)
evaluated: !multi
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:600
26-600
736 fontDef->weight = desc.style->key.weight;
executed: fontDef->weight = desc.style->key.weight;
Execution Count:26
26
737 if (!multi)
evaluated: !multi
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:600
26-600
738 fontDef->style = desc.style->key.style;
executed: fontDef->style = desc.style->key.style;
Execution Count:26
26
739 fontDef->fixedPitch = desc.family->fixedPitch;
executed (the execution status of this line is deduced): fontDef->fixedPitch = desc.family->fixedPitch;
-
740 fontDef->stretch = desc.style->key.stretch;
executed (the execution status of this line is deduced): fontDef->stretch = desc.style->key.stretch;
-
741 fontDef->ignorePitch = false;
executed (the execution status of this line is deduced): fontDef->ignorePitch = false;
-
742}
executed: }
Execution Count:626
626
743 -
744static void getEngineData(const QFontPrivate *d, const QFontDef &def) -
745{ -
746 // look for the requested font in the engine data cache -
747 d->engineData = QFontCache::instance()->findEngineData(def);
executed (the execution status of this line is deduced): d->engineData = QFontCache::instance()->findEngineData(def);
-
748 if (!d->engineData) {
evaluated: !d->engineData
TRUEFALSE
yes
Evaluation Count:610
yes
Evaluation Count:29300
610-29300
749 // create a new one -
750 d->engineData = new QFontEngineData;
executed (the execution status of this line is deduced): d->engineData = new QFontEngineData;
-
751 QFontCache::instance()->insertEngineData(def, d->engineData);
executed (the execution status of this line is deduced): QFontCache::instance()->insertEngineData(def, d->engineData);
-
752 } else {
executed: }
Execution Count:610
610
753 d->engineData->ref.ref();
executed (the execution status of this line is deduced): d->engineData->ref.ref();
-
754 }
executed: }
Execution Count:29300
29300
755} -
756 -
757static QStringList familyList(const QFontDef &req) -
758{ -
759 // list of families to try -
760 QStringList family_list;
executed (the execution status of this line is deduced): QStringList family_list;
-
761 if (req.family.isEmpty())
partially evaluated: req.family.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:637
0-637
762 return family_list;
never executed: return family_list;
0
763 -
764 QStringList list = req.family.split(QLatin1Char(','));
executed (the execution status of this line is deduced): QStringList list = req.family.split(QLatin1Char(','));
-
765 for (int i = 0; i < list.size(); ++i) {
evaluated: i < list.size()
TRUEFALSE
yes
Evaluation Count:637
yes
Evaluation Count:637
637
766 QString str = list.at(i).trimmed();
executed (the execution status of this line is deduced): QString str = list.at(i).trimmed();
-
767 if ((str.startsWith(QLatin1Char('"')) && str.endsWith(QLatin1Char('"')))
partially evaluated: str.startsWith(QLatin1Char('"'))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:637
never evaluated: str.endsWith(QLatin1Char('"'))
0-637
768 || (str.startsWith(QLatin1Char('\'')) && str.endsWith(QLatin1Char('\''))))
partially evaluated: str.startsWith(QLatin1Char('\''))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:637
never evaluated: str.endsWith(QLatin1Char('\''))
0-637
769 str = str.mid(1, str.length() - 2);
never executed: str = str.mid(1, str.length() - 2);
0
770 family_list << str;
executed (the execution status of this line is deduced): family_list << str;
-
771 }
executed: }
Execution Count:637
637
772 -
773 // append the substitute list for each family in family_list -
774 QStringList subs_list;
executed (the execution status of this line is deduced): QStringList subs_list;
-
775 QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd();
executed (the execution status of this line is deduced): QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd();
-
776 for (; it != end; ++it)
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:637
yes
Evaluation Count:637
637
777 subs_list += QFont::substitutes(*it);
executed: subs_list += QFont::substitutes(*it);
Execution Count:637
637
778// qDebug() << "adding substs: " << subs_list; -
779 -
780 family_list += subs_list;
executed (the execution status of this line is deduced): family_list += subs_list;
-
781 -
782 return family_list;
executed: return family_list;
Execution Count:637
637
783} -
784 -
785Q_GLOBAL_STATIC(QFontDatabasePrivate, privateDb)
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:59982
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:185
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:185
yes
Evaluation Count:59797
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:185
no
Evaluation Count:0
0-59982
786Q_GLOBAL_STATIC_WITH_ARGS(QMutex, fontDatabaseMutex, (QMutex::Recursive))
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:384845
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:100
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:100
yes
Evaluation Count:384745
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:100
no
Evaluation Count:0
0-384845
787 -
788// used in qguiapplication.cpp -
789void qt_cleanupFontDatabase() -
790{ -
791 QFontDatabasePrivate *db = privateDb();
executed (the execution status of this line is deduced): QFontDatabasePrivate *db = privateDb();
-
792 if (db)
partially evaluated: db
TRUEFALSE
yes
Evaluation Count:287
no
Evaluation Count:0
0-287
793 db->free();
executed: db->free();
Execution Count:287
287
794}
executed: }
Execution Count:287
287
795 -
796// used in qfontengine_x11.cpp -
797QMutex *qt_fontdatabase_mutex() -
798{ -
799 return fontDatabaseMutex();
executed: return fontDatabaseMutex();
Execution Count:380606
380606
800} -
801 -
802QT_BEGIN_INCLUDE_NAMESPACE -
803# include "qfontdatabase_qpa.cpp" -
804QT_END_INCLUDE_NAMESPACE -
805 -
806static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey, -
807 const QString &styleName = QString()) -
808{ -
809 int best = 0;
executed (the execution status of this line is deduced): int best = 0;
-
810 int dist = 0xffff;
executed (the execution status of this line is deduced): int dist = 0xffff;
-
811 -
812 for ( int i = 0; i < foundry->count; i++ ) {
evaluated: i < foundry->count
TRUEFALSE
yes
Evaluation Count:5633
yes
Evaluation Count:1052
1052-5633
813 QtFontStyle *style = foundry->styles[i];
executed (the execution status of this line is deduced): QtFontStyle *style = foundry->styles[i];
-
814 -
815 if (!styleName.isEmpty() && styleName == style->styleName) {
evaluated: !styleName.isEmpty()
TRUEFALSE
yes
Evaluation Count:1858
yes
Evaluation Count:3775
evaluated: styleName == style->styleName
TRUEFALSE
yes
Evaluation Count:673
yes
Evaluation Count:1185
673-3775
816 dist = 0;
executed (the execution status of this line is deduced): dist = 0;
-
817 best = i;
executed (the execution status of this line is deduced): best = i;
-
818 break;
executed: break;
Execution Count:673
673
819 } -
820 -
821 int d = qAbs( styleKey.weight - style->key.weight );
executed (the execution status of this line is deduced): int d = qAbs( styleKey.weight - style->key.weight );
-
822 -
823 if ( styleKey.stretch != 0 && style->key.stretch != 0 ) {
evaluated: styleKey.stretch != 0
TRUEFALSE
yes
Evaluation Count:3775
yes
Evaluation Count:1185
partially evaluated: style->key.stretch != 0
TRUEFALSE
yes
Evaluation Count:3775
no
Evaluation Count:0
0-3775
824 d += qAbs( styleKey.stretch - style->key.stretch );
executed (the execution status of this line is deduced): d += qAbs( styleKey.stretch - style->key.stretch );
-
825 }
executed: }
Execution Count:3775
3775
826 -
827 if (styleKey.style != style->key.style) {
evaluated: styleKey.style != style->key.style
TRUEFALSE
yes
Evaluation Count:2732
yes
Evaluation Count:2228
2228-2732
828 if (styleKey.style != QFont::StyleNormal && style->key.style != QFont::StyleNormal)
evaluated: styleKey.style != QFont::StyleNormal
TRUEFALSE
yes
Evaluation Count:844
yes
Evaluation Count:1888
evaluated: style->key.style != QFont::StyleNormal
TRUEFALSE
yes
Evaluation Count:210
yes
Evaluation Count:634
210-1888
829 // one is italic, the other oblique -
830 d += 0x0001;
executed: d += 0x0001;
Execution Count:210
210
831 else -
832 d += 0x1000;
executed: d += 0x1000;
Execution Count:2522
2522
833 } -
834 -
835 if ( d < dist ) {
evaluated: d < dist
TRUEFALSE
yes
Evaluation Count:2048
yes
Evaluation Count:2912
2048-2912
836 best = i;
executed (the execution status of this line is deduced): best = i;
-
837 dist = d;
executed (the execution status of this line is deduced): dist = d;
-
838 }
executed: }
Execution Count:2048
2048
839 }
executed: }
Execution Count:4960
4960
840 -
841 FM_DEBUG( " best style has distance 0x%x", dist );
never executed: QMessageLogger("text/qfontdatabase.cpp", 841, __PRETTY_FUNCTION__).debug( " best style has distance 0x%x", dist );
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1725
0-1725
842 return foundry->styles[best];
executed: return foundry->styles[best];
Execution Count:1725
1725
843} -
844 -
845 -
846static -
847unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, -
848 const QtFontFamily *family, const QString &foundry_name, -
849 QtFontStyle::Key styleKey, int pixelSize, char pitch, -
850 QtFontDesc *desc, int force_encoding_id) -
851{ -
852 Q_UNUSED(force_encoding_id);
executed (the execution status of this line is deduced): (void)force_encoding_id;;
-
853 Q_UNUSED(script);
executed (the execution status of this line is deduced): (void)script;;
-
854 Q_UNUSED(pitch);
executed (the execution status of this line is deduced): (void)pitch;;
-
855 -
856 desc->foundry = 0;
executed (the execution status of this line is deduced): desc->foundry = 0;
-
857 desc->style = 0;
executed (the execution status of this line is deduced): desc->style = 0;
-
858 desc->size = 0;
executed (the execution status of this line is deduced): desc->size = 0;
-
859 desc->encoding = 0;
executed (the execution status of this line is deduced): desc->encoding = 0;
-
860 -
861 -
862 FM_DEBUG(" REMARK: looking for best foundry for family '%s' [%d]", family->name.toLatin1().constData(), family->count);
never executed: QMessageLogger("text/qfontdatabase.cpp", 862, __PRETTY_FUNCTION__).debug(" REMARK: looking for best foundry for family '%s' [%d]", family->name.toLatin1().constData(), family->count);
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:891
0-891
863 -
864 for (int x = 0; x < family->count; ++x) {
evaluated: x < family->count
TRUEFALSE
yes
Evaluation Count:891
yes
Evaluation Count:891
891
865 QtFontFoundry *foundry = family->foundries[x];
executed (the execution status of this line is deduced): QtFontFoundry *foundry = family->foundries[x];
-
866 if (!foundry_name.isEmpty() && foundry->name.compare(foundry_name, Qt::CaseInsensitive) != 0)
partially evaluated: !foundry_name.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:891
never evaluated: foundry->name.compare(foundry_name, Qt::CaseInsensitive) != 0
0-891
867 continue;
never executed: continue;
0
868 -
869 FM_DEBUG(" looking for matching style in foundry '%s' %d",
never executed: QMessageLogger("text/qfontdatabase.cpp", 869, __PRETTY_FUNCTION__).debug(" looking for matching style in foundry '%s' %d", foundry->name.isEmpty() ? "-- none --" : foundry->name.toLatin1().constData(), foundry->count);
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:891
0-891
870 foundry->name.isEmpty() ? "-- none --" : foundry->name.toLatin1().constData(), foundry->count);
never executed: QMessageLogger("text/qfontdatabase.cpp", 869, __PRETTY_FUNCTION__).debug(" looking for matching style in foundry '%s' %d", foundry->name.isEmpty() ? "-- none --" : foundry->name.toLatin1().constData(), foundry->count);
0
871 -
872 QtFontStyle *style = bestStyle(foundry, styleKey);
executed (the execution status of this line is deduced): QtFontStyle *style = bestStyle(foundry, styleKey);
-
873 -
874 if (!style->smoothScalable && (styleStrategy & QFont::ForceOutline)) {
partially evaluated: !style->smoothScalable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:891
never evaluated: (styleStrategy & QFont::ForceOutline)
0-891
875 FM_DEBUG(" ForceOutline set, but not smoothly scalable");
never executed: QMessageLogger("text/qfontdatabase.cpp", 875, __PRETTY_FUNCTION__).debug(" ForceOutline set, but not smoothly scalable");
never evaluated: false
0
876 continue;
never executed: continue;
0
877 } -
878 -
879 int px = -1;
executed (the execution status of this line is deduced): int px = -1;
-
880 QtFontSize *size = 0;
executed (the execution status of this line is deduced): QtFontSize *size = 0;
-
881 -
882 // 1. see if we have an exact matching size -
883 if (!(styleStrategy & QFont::ForceOutline)) {
partially evaluated: !(styleStrategy & QFont::ForceOutline)
TRUEFALSE
yes
Evaluation Count:891
no
Evaluation Count:0
0-891
884 size = style->pixelSize(pixelSize);
executed (the execution status of this line is deduced): size = style->pixelSize(pixelSize);
-
885 if (size) {
partially evaluated: size
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:891
0-891
886 FM_DEBUG(" found exact size match (%d pixels)", size->pixelSize);
never executed: QMessageLogger("text/qfontdatabase.cpp", 886, __PRETTY_FUNCTION__).debug(" found exact size match (%d pixels)", size->pixelSize);
never evaluated: false
0
887 px = size->pixelSize;
never executed (the execution status of this line is deduced): px = size->pixelSize;
-
888 }
never executed: }
0
889 }
executed: }
Execution Count:891
891
890 -
891 // 2. see if we have a smoothly scalable font -
892 if (!size && style->smoothScalable && ! (styleStrategy & QFont::PreferBitmap)) {
partially evaluated: !size
TRUEFALSE
yes
Evaluation Count:891
no
Evaluation Count:0
partially evaluated: style->smoothScalable
TRUEFALSE
yes
Evaluation Count:891
no
Evaluation Count:0
partially evaluated: ! (styleStrategy & QFont::PreferBitmap)
TRUEFALSE
yes
Evaluation Count:891
no
Evaluation Count:0
0-891
893 size = style->pixelSize(SMOOTH_SCALABLE);
executed (the execution status of this line is deduced): size = style->pixelSize(0xffff);
-
894 if (size) {
partially evaluated: size
TRUEFALSE
yes
Evaluation Count:891
no
Evaluation Count:0
0-891
895 FM_DEBUG(" found smoothly scalable font (%d pixels)", pixelSize);
never executed: QMessageLogger("text/qfontdatabase.cpp", 895, __PRETTY_FUNCTION__).debug(" found smoothly scalable font (%d pixels)", pixelSize);
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:891
0-891
896 px = pixelSize;
executed (the execution status of this line is deduced): px = pixelSize;
-
897 }
executed: }
Execution Count:891
891
898 }
executed: }
Execution Count:891
891
899 -
900 // 3. see if we have a bitmap scalable font -
901 if (!size && style->bitmapScalable && (styleStrategy & QFont::PreferMatch)) {
partially evaluated: !size
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:891
never evaluated: style->bitmapScalable
never evaluated: (styleStrategy & QFont::PreferMatch)
0-891
902 size = style->pixelSize(0);
never executed (the execution status of this line is deduced): size = style->pixelSize(0);
-
903 if (size) {
never evaluated: size
0
904 FM_DEBUG(" found bitmap scalable font (%d pixels)", pixelSize);
never executed: QMessageLogger("text/qfontdatabase.cpp", 904, __PRETTY_FUNCTION__).debug(" found bitmap scalable font (%d pixels)", pixelSize);
never evaluated: false
0
905 px = pixelSize;
never executed (the execution status of this line is deduced): px = pixelSize;
-
906 }
never executed: }
0
907 }
never executed: }
0
908 -
909 -
910 // 4. find closest size match -
911 if (! size) {
partially evaluated: ! size
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:891
0-891
912 unsigned int distance = ~0u;
never executed (the execution status of this line is deduced): unsigned int distance = ~0u;
-
913 for (int x = 0; x < style->count; ++x) {
never evaluated: x < style->count
0
914 -
915 unsigned int d;
never executed (the execution status of this line is deduced): unsigned int d;
-
916 if (style->pixelSizes[x].pixelSize < pixelSize) {
never evaluated: style->pixelSizes[x].pixelSize < pixelSize
0
917 // penalize sizes that are smaller than the -
918 // requested size, due to truncation from floating -
919 // point to integer conversions -
920 d = pixelSize - style->pixelSizes[x].pixelSize + 1;
never executed (the execution status of this line is deduced): d = pixelSize - style->pixelSizes[x].pixelSize + 1;
-
921 } else {
never executed: }
0
922 d = style->pixelSizes[x].pixelSize - pixelSize;
never executed (the execution status of this line is deduced): d = style->pixelSizes[x].pixelSize - pixelSize;
-
923 }
never executed: }
0
924 -
925 if (d < distance) {
never evaluated: d < distance
0
926 distance = d;
never executed (the execution status of this line is deduced): distance = d;
-
927 size = style->pixelSizes + x;
never executed (the execution status of this line is deduced): size = style->pixelSizes + x;
-
928 FM_DEBUG(" best size so far: %3d (%d)", size->pixelSize, pixelSize);
never executed: QMessageLogger("text/qfontdatabase.cpp", 928, __PRETTY_FUNCTION__).debug(" best size so far: %3d (%d)", size->pixelSize, pixelSize);
never evaluated: false
0
929 }
never executed: }
0
930 }
never executed: }
0
931 -
932 if (!size) {
never evaluated: !size
0
933 FM_DEBUG(" no size supports the script we want");
never executed: QMessageLogger("text/qfontdatabase.cpp", 933, __PRETTY_FUNCTION__).debug(" no size supports the script we want");
never evaluated: false
0
934 continue;
never executed: continue;
0
935 } -
936 -
937 if (style->bitmapScalable && ! (styleStrategy & QFont::PreferQuality) &&
never evaluated: style->bitmapScalable
never evaluated: ! (styleStrategy & QFont::PreferQuality)
0
938 (distance * 10 / pixelSize) >= 2) {
never evaluated: (distance * 10 / pixelSize) >= 2
0
939 // the closest size is not close enough, go ahead and -
940 // use a bitmap scaled font -
941 size = style->pixelSize(0);
never executed (the execution status of this line is deduced): size = style->pixelSize(0);
-
942 px = pixelSize;
never executed (the execution status of this line is deduced): px = pixelSize;
-
943 } else {
never executed: }
0
944 px = size->pixelSize;
never executed (the execution status of this line is deduced): px = size->pixelSize;
-
945 }
never executed: }
0
946 } -
947 -
948 -
949 unsigned int this_score = 0x0000;
executed (the execution status of this line is deduced): unsigned int this_score = 0x0000;
-
950 enum {
executed (the execution status of this line is deduced): enum {
-
951 PitchMismatch = 0x4000,
executed (the execution status of this line is deduced): PitchMismatch = 0x4000,
-
952 StyleMismatch = 0x2000,
executed (the execution status of this line is deduced): StyleMismatch = 0x2000,
-
953 BitmapScaledPenalty = 0x1000,
executed (the execution status of this line is deduced): BitmapScaledPenalty = 0x1000,
-
954 EncodingMismatch = 0x0002
executed (the execution status of this line is deduced): EncodingMismatch = 0x0002
-
955 };
executed (the execution status of this line is deduced): };
-
956 if (pitch != '*') {
evaluated: pitch != '*'
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:889
2-889
957#if !defined(QWS) && defined(Q_OS_MAC) -
958 qt_mac_get_fixed_pitch(const_cast<QtFontFamily*>(family)); -
959#endif -
960 if ((pitch == 'm' && !family->fixedPitch)
evaluated: pitch == 'm'
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: !family->fixedPitch
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
961 || (pitch == 'p' && family->fixedPitch))
partially evaluated: pitch == 'p'
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: family->fixedPitch
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
962 this_score += PitchMismatch;
executed: this_score += PitchMismatch;
Execution Count:1
1
963 }
executed: }
Execution Count:2
2
964 if (styleKey != style->key)
evaluated: styleKey != style->key
TRUEFALSE
yes
Evaluation Count:118
yes
Evaluation Count:773
118-773
965 this_score += StyleMismatch;
executed: this_score += StyleMismatch;
Execution Count:118
118
966 if (!style->smoothScalable && px != size->pixelSize) // bitmap scaled
partially evaluated: !style->smoothScalable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:891
never evaluated: px != size->pixelSize
0-891
967 this_score += BitmapScaledPenalty;
never executed: this_score += BitmapScaledPenalty;
0
968 if (px != pixelSize) // close, but not exact, size match
partially evaluated: px != pixelSize
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:891
0-891
969 this_score += qAbs(px - pixelSize);
never executed: this_score += qAbs(px - pixelSize);
0
970 -
971 if (this_score < score) {
partially evaluated: this_score < score
TRUEFALSE
yes
Evaluation Count:891
no
Evaluation Count:0
0-891
972 FM_DEBUG(" found a match: score %x best score so far %x",
never executed: QMessageLogger("text/qfontdatabase.cpp", 972, __PRETTY_FUNCTION__).debug(" found a match: score %x best score so far %x", this_score, score);
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:891
0-891
973 this_score, score);
never executed: QMessageLogger("text/qfontdatabase.cpp", 972, __PRETTY_FUNCTION__).debug(" found a match: score %x best score so far %x", this_score, score);
0
974 -
975 score = this_score;
executed (the execution status of this line is deduced): score = this_score;
-
976 desc->foundry = foundry;
executed (the execution status of this line is deduced): desc->foundry = foundry;
-
977 desc->style = style;
executed (the execution status of this line is deduced): desc->style = style;
-
978 desc->size = size;
executed (the execution status of this line is deduced): desc->size = size;
-
979 } else {
executed: }
Execution Count:891
891
980 FM_DEBUG(" score %x no better than best %x", this_score, score);
never executed: QMessageLogger("text/qfontdatabase.cpp", 980, __PRETTY_FUNCTION__).debug(" score %x no better than best %x", this_score, score);
never evaluated: false
0
981 }
never executed: }
0
982 } -
983 -
984 return score;
executed: return score;
Execution Count:891
891
985} -
986 -
987static bool matchFamilyName(const QString &familyName, QtFontFamily *f) -
988{ -
989 if (familyName.isEmpty())
evaluated: familyName.isEmpty()
TRUEFALSE
yes
Evaluation Count:92
yes
Evaluation Count:57878
92-57878
990 return true;
executed: return true;
Execution Count:92
92
991 -
992 if (f->name.compare(familyName, Qt::CaseInsensitive) == 0)
evaluated: f->name.compare(familyName, Qt::CaseInsensitive) == 0
TRUEFALSE
yes
Evaluation Count:1028
yes
Evaluation Count:56850
1028-56850
993 return true;
executed: return true;
Execution Count:1028
1028
994 -
995 QStringList::const_iterator it = f->aliases.constBegin();
executed (the execution status of this line is deduced): QStringList::const_iterator it = f->aliases.constBegin();
-
996 while (it != f->aliases.constEnd()) {
partially evaluated: it != f->aliases.constEnd()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:56850
0-56850
997 if ((*it).compare(familyName, Qt::CaseInsensitive) == 0)
never evaluated: (*it).compare(familyName, Qt::CaseInsensitive) == 0
0
998 return true;
never executed: return true;
0
999 -
1000 ++it;
never executed (the execution status of this line is deduced): ++it;
-
1001 }
never executed: }
0
1002 -
1003 return false;
executed: return false;
Execution Count:56850
56850
1004} -
1005 -
1006/*! -
1007 \internal -
1008 -
1009 Tries to find the best match for a given request and family/foundry -
1010*/ -
1011static void match(int script, const QFontDef &request, -
1012 const QString &family_name, const QString &foundry_name, int force_encoding_id, -
1013 QtFontDesc *desc, const QList<int> &blacklistedFamilies) -
1014{ -
1015 Q_UNUSED(force_encoding_id);
executed (the execution status of this line is deduced): (void)force_encoding_id;;
-
1016 -
1017 QtFontStyle::Key styleKey;
executed (the execution status of this line is deduced): QtFontStyle::Key styleKey;
-
1018 styleKey.style = request.style;
executed (the execution status of this line is deduced): styleKey.style = request.style;
-
1019 styleKey.weight = request.weight;
executed (the execution status of this line is deduced): styleKey.weight = request.weight;
-
1020 styleKey.stretch = request.stretch;
executed (the execution status of this line is deduced): styleKey.stretch = request.stretch;
-
1021 char pitch = request.ignorePitch ? '*' : request.fixedPitch ? 'm' : 'p';
evaluated: request.ignorePitch
TRUEFALSE
yes
Evaluation Count:1044
yes
Evaluation Count:2
2-1044
1022 -
1023 -
1024 FM_DEBUG("QFontDatabase::match\n"
never executed: QMessageLogger("text/qfontdatabase.cpp", 1024, __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);
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1046
0-1046
1025 " request:\n"
never executed: QMessageLogger("text/qfontdatabase.cpp", 1024, __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);
0
1026 " family: %s [%s], script: %d\n"
never executed: QMessageLogger("text/qfontdatabase.cpp", 1024, __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);
0
1027 " weight: %d, style: %d\n"
never executed: QMessageLogger("text/qfontdatabase.cpp", 1024, __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);
0
1028 " stretch: %d\n"
never executed: QMessageLogger("text/qfontdatabase.cpp", 1024, __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);
0
1029 " pixelSize: %g\n"
never executed: QMessageLogger("text/qfontdatabase.cpp", 1024, __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);
0
1030 " pitch: %c",
never executed: QMessageLogger("text/qfontdatabase.cpp", 1024, __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);
0
1031 family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(),
never executed: QMessageLogger("text/qfontdatabase.cpp", 1024, __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);
0
1032 foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(),
never executed: QMessageLogger("text/qfontdatabase.cpp", 1024, __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);
0
1033 script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
never executed: QMessageLogger("text/qfontdatabase.cpp", 1024, __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);
0
1034 -
1035 desc->family = 0;
executed (the execution status of this line is deduced): desc->family = 0;
-
1036 desc->foundry = 0;
executed (the execution status of this line is deduced): desc->foundry = 0;
-
1037 desc->style = 0;
executed (the execution status of this line is deduced): desc->style = 0;
-
1038 desc->size = 0;
executed (the execution status of this line is deduced): desc->size = 0;
-
1039 desc->encoding = 0;
executed (the execution status of this line is deduced): desc->encoding = 0;
-
1040 desc->familyIndex = -1;
executed (the execution status of this line is deduced): desc->familyIndex = -1;
-
1041 -
1042 unsigned int score = ~0u;
executed (the execution status of this line is deduced): unsigned int score = ~0u;
-
1043 -
1044 load(family_name, script);
executed (the execution status of this line is deduced): load(family_name, script);
-
1045 -
1046 QFontDatabasePrivate *db = privateDb();
executed (the execution status of this line is deduced): QFontDatabasePrivate *db = privateDb();
-
1047 for (int x = 0; x < db->count; ++x) {
evaluated: x < db->count
TRUEFALSE
yes
Evaluation Count:57970
yes
Evaluation Count:274
274-57970
1048 if (blacklistedFamilies.contains(x))
partially evaluated: blacklistedFamilies.contains(x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:57970
0-57970
1049 continue;
never executed: continue;
0
1050 QtFontDesc test;
executed (the execution status of this line is deduced): QtFontDesc test;
-
1051 test.family = db->families[x];
executed (the execution status of this line is deduced): test.family = db->families[x];
-
1052 test.familyIndex = x;
executed (the execution status of this line is deduced): test.familyIndex = x;
-
1053 -
1054 if (!matchFamilyName(family_name, test.family))
evaluated: !matchFamilyName(family_name, test.family)
TRUEFALSE
yes
Evaluation Count:56850
yes
Evaluation Count:1120
1120-56850
1055 continue;
executed: continue;
Execution Count:56850
56850
1056 -
1057 if (family_name.isEmpty())
evaluated: family_name.isEmpty()
TRUEFALSE
yes
Evaluation Count:92
yes
Evaluation Count:1028
92-1028
1058 load(test.family->name, script);
executed: load(test.family->name, script);
Execution Count:92
92
1059 -
1060 uint score_adjust = 0;
executed (the execution status of this line is deduced): uint score_adjust = 0;
-
1061 -
1062 bool supported = (script == QUnicodeTables::Common);
executed (the execution status of this line is deduced): bool supported = (script == QUnicodeTables::Common);
-
1063 for (int ws = 1; !supported && ws < QFontDatabase::WritingSystemsCount; ++ws) {
evaluated: !supported
TRUEFALSE
yes
Evaluation Count:7923
yes
Evaluation Count:891
evaluated: ws < QFontDatabase::WritingSystemsCount
TRUEFALSE
yes
Evaluation Count:7694
yes
Evaluation Count:229
229-7923
1064 if (scriptForWritingSystem[ws] != script)
evaluated: scriptForWritingSystem[ws] != script
TRUEFALSE
yes
Evaluation Count:7443
yes
Evaluation Count:251
251-7443
1065 continue;
executed: continue;
Execution Count:7443
7443
1066 if (test.family->writingSystems[ws] & QtFontFamily::Supported)
evaluated: test.family->writingSystems[ws] & QtFontFamily::Supported
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:229
22-229
1067 supported = true;
executed: supported = true;
Execution Count:22
22
1068 }
executed: }
Execution Count:251
251
1069 if (!supported) {
evaluated: !supported
TRUEFALSE
yes
Evaluation Count:229
yes
Evaluation Count:891
229-891
1070 // family not supported in the script we want -
1071 continue;
executed: continue;
Execution Count:229
229
1072 } -
1073 -
1074 // as we know the script is supported, we can be sure -
1075 // to find a matching font here. -
1076 unsigned int newscore =
executed (the execution status of this line is deduced): unsigned int newscore =
-
1077 bestFoundry(script, score, request.styleStrategy,
executed (the execution status of this line is deduced): bestFoundry(script, score, request.styleStrategy,
-
1078 test.family, foundry_name, styleKey, request.pixelSize, pitch,
executed (the execution status of this line is deduced): test.family, foundry_name, styleKey, request.pixelSize, pitch,
-
1079 &test, force_encoding_id);
executed (the execution status of this line is deduced): &test, force_encoding_id);
-
1080 if (test.foundry == 0) {
partially evaluated: test.foundry == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:891
0-891
1081 // the specific foundry was not found, so look for -
1082 // any foundry matching our requirements -
1083 newscore = bestFoundry(script, score, request.styleStrategy, test.family,
never executed (the execution status of this line is deduced): newscore = bestFoundry(script, score, request.styleStrategy, test.family,
-
1084 QString(), styleKey, request.pixelSize,
never executed (the execution status of this line is deduced): QString(), styleKey, request.pixelSize,
-
1085 pitch, &test, force_encoding_id);
never executed (the execution status of this line is deduced): pitch, &test, force_encoding_id);
-
1086 }
never executed: }
0
1087 newscore += score_adjust;
executed (the execution status of this line is deduced): newscore += score_adjust;
-
1088 -
1089 if (newscore < score) {
partially evaluated: newscore < score
TRUEFALSE
yes
Evaluation Count:891
no
Evaluation Count:0
0-891
1090 score = newscore;
executed (the execution status of this line is deduced): score = newscore;
-
1091 *desc = test;
executed (the execution status of this line is deduced): *desc = test;
-
1092 }
executed: }
Execution Count:891
891
1093 if (newscore < 10) // xlfd instead of FT... just accept it
evaluated: newscore < 10
TRUEFALSE
yes
Evaluation Count:772
yes
Evaluation Count:119
119-772
1094 break;
executed: break;
Execution Count:772
772
1095 }
executed: }
Execution Count:119
119
1096}
executed: }
Execution Count:1046
1046
1097 -
1098static QString styleStringHelper(int weight, QFont::Style style) -
1099{ -
1100 QString result;
executed (the execution status of this line is deduced): QString result;
-
1101 if (weight >= QFont::Black)
partially evaluated: weight >= QFont::Black
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:59
0-59
1102 result = QCoreApplication::translate("QFontDatabase", "Black");
never executed: result = QCoreApplication::translate("QFontDatabase", "Black");
0
1103 else if (weight >= QFont::Bold)
partially evaluated: weight >= QFont::Bold
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:59
0-59
1104 result = QCoreApplication::translate("QFontDatabase", "Bold");
never executed: result = QCoreApplication::translate("QFontDatabase", "Bold");
0
1105 else if (weight >= QFont::DemiBold)
partially evaluated: weight >= QFont::DemiBold
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:59
0-59
1106 result = QCoreApplication::translate("QFontDatabase", "Demi Bold");
never executed: result = QCoreApplication::translate("QFontDatabase", "Demi Bold");
0
1107 else if (weight < QFont::Normal)
partially evaluated: weight < QFont::Normal
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:59
0-59
1108 result = QCoreApplication::translate("QFontDatabase", "Light");
never executed: result = QCoreApplication::translate("QFontDatabase", "Light");
0
1109 -
1110 if (style == QFont::StyleItalic)
evaluated: style == QFont::StyleItalic
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:40
19-40
1111 result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Italic");
executed: result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Italic");
Execution Count:19
19
1112 else if (style == QFont::StyleOblique)
evaluated: style == QFont::StyleOblique
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:21
19-21
1113 result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Oblique");
executed: result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Oblique");
Execution Count:19
19
1114 -
1115 if (result.isEmpty())
evaluated: result.isEmpty()
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:38
21-38
1116 result = QCoreApplication::translate("QFontDatabase", "Normal");
executed: result = QCoreApplication::translate("QFontDatabase", "Normal");
Execution Count:21
21
1117 -
1118 return result.simplified();
executed: return result.simplified();
Execution Count:59
59
1119} -
1120 -
1121/*! -
1122 Returns a string that describes the style of the \a font. For -
1123 example, "Bold Italic", "Bold", "Italic" or "Normal". An empty -
1124 string may be returned. -
1125*/ -
1126QString QFontDatabase::styleString(const QFont &font) -
1127{ -
1128 return font.styleName().isEmpty() ? styleStringHelper(font.weight(), font.style())
executed: return font.styleName().isEmpty() ? styleStringHelper(font.weight(), font.style()) : font.styleName();
Execution Count:2
2
1129 : font.styleName();
executed: return font.styleName().isEmpty() ? styleStringHelper(font.weight(), font.style()) : font.styleName();
Execution Count:2
2
1130} -
1131 -
1132/*! -
1133 Returns a string that describes the style of the \a fontInfo. For -
1134 example, "Bold Italic", "Bold", "Italic" or "Normal". An empty -
1135 string may be returned. -
1136*/ -
1137QString QFontDatabase::styleString(const QFontInfo &fontInfo) -
1138{ -
1139 return fontInfo.styleName().isEmpty() ? styleStringHelper(fontInfo.weight(), fontInfo.style())
never executed: return fontInfo.styleName().isEmpty() ? styleStringHelper(fontInfo.weight(), fontInfo.style()) : fontInfo.styleName();
0
1140 : fontInfo.styleName();
never executed: return fontInfo.styleName().isEmpty() ? styleStringHelper(fontInfo.weight(), fontInfo.style()) : fontInfo.styleName();
0
1141} -
1142 -
1143 -
1144/*! -
1145 \class QFontDatabase -
1146 \threadsafe -
1147 \inmodule QtGui -
1148 -
1149 \brief The QFontDatabase class provides information about the fonts available in the underlying window system. -
1150 -
1151 \ingroup appearance -
1152 -
1153 The most common uses of this class are to query the database for -
1154 the list of font families() and for the pointSizes() and styles() -
1155 that are available for each family. An alternative to pointSizes() -
1156 is smoothSizes() which returns the sizes at which a given family -
1157 and style will look attractive. -
1158 -
1159 If the font family is available from two or more foundries the -
1160 foundry name is included in the family name; for example: -
1161 "Helvetica [Adobe]" and "Helvetica [Cronyx]". When you specify a -
1162 family, you can either use the old hyphenated "foundry-family" -
1163 format or the bracketed "family [foundry]" format; for example: -
1164 "Cronyx-Helvetica" or "Helvetica [Cronyx]". If the family has a -
1165 foundry it is always returned using the bracketed format, as is -
1166 the case with the value returned by families(). -
1167 -
1168 The font() function returns a QFont given a family, style and -
1169 point size. -
1170 -
1171 A family and style combination can be checked to see if it is -
1172 italic() or bold(), and to retrieve its weight(). Similarly we can -
1173 call isBitmapScalable(), isSmoothlyScalable(), isScalable() and -
1174 isFixedPitch(). -
1175 -
1176 Use the styleString() to obtain a text version of a style. -
1177 -
1178 The QFontDatabase class also supports some static functions, for -
1179 example, standardSizes(). You can retrieve the description of a -
1180 writing system using writingSystemName(), and a sample of -
1181 characters in a writing system with writingSystemSample(). -
1182 -
1183 Example: -
1184 -
1185 \snippet qfontdatabase/main.cpp 0 -
1186 \snippet qfontdatabase/main.cpp 1 -
1187 -
1188 This example gets the list of font families, the list of -
1189 styles for each family, and the point sizes that are available for -
1190 each combination of family and style, displaying this information -
1191 in a tree view. -
1192 -
1193 \sa QFont, QFontInfo, QFontMetrics, {Character Map Example} -
1194*/ -
1195 -
1196/*! -
1197 Creates a font database object. -
1198*/ -
1199QFontDatabase::QFontDatabase() -
1200{ -
1201 QMutexLocker locker(fontDatabaseMutex());
executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1202 createDatabase();
executed (the execution status of this line is deduced): createDatabase();
-
1203 d = privateDb();
executed (the execution status of this line is deduced): d = privateDb();
-
1204}
executed: }
Execution Count:374
374
1205 -
1206/*! -
1207 \enum QFontDatabase::WritingSystem -
1208 -
1209 \value Any -
1210 \value Latin -
1211 \value Greek -
1212 \value Cyrillic -
1213 \value Armenian -
1214 \value Hebrew -
1215 \value Arabic -
1216 \value Syriac -
1217 \value Thaana -
1218 \value Devanagari -
1219 \value Bengali -
1220 \value Gurmukhi -
1221 \value Gujarati -
1222 \value Oriya -
1223 \value Tamil -
1224 \value Telugu -
1225 \value Kannada -
1226 \value Malayalam -
1227 \value Sinhala -
1228 \value Thai -
1229 \value Lao -
1230 \value Tibetan -
1231 \value Myanmar -
1232 \value Georgian -
1233 \value Khmer -
1234 \value SimplifiedChinese -
1235 \value TraditionalChinese -
1236 \value Japanese -
1237 \value Korean -
1238 \value Vietnamese -
1239 \value Symbol -
1240 \value Other (the same as Symbol) -
1241 \value Ogham -
1242 \value Runic -
1243 \value Nko -
1244 -
1245 \omitvalue WritingSystemsCount -
1246*/ -
1247 -
1248/*! -
1249 Returns a sorted list of the available writing systems. This is -
1250 list generated from information about all installed fonts on the -
1251 system. -
1252 -
1253 \sa families() -
1254*/ -
1255QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems() const -
1256{ -
1257 QMutexLocker locker(fontDatabaseMutex());
never executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1258 -
1259 QT_PREPEND_NAMESPACE(load)();
never executed (the execution status of this line is deduced): ::load();
-
1260 -
1261 QList<WritingSystem> list;
never executed (the execution status of this line is deduced): QList<WritingSystem> list;
-
1262 for (int i = 0; i < d->count; ++i) {
never evaluated: i < d->count
0
1263 QtFontFamily *family = d->families[i];
never executed (the execution status of this line is deduced): QtFontFamily *family = d->families[i];
-
1264 if (family->count == 0)
never evaluated: family->count == 0
0
1265 continue;
never executed: continue;
0
1266 for (int x = Latin; x < WritingSystemsCount; ++x) {
never evaluated: x < WritingSystemsCount
0
1267 const WritingSystem writingSystem = WritingSystem(x);
never executed (the execution status of this line is deduced): const WritingSystem writingSystem = WritingSystem(x);
-
1268 if (!(family->writingSystems[writingSystem] & QtFontFamily::Supported))
never evaluated: !(family->writingSystems[writingSystem] & QtFontFamily::Supported)
0
1269 continue;
never executed: continue;
0
1270 if (!list.contains(writingSystem))
never evaluated: !list.contains(writingSystem)
0
1271 list.append(writingSystem);
never executed: list.append(writingSystem);
0
1272 }
never executed: }
0
1273 }
never executed: }
0
1274 qSort(list);
never executed (the execution status of this line is deduced): qSort(list);
-
1275 return list;
never executed: return list;
0
1276} -
1277 -
1278 -
1279/*! -
1280 Returns a sorted list of the writing systems supported by a given -
1281 font \a family. -
1282 -
1283 \sa families() -
1284*/ -
1285QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems(const QString &family) const -
1286{ -
1287 QString familyName, foundryName;
never executed (the execution status of this line is deduced): QString familyName, foundryName;
-
1288 parseFontName(family, foundryName, familyName);
never executed (the execution status of this line is deduced): parseFontName(family, foundryName, familyName);
-
1289 -
1290 QMutexLocker locker(fontDatabaseMutex());
never executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1291 -
1292 QT_PREPEND_NAMESPACE(load)();
never executed (the execution status of this line is deduced): ::load();
-
1293 -
1294 QList<WritingSystem> list;
never executed (the execution status of this line is deduced): QList<WritingSystem> list;
-
1295 QtFontFamily *f = d->family(familyName);
never executed (the execution status of this line is deduced): QtFontFamily *f = d->family(familyName);
-
1296 if (!f || f->count == 0)
never evaluated: !f
never evaluated: f->count == 0
0
1297 return list;
never executed: return list;
0
1298 -
1299 for (int x = Latin; x < WritingSystemsCount; ++x) {
never evaluated: x < WritingSystemsCount
0
1300 const WritingSystem writingSystem = WritingSystem(x);
never executed (the execution status of this line is deduced): const WritingSystem writingSystem = WritingSystem(x);
-
1301 if (f->writingSystems[writingSystem] & QtFontFamily::Supported)
never evaluated: f->writingSystems[writingSystem] & QtFontFamily::Supported
0
1302 list.append(writingSystem);
never executed: list.append(writingSystem);
0
1303 }
never executed: }
0
1304 return list;
never executed: return list;
0
1305} -
1306 -
1307 -
1308/*! -
1309 Returns a sorted list of the available font families which support -
1310 the \a writingSystem. -
1311 -
1312 If a family exists in several foundries, the returned name for -
1313 that font is in the form "family [foundry]". Examples: "Times -
1314 [Adobe]", "Times [Cronyx]", "Palatino". -
1315 -
1316 \sa writingSystems() -
1317*/ -
1318QStringList QFontDatabase::families(WritingSystem writingSystem) const -
1319{ -
1320 QMutexLocker locker(fontDatabaseMutex());
executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1321 -
1322 QT_PREPEND_NAMESPACE(load)();
executed (the execution status of this line is deduced): ::load();
-
1323 -
1324 QStringList flist;
executed (the execution status of this line is deduced): QStringList flist;
-
1325 for (int i = 0; i < d->count; i++) {
evaluated: i < d->count
TRUEFALSE
yes
Evaluation Count:32760
yes
Evaluation Count:360
360-32760
1326 QtFontFamily *f = d->families[i];
executed (the execution status of this line is deduced): QtFontFamily *f = d->families[i];
-
1327 if (f->count == 0)
partially evaluated: f->count == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:32760
0-32760
1328 continue;
never executed: continue;
0
1329 if (writingSystem != Any && (f->writingSystems[writingSystem] != QtFontFamily::Supported))
evaluated: writingSystem != Any
TRUEFALSE
yes
Evaluation Count:6370
yes
Evaluation Count:26390
evaluated: (f->writingSystems[writingSystem] != QtFontFamily::Supported)
TRUEFALSE
yes
Evaluation Count:5986
yes
Evaluation Count:384
384-26390
1330 continue;
executed: continue;
Execution Count:5986
5986
1331 if (f->count == 1) {
partially evaluated: f->count == 1
TRUEFALSE
yes
Evaluation Count:26774
no
Evaluation Count:0
0-26774
1332 flist.append(f->name);
executed (the execution status of this line is deduced): flist.append(f->name);
-
1333 } else {
executed: }
Execution Count:26774
26774
1334 for (int j = 0; j < f->count; j++) {
never evaluated: j < f->count
0
1335 QString str = f->name;
never executed (the execution status of this line is deduced): QString str = f->name;
-
1336 QString foundry = f->foundries[j]->name;
never executed (the execution status of this line is deduced): QString foundry = f->foundries[j]->name;
-
1337 if (!foundry.isEmpty()) {
never evaluated: !foundry.isEmpty()
0
1338 str += QLatin1String(" [");
never executed (the execution status of this line is deduced): str += QLatin1String(" [");
-
1339 str += foundry;
never executed (the execution status of this line is deduced): str += foundry;
-
1340 str += QLatin1Char(']');
never executed (the execution status of this line is deduced): str += QLatin1Char(']');
-
1341 }
never executed: }
0
1342 flist.append(str);
never executed (the execution status of this line is deduced): flist.append(str);
-
1343 }
never executed: }
0
1344 }
never executed: }
0
1345 } -
1346 return flist;
executed: return flist;
Execution Count:360
360
1347} -
1348 -
1349/*! -
1350 Returns a list of the styles available for the font family \a -
1351 family. Some example styles: "Light", "Light Italic", "Bold", -
1352 "Oblique", "Demi". The list may be empty. -
1353 -
1354 \sa families() -
1355*/ -
1356QStringList QFontDatabase::styles(const QString &family) const -
1357{ -
1358 QString familyName, foundryName;
executed (the execution status of this line is deduced): QString familyName, foundryName;
-
1359 parseFontName(family, foundryName, familyName);
executed (the execution status of this line is deduced): parseFontName(family, foundryName, familyName);
-
1360 -
1361 QMutexLocker locker(fontDatabaseMutex());
executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1362 -
1363 QT_PREPEND_NAMESPACE(load)(familyName);
executed (the execution status of this line is deduced): ::load(familyName);
-
1364 -
1365 QStringList l;
executed (the execution status of this line is deduced): QStringList l;
-
1366 QtFontFamily *f = d->family(familyName);
executed (the execution status of this line is deduced): QtFontFamily *f = d->family(familyName);
-
1367 if (!f)
evaluated: !f
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:288
1-288
1368 return l;
executed: return l;
Execution Count:1
1
1369 -
1370 QtFontFoundry allStyles(foundryName);
executed (the execution status of this line is deduced): QtFontFoundry allStyles(foundryName);
-
1371 for (int j = 0; j < f->count; j++) {
evaluated: j < f->count
TRUEFALSE
yes
Evaluation Count:288
yes
Evaluation Count:288
288
1372 QtFontFoundry *foundry = f->foundries[j];
executed (the execution status of this line is deduced): QtFontFoundry *foundry = f->foundries[j];
-
1373 if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
partially evaluated: foundryName.isEmpty()
TRUEFALSE
yes
Evaluation Count:288
no
Evaluation Count:0
never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
0-288
1374 for (int k = 0; k < foundry->count; k++) {
evaluated: k < foundry->count
TRUEFALSE
yes
Evaluation Count:752
yes
Evaluation Count:288
288-752
1375 QtFontStyle::Key ke(foundry->styles[k]->key);
executed (the execution status of this line is deduced): QtFontStyle::Key ke(foundry->styles[k]->key);
-
1376 ke.stretch = 0;
executed (the execution status of this line is deduced): ke.stretch = 0;
-
1377 allStyles.style(ke, foundry->styles[k]->styleName, true);
executed (the execution status of this line is deduced): allStyles.style(ke, foundry->styles[k]->styleName, true);
-
1378 }
executed: }
Execution Count:752
752
1379 }
executed: }
Execution Count:288
288
1380 }
executed: }
Execution Count:288
288
1381 -
1382 for (int i = 0; i < allStyles.count; i++) {
evaluated: i < allStyles.count
TRUEFALSE
yes
Evaluation Count:752
yes
Evaluation Count:288
288-752
1383 l.append(allStyles.styles[i]->styleName.isEmpty() ?
executed (the execution status of this line is deduced): l.append(allStyles.styles[i]->styleName.isEmpty() ?
-
1384 styleStringHelper(allStyles.styles[i]->key.weight,
executed (the execution status of this line is deduced): styleStringHelper(allStyles.styles[i]->key.weight,
-
1385 (QFont::Style)allStyles.styles[i]->key.style) :
executed (the execution status of this line is deduced): (QFont::Style)allStyles.styles[i]->key.style) :
-
1386 allStyles.styles[i]->styleName);
executed (the execution status of this line is deduced): allStyles.styles[i]->styleName);
-
1387 }
executed: }
Execution Count:752
752
1388 return l;
executed: return l;
Execution Count:288
288
1389} -
1390 -
1391/*! -
1392 Returns true if the font that has family \a family and style \a -
1393 style is fixed pitch; otherwise returns false. -
1394*/ -
1395 -
1396bool QFontDatabase::isFixedPitch(const QString &family, -
1397 const QString &style) const -
1398{ -
1399 Q_UNUSED(style);
executed (the execution status of this line is deduced): (void)style;;
-
1400 -
1401 QString familyName, foundryName;
executed (the execution status of this line is deduced): QString familyName, foundryName;
-
1402 parseFontName(family, foundryName, familyName);
executed (the execution status of this line is deduced): parseFontName(family, foundryName, familyName);
-
1403 -
1404 QMutexLocker locker(fontDatabaseMutex());
executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1405 -
1406 QT_PREPEND_NAMESPACE(load)(familyName);
executed (the execution status of this line is deduced): ::load(familyName);
-
1407 -
1408 QtFontFamily *f = d->family(familyName);
executed (the execution status of this line is deduced): QtFontFamily *f = d->family(familyName);
-
1409#if !defined(QWS) && defined(Q_OS_MAC) -
1410 qt_mac_get_fixed_pitch(f); -
1411#endif -
1412 return (f && f->fixedPitch);
executed: return (f && f->fixedPitch);
Execution Count:366
366
1413} -
1414 -
1415/*! -
1416 Returns true if the font that has family \a family and style \a -
1417 style is a scalable bitmap font; otherwise returns false. Scaling -
1418 a bitmap font usually produces an unattractive hardly readable -
1419 result, because the pixels of the font are scaled. If you need to -
1420 scale a bitmap font it is better to scale it to one of the fixed -
1421 sizes returned by smoothSizes(). -
1422 -
1423 \sa isScalable(), isSmoothlyScalable() -
1424*/ -
1425bool QFontDatabase::isBitmapScalable(const QString &family, -
1426 const QString &style) const -
1427{ -
1428 bool bitmapScalable = false;
never executed (the execution status of this line is deduced): bool bitmapScalable = false;
-
1429 QString familyName, foundryName;
never executed (the execution status of this line is deduced): QString familyName, foundryName;
-
1430 parseFontName(family, foundryName, familyName);
never executed (the execution status of this line is deduced): parseFontName(family, foundryName, familyName);
-
1431 -
1432 QMutexLocker locker(fontDatabaseMutex());
never executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1433 -
1434 QT_PREPEND_NAMESPACE(load)(familyName);
never executed (the execution status of this line is deduced): ::load(familyName);
-
1435 -
1436 QtFontStyle::Key styleKey(style);
never executed (the execution status of this line is deduced): QtFontStyle::Key styleKey(style);
-
1437 -
1438 QtFontFamily *f = d->family(familyName);
never executed (the execution status of this line is deduced): QtFontFamily *f = d->family(familyName);
-
1439 if (!f) return bitmapScalable;
never executed: return bitmapScalable;
never evaluated: !f
0
1440 -
1441 for (int j = 0; j < f->count; j++) {
never evaluated: j < f->count
0
1442 QtFontFoundry *foundry = f->foundries[j];
never executed (the execution status of this line is deduced): QtFontFoundry *foundry = f->foundries[j];
-
1443 if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
never evaluated: foundryName.isEmpty()
never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
0
1444 for (int k = 0; k < foundry->count; k++)
never evaluated: k < foundry->count
0
1445 if ((style.isEmpty() ||
never evaluated: style.isEmpty()
0
1446 foundry->styles[k]->styleName == style ||
never evaluated: foundry->styles[k]->styleName == style
0
1447 foundry->styles[k]->key == styleKey)
never evaluated: foundry->styles[k]->key == styleKey
0
1448 && foundry->styles[k]->bitmapScalable && !foundry->styles[k]->smoothScalable) {
never evaluated: foundry->styles[k]->bitmapScalable
never evaluated: !foundry->styles[k]->smoothScalable
0
1449 bitmapScalable = true;
never executed (the execution status of this line is deduced): bitmapScalable = true;
-
1450 goto end;
never executed: goto end;
0
1451 } -
1452 }
never executed: }
0
1453 }
never executed: }
0
1454 end: -
1455 return bitmapScalable;
never executed: return bitmapScalable;
0
1456} -
1457 -
1458 -
1459/*! -
1460 Returns true if the font that has family \a family and style \a -
1461 style is smoothly scalable; otherwise returns false. If this -
1462 function returns true, it's safe to scale this font to any size, -
1463 and the result will always look attractive. -
1464 -
1465 \sa isScalable(), isBitmapScalable() -
1466*/ -
1467bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &style) const -
1468{ -
1469 bool smoothScalable = false;
executed (the execution status of this line is deduced): bool smoothScalable = false;
-
1470 QString familyName, foundryName;
executed (the execution status of this line is deduced): QString familyName, foundryName;
-
1471 parseFontName(family, foundryName, familyName);
executed (the execution status of this line is deduced): parseFontName(family, foundryName, familyName);
-
1472 -
1473 QMutexLocker locker(fontDatabaseMutex());
executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1474 -
1475 QT_PREPEND_NAMESPACE(load)(familyName);
executed (the execution status of this line is deduced): ::load(familyName);
-
1476 -
1477 QtFontStyle::Key styleKey(style);
executed (the execution status of this line is deduced): QtFontStyle::Key styleKey(style);
-
1478 -
1479 QtFontFamily *f = d->family(familyName);
executed (the execution status of this line is deduced): QtFontFamily *f = d->family(familyName);
-
1480 if (!f) return smoothScalable;
never executed: return smoothScalable;
partially evaluated: !f
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1117
0-1117
1481 -
1482 for (int j = 0; j < f->count; j++) {
partially evaluated: j < f->count
TRUEFALSE
yes
Evaluation Count:1117
no
Evaluation Count:0
0-1117
1483 QtFontFoundry *foundry = f->foundries[j];
executed (the execution status of this line is deduced): QtFontFoundry *foundry = f->foundries[j];
-
1484 if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
partially evaluated: foundryName.isEmpty()
TRUEFALSE
yes
Evaluation Count:1117
no
Evaluation Count:0
never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
0-1117
1485 for (int k = 0; k < foundry->count; k++)
partially evaluated: k < foundry->count
TRUEFALSE
yes
Evaluation Count:1706
no
Evaluation Count:0
0-1706
1486 if ((style.isEmpty() ||
evaluated: style.isEmpty()
TRUEFALSE
yes
Evaluation Count:546
yes
Evaluation Count:1160
546-1160
1487 foundry->styles[k]->styleName == style ||
evaluated: foundry->styles[k]->styleName == style
TRUEFALSE
yes
Evaluation Count:510
yes
Evaluation Count:650
510-650
1488 foundry->styles[k]->key == styleKey) && foundry->styles[k]->smoothScalable) {
evaluated: foundry->styles[k]->key == styleKey
TRUEFALSE
yes
Evaluation Count:61
yes
Evaluation Count:589
partially evaluated: foundry->styles[k]->smoothScalable
TRUEFALSE
yes
Evaluation Count:1117
no
Evaluation Count:0
0-1117
1489 smoothScalable = true;
executed (the execution status of this line is deduced): smoothScalable = true;
-
1490 goto end;
executed: goto end;
Execution Count:1117
1117
1491 } -
1492 }
never executed: }
0
1493 }
never executed: }
0
1494 end: -
1495 return smoothScalable;
executed: return smoothScalable;
Execution Count:1117
1117
1496} -
1497 -
1498/*! -
1499 Returns true if the font that has family \a family and style \a -
1500 style is scalable; otherwise returns false. -
1501 -
1502 \sa isBitmapScalable(), isSmoothlyScalable() -
1503*/ -
1504bool QFontDatabase::isScalable(const QString &family, -
1505 const QString &style) const -
1506{ -
1507 QMutexLocker locker(fontDatabaseMutex());
never executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1508 if (isSmoothlyScalable(family, style))
never evaluated: isSmoothlyScalable(family, style)
0
1509 return true;
never executed: return true;
0
1510 return isBitmapScalable(family, style);
never executed: return isBitmapScalable(family, style);
0
1511} -
1512 -
1513 -
1514/*! -
1515 Returns a list of the point sizes available for the font that has -
1516 family \a family and style \a styleName. The list may be empty. -
1517 -
1518 \sa smoothSizes(), standardSizes() -
1519*/ -
1520QList<int> QFontDatabase::pointSizes(const QString &family, -
1521 const QString &styleName) -
1522{ -
1523 if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable())
partially evaluated: QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:209
0-209
1524 return standardSizes();
never executed: return standardSizes();
0
1525 -
1526 bool smoothScalable = false;
executed (the execution status of this line is deduced): bool smoothScalable = false;
-
1527 QString familyName, foundryName;
executed (the execution status of this line is deduced): QString familyName, foundryName;
-
1528 parseFontName(family, foundryName, familyName);
executed (the execution status of this line is deduced): parseFontName(family, foundryName, familyName);
-
1529 -
1530 QMutexLocker locker(fontDatabaseMutex());
executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1531 -
1532 QT_PREPEND_NAMESPACE(load)(familyName);
executed (the execution status of this line is deduced): ::load(familyName);
-
1533 -
1534 QtFontStyle::Key styleKey(styleName);
executed (the execution status of this line is deduced): QtFontStyle::Key styleKey(styleName);
-
1535 -
1536 QList<int> sizes;
executed (the execution status of this line is deduced): QList<int> sizes;
-
1537 -
1538 QtFontFamily *fam = d->family(familyName);
executed (the execution status of this line is deduced): QtFontFamily *fam = d->family(familyName);
-
1539 if (!fam) return sizes;
never executed: return sizes;
partially evaluated: !fam
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:209
0-209
1540 -
1541 -
1542 const int dpi = qt_defaultDpiY(); // embedded
executed (the execution status of this line is deduced): const int dpi = qt_defaultDpiY();
-
1543 -
1544 for (int j = 0; j < fam->count; j++) {
partially evaluated: j < fam->count
TRUEFALSE
yes
Evaluation Count:209
no
Evaluation Count:0
0-209
1545 QtFontFoundry *foundry = fam->foundries[j];
executed (the execution status of this line is deduced): QtFontFoundry *foundry = fam->foundries[j];
-
1546 if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
partially evaluated: foundryName.isEmpty()
TRUEFALSE
yes
Evaluation Count:209
no
Evaluation Count:0
never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
0-209
1547 QtFontStyle *style = foundry->style(styleKey, styleName);
executed (the execution status of this line is deduced): QtFontStyle *style = foundry->style(styleKey, styleName);
-
1548 if (!style) continue;
never executed: continue;
partially evaluated: !style
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:209
0-209
1549 -
1550 if (style->smoothScalable) {
partially evaluated: style->smoothScalable
TRUEFALSE
yes
Evaluation Count:209
no
Evaluation Count:0
0-209
1551 smoothScalable = true;
executed (the execution status of this line is deduced): smoothScalable = true;
-
1552 goto end;
executed: goto end;
Execution Count:209
209
1553 } -
1554 for (int l = 0; l < style->count; l++) {
never evaluated: l < style->count
0
1555 const QtFontSize *size = style->pixelSizes + l;
never executed (the execution status of this line is deduced): const QtFontSize *size = style->pixelSizes + l;
-
1556 -
1557 if (size->pixelSize != 0 && size->pixelSize != USHRT_MAX) {
never evaluated: size->pixelSize != 0
never evaluated: size->pixelSize != (32767 * 2 + 1)
0
1558 const uint pointSize = qRound(size->pixelSize * 72.0 / dpi);
never executed (the execution status of this line is deduced): const uint pointSize = qRound(size->pixelSize * 72.0 / dpi);
-
1559 if (! sizes.contains(pointSize))
never evaluated: ! sizes.contains(pointSize)
0
1560 sizes.append(pointSize);
never executed: sizes.append(pointSize);
0
1561 }
never executed: }
0
1562 }
never executed: }
0
1563 }
never executed: }
0
1564 }
never executed: }
0
1565 end:
code before this statement never executed: end:
0
1566 if (smoothScalable)
partially evaluated: smoothScalable
TRUEFALSE
yes
Evaluation Count:209
no
Evaluation Count:0
0-209
1567 return standardSizes();
executed: return standardSizes();
Execution Count:209
209
1568 -
1569 qSort(sizes);
never executed (the execution status of this line is deduced): qSort(sizes);
-
1570 return sizes;
never executed: return sizes;
0
1571} -
1572 -
1573/*! -
1574 Returns a QFont object that has family \a family, style \a style -
1575 and point size \a pointSize. If no matching font could be created, -
1576 a QFont object that uses the application's default font is -
1577 returned. -
1578*/ -
1579QFont QFontDatabase::font(const QString &family, const QString &style, -
1580 int pointSize) const -
1581{ -
1582 QString familyName, foundryName;
executed (the execution status of this line is deduced): QString familyName, foundryName;
-
1583 parseFontName(family, foundryName, familyName);
executed (the execution status of this line is deduced): parseFontName(family, foundryName, familyName);
-
1584 -
1585 QMutexLocker locker(fontDatabaseMutex());
executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1586 -
1587 QT_PREPEND_NAMESPACE(load)(familyName);
executed (the execution status of this line is deduced): ::load(familyName);
-
1588 -
1589 QtFontFoundry allStyles(foundryName);
executed (the execution status of this line is deduced): QtFontFoundry allStyles(foundryName);
-
1590 QtFontFamily *f = d->family(familyName);
executed (the execution status of this line is deduced): QtFontFamily *f = d->family(familyName);
-
1591 if (!f) return QGuiApplication::font();
never executed: return QGuiApplication::font();
partially evaluated: !f
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:834
0-834
1592 -
1593 for (int j = 0; j < f->count; j++) {
evaluated: j < f->count
TRUEFALSE
yes
Evaluation Count:834
yes
Evaluation Count:834
834
1594 QtFontFoundry *foundry = f->foundries[j];
executed (the execution status of this line is deduced): QtFontFoundry *foundry = f->foundries[j];
-
1595 if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
partially evaluated: foundryName.isEmpty()
TRUEFALSE
yes
Evaluation Count:834
no
Evaluation Count:0
never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
0-834
1596 for (int k = 0; k < foundry->count; k++)
evaluated: k < foundry->count
TRUEFALSE
yes
Evaluation Count:2557
yes
Evaluation Count:834
834-2557
1597 allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
executed: allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
Execution Count:2557
2557
1598 }
executed: }
Execution Count:834
834
1599 }
executed: }
Execution Count:834
834
1600 -
1601 QtFontStyle::Key styleKey(style);
executed (the execution status of this line is deduced): QtFontStyle::Key styleKey(style);
-
1602 QtFontStyle *s = bestStyle(&allStyles, styleKey, style);
executed (the execution status of this line is deduced): QtFontStyle *s = bestStyle(&allStyles, styleKey, style);
-
1603 -
1604 if (!s) // no styles found?
partially evaluated: !s
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:834
0-834
1605 return QGuiApplication::font();
never executed: return QGuiApplication::font();
0
1606 -
1607 QFont fnt(family, pointSize, s->key.weight);
executed (the execution status of this line is deduced): QFont fnt(family, pointSize, s->key.weight);
-
1608 fnt.setStyle((QFont::Style)s->key.style);
executed (the execution status of this line is deduced): fnt.setStyle((QFont::Style)s->key.style);
-
1609 if (!s->styleName.isEmpty())
evaluated: !s->styleName.isEmpty()
TRUEFALSE
yes
Evaluation Count:761
yes
Evaluation Count:73
73-761
1610 fnt.setStyleName(s->styleName);
executed: fnt.setStyleName(s->styleName);
Execution Count:761
761
1611 return fnt;
executed: return fnt;
Execution Count:834
834
1612} -
1613 -
1614 -
1615/*! -
1616 Returns the point sizes of a font that has family \a family and -
1617 style \a styleName that will look attractive. The list may be empty. -
1618 For non-scalable fonts and bitmap scalable fonts, this function -
1619 is equivalent to pointSizes(). -
1620 -
1621 \sa pointSizes(), standardSizes() -
1622*/ -
1623QList<int> QFontDatabase::smoothSizes(const QString &family, -
1624 const QString &styleName) -
1625{ -
1626 if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable())
never evaluated: QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()
0
1627 return standardSizes();
never executed: return standardSizes();
0
1628 -
1629 bool smoothScalable = false;
never executed (the execution status of this line is deduced): bool smoothScalable = false;
-
1630 QString familyName, foundryName;
never executed (the execution status of this line is deduced): QString familyName, foundryName;
-
1631 parseFontName(family, foundryName, familyName);
never executed (the execution status of this line is deduced): parseFontName(family, foundryName, familyName);
-
1632 -
1633 QMutexLocker locker(fontDatabaseMutex());
never executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1634 -
1635 QT_PREPEND_NAMESPACE(load)(familyName);
never executed (the execution status of this line is deduced): ::load(familyName);
-
1636 -
1637 QtFontStyle::Key styleKey(styleName);
never executed (the execution status of this line is deduced): QtFontStyle::Key styleKey(styleName);
-
1638 -
1639 QList<int> sizes;
never executed (the execution status of this line is deduced): QList<int> sizes;
-
1640 -
1641 QtFontFamily *fam = d->family(familyName);
never executed (the execution status of this line is deduced): QtFontFamily *fam = d->family(familyName);
-
1642 if (!fam)
never evaluated: !fam
0
1643 return sizes;
never executed: return sizes;
0
1644 -
1645 const int dpi = qt_defaultDpiY(); // embedded
never executed (the execution status of this line is deduced): const int dpi = qt_defaultDpiY();
-
1646 -
1647 for (int j = 0; j < fam->count; j++) {
never evaluated: j < fam->count
0
1648 QtFontFoundry *foundry = fam->foundries[j];
never executed (the execution status of this line is deduced): QtFontFoundry *foundry = fam->foundries[j];
-
1649 if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
never evaluated: foundryName.isEmpty()
never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
0
1650 QtFontStyle *style = foundry->style(styleKey, styleName);
never executed (the execution status of this line is deduced): QtFontStyle *style = foundry->style(styleKey, styleName);
-
1651 if (!style) continue;
never executed: continue;
never evaluated: !style
0
1652 -
1653 if (style->smoothScalable) {
never evaluated: style->smoothScalable
0
1654 smoothScalable = true;
never executed (the execution status of this line is deduced): smoothScalable = true;
-
1655 goto end;
never executed: goto end;
0
1656 } -
1657 for (int l = 0; l < style->count; l++) {
never evaluated: l < style->count
0
1658 const QtFontSize *size = style->pixelSizes + l;
never executed (the execution status of this line is deduced): const QtFontSize *size = style->pixelSizes + l;
-
1659 -
1660 if (size->pixelSize != 0 && size->pixelSize != USHRT_MAX) {
never evaluated: size->pixelSize != 0
never evaluated: size->pixelSize != (32767 * 2 + 1)
0
1661 const uint pointSize = qRound(size->pixelSize * 72.0 / dpi);
never executed (the execution status of this line is deduced): const uint pointSize = qRound(size->pixelSize * 72.0 / dpi);
-
1662 if (! sizes.contains(pointSize))
never evaluated: ! sizes.contains(pointSize)
0
1663 sizes.append(pointSize);
never executed: sizes.append(pointSize);
0
1664 }
never executed: }
0
1665 }
never executed: }
0
1666 }
never executed: }
0
1667 }
never executed: }
0
1668 end:
code before this statement never executed: end:
0
1669 if (smoothScalable)
never evaluated: smoothScalable
0
1670 return QFontDatabase::standardSizes();
never executed: return QFontDatabase::standardSizes();
0
1671 -
1672 qSort(sizes);
never executed (the execution status of this line is deduced): qSort(sizes);
-
1673 return sizes;
never executed: return sizes;
0
1674} -
1675 -
1676 -
1677/*! -
1678 Returns a list of standard font sizes. -
1679 -
1680 \sa smoothSizes(), pointSizes() -
1681*/ -
1682QList<int> QFontDatabase::standardSizes() -
1683{ -
1684 return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->standardSizes();
executed: return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->standardSizes();
Execution Count:209
209
1685} -
1686 -
1687 -
1688/*! -
1689 Returns true if the font that has family \a family and style \a -
1690 style is italic; otherwise returns false. -
1691 -
1692 \sa weight(), bold() -
1693*/ -
1694bool QFontDatabase::italic(const QString &family, const QString &style) const -
1695{ -
1696 QString familyName, foundryName;
never executed (the execution status of this line is deduced): QString familyName, foundryName;
-
1697 parseFontName(family, foundryName, familyName);
never executed (the execution status of this line is deduced): parseFontName(family, foundryName, familyName);
-
1698 -
1699 QMutexLocker locker(fontDatabaseMutex());
never executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1700 -
1701 QT_PREPEND_NAMESPACE(load)(familyName);
never executed (the execution status of this line is deduced): ::load(familyName);
-
1702 -
1703 QtFontFoundry allStyles(foundryName);
never executed (the execution status of this line is deduced): QtFontFoundry allStyles(foundryName);
-
1704 QtFontFamily *f = d->family(familyName);
never executed (the execution status of this line is deduced): QtFontFamily *f = d->family(familyName);
-
1705 if (!f) return false;
never executed: return false;
never evaluated: !f
0
1706 -
1707 for (int j = 0; j < f->count; j++) {
never evaluated: j < f->count
0
1708 QtFontFoundry *foundry = f->foundries[j];
never executed (the execution status of this line is deduced): QtFontFoundry *foundry = f->foundries[j];
-
1709 if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
never evaluated: foundryName.isEmpty()
never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
0
1710 for (int k = 0; k < foundry->count; k++)
never evaluated: k < foundry->count
0
1711 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
1712 }
never executed: }
0
1713 }
never executed: }
0
1714 -
1715 QtFontStyle::Key styleKey(style);
never executed (the execution status of this line is deduced): QtFontStyle::Key styleKey(style);
-
1716 QtFontStyle *s = allStyles.style(styleKey, style);
never executed (the execution status of this line is deduced): QtFontStyle *s = allStyles.style(styleKey, style);
-
1717 return s && s->key.style == QFont::StyleItalic;
never executed: return s && s->key.style == QFont::StyleItalic;
0
1718} -
1719 -
1720 -
1721/*! -
1722 Returns true if the font that has family \a family and style \a -
1723 style is bold; otherwise returns false. -
1724 -
1725 \sa italic(), weight() -
1726*/ -
1727bool QFontDatabase::bold(const QString &family, -
1728 const QString &style) const -
1729{ -
1730 QString familyName, foundryName;
never executed (the execution status of this line is deduced): QString familyName, foundryName;
-
1731 parseFontName(family, foundryName, familyName);
never executed (the execution status of this line is deduced): parseFontName(family, foundryName, familyName);
-
1732 -
1733 QMutexLocker locker(fontDatabaseMutex());
never executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1734 -
1735 QT_PREPEND_NAMESPACE(load)(familyName);
never executed (the execution status of this line is deduced): ::load(familyName);
-
1736 -
1737 QtFontFoundry allStyles(foundryName);
never executed (the execution status of this line is deduced): QtFontFoundry allStyles(foundryName);
-
1738 QtFontFamily *f = d->family(familyName);
never executed (the execution status of this line is deduced): QtFontFamily *f = d->family(familyName);
-
1739 if (!f) return false;
never executed: return false;
never evaluated: !f
0
1740 -
1741 for (int j = 0; j < f->count; j++) {
never evaluated: j < f->count
0
1742 QtFontFoundry *foundry = f->foundries[j];
never executed (the execution status of this line is deduced): QtFontFoundry *foundry = f->foundries[j];
-
1743 if (foundryName.isEmpty() ||
never evaluated: foundryName.isEmpty()
0
1744 foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
0
1745 for (int k = 0; k < foundry->count; k++)
never evaluated: k < foundry->count
0
1746 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
1747 }
never executed: }
0
1748 }
never executed: }
0
1749 -
1750 QtFontStyle::Key styleKey(style);
never executed (the execution status of this line is deduced): QtFontStyle::Key styleKey(style);
-
1751 QtFontStyle *s = allStyles.style(styleKey, style);
never executed (the execution status of this line is deduced): QtFontStyle *s = allStyles.style(styleKey, style);
-
1752 return s && s->key.weight >= QFont::Bold;
never executed: return s && s->key.weight >= QFont::Bold;
0
1753} -
1754 -
1755 -
1756/*! -
1757 Returns the weight of the font that has family \a family and style -
1758 \a style. If there is no such family and style combination, -
1759 returns -1. -
1760 -
1761 \sa italic(), bold() -
1762*/ -
1763int QFontDatabase::weight(const QString &family, -
1764 const QString &style) const -
1765{ -
1766 QString familyName, foundryName;
never executed (the execution status of this line is deduced): QString familyName, foundryName;
-
1767 parseFontName(family, foundryName, familyName);
never executed (the execution status of this line is deduced): parseFontName(family, foundryName, familyName);
-
1768 -
1769 QMutexLocker locker(fontDatabaseMutex());
never executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
1770 -
1771 QT_PREPEND_NAMESPACE(load)(familyName);
never executed (the execution status of this line is deduced): ::load(familyName);
-
1772 -
1773 QtFontFoundry allStyles(foundryName);
never executed (the execution status of this line is deduced): QtFontFoundry allStyles(foundryName);
-
1774 QtFontFamily *f = d->family(familyName);
never executed (the execution status of this line is deduced): QtFontFamily *f = d->family(familyName);
-
1775 if (!f) return -1;
never executed: return -1;
never evaluated: !f
0
1776 -
1777 for (int j = 0; j < f->count; j++) {
never evaluated: j < f->count
0
1778 QtFontFoundry *foundry = f->foundries[j];
never executed (the execution status of this line is deduced): QtFontFoundry *foundry = f->foundries[j];
-
1779 if (foundryName.isEmpty() ||
never evaluated: foundryName.isEmpty()
0
1780 foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0
0
1781 for (int k = 0; k < foundry->count; k++)
never evaluated: k < foundry->count
0
1782 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
1783 }
never executed: }
0
1784 }
never executed: }
0
1785 -
1786 QtFontStyle::Key styleKey(style);
never executed (the execution status of this line is deduced): QtFontStyle::Key styleKey(style);
-
1787 QtFontStyle *s = allStyles.style(styleKey, style);
never executed (the execution status of this line is deduced): QtFontStyle *s = allStyles.style(styleKey, style);
-
1788 return s ? s->key.weight : -1;
never executed: return s ? s->key.weight : -1;
0
1789} -
1790 -
1791 -
1792/*! \internal */ -
1793bool QFontDatabase::hasFamily(const QString &family) const -
1794{ -
1795 QString parsedFamily, foundry;
executed (the execution status of this line is deduced): QString parsedFamily, foundry;
-
1796 parseFontName(family, foundry, parsedFamily);
executed (the execution status of this line is deduced): parseFontName(family, foundry, parsedFamily);
-
1797 const QString familyAlias = resolveFontFamilyAlias(parsedFamily);
executed (the execution status of this line is deduced): const QString familyAlias = resolveFontFamilyAlias(parsedFamily);
-
1798 return families().contains(familyAlias, Qt::CaseInsensitive);
executed: return families().contains(familyAlias, Qt::CaseInsensitive);
Execution Count:5
5
1799} -
1800 -
1801 -
1802/*! -
1803 Returns the names the \a writingSystem (e.g. for displaying to the -
1804 user in a dialog). -
1805*/ -
1806QString QFontDatabase::writingSystemName(WritingSystem writingSystem) -
1807{ -
1808 const char *name = 0;
executed (the execution status of this line is deduced): const char *name = 0;
-
1809 switch (writingSystem) { -
1810 case Any: -
1811 name = QT_TRANSLATE_NOOP("QFontDatabase", "Any");
executed (the execution status of this line is deduced): name = "Any";
-
1812 break;
executed: break;
Execution Count:3
3
1813 case Latin: -
1814 name = QT_TRANSLATE_NOOP("QFontDatabase", "Latin");
executed (the execution status of this line is deduced): name = "Latin";
-
1815 break;
executed: break;
Execution Count:3
3
1816 case Greek: -
1817 name = QT_TRANSLATE_NOOP("QFontDatabase", "Greek");
executed (the execution status of this line is deduced): name = "Greek";
-
1818 break;
executed: break;
Execution Count:3
3
1819 case Cyrillic: -
1820 name = QT_TRANSLATE_NOOP("QFontDatabase", "Cyrillic");
executed (the execution status of this line is deduced): name = "Cyrillic";
-
1821 break;
executed: break;
Execution Count:3
3
1822 case Armenian: -
1823 name = QT_TRANSLATE_NOOP("QFontDatabase", "Armenian");
executed (the execution status of this line is deduced): name = "Armenian";
-
1824 break;
executed: break;
Execution Count:3
3
1825 case Hebrew: -
1826 name = QT_TRANSLATE_NOOP("QFontDatabase", "Hebrew");
executed (the execution status of this line is deduced): name = "Hebrew";
-
1827 break;
executed: break;
Execution Count:3
3
1828 case Arabic: -
1829 name = QT_TRANSLATE_NOOP("QFontDatabase", "Arabic");
executed (the execution status of this line is deduced): name = "Arabic";
-
1830 break;
executed: break;
Execution Count:3
3
1831 case Syriac: -
1832 name = QT_TRANSLATE_NOOP("QFontDatabase", "Syriac");
executed (the execution status of this line is deduced): name = "Syriac";
-
1833 break;
executed: break;
Execution Count:3
3
1834 case Thaana: -
1835 name = QT_TRANSLATE_NOOP("QFontDatabase", "Thaana");
executed (the execution status of this line is deduced): name = "Thaana";
-
1836 break;
executed: break;
Execution Count:3
3
1837 case Devanagari: -
1838 name = QT_TRANSLATE_NOOP("QFontDatabase", "Devanagari");
executed (the execution status of this line is deduced): name = "Devanagari";
-
1839 break;
executed: break;
Execution Count:3
3
1840 case Bengali: -
1841 name = QT_TRANSLATE_NOOP("QFontDatabase", "Bengali");
executed (the execution status of this line is deduced): name = "Bengali";
-
1842 break;
executed: break;
Execution Count:3
3
1843 case Gurmukhi: -
1844 name = QT_TRANSLATE_NOOP("QFontDatabase", "Gurmukhi");
executed (the execution status of this line is deduced): name = "Gurmukhi";
-
1845 break;
executed: break;
Execution Count:3
3
1846 case Gujarati: -
1847 name = QT_TRANSLATE_NOOP("QFontDatabase", "Gujarati");
executed (the execution status of this line is deduced): name = "Gujarati";
-
1848 break;
executed: break;
Execution Count:3
3
1849 case Oriya: -
1850 name = QT_TRANSLATE_NOOP("QFontDatabase", "Oriya");
executed (the execution status of this line is deduced): name = "Oriya";
-
1851 break;
executed: break;
Execution Count:3
3
1852 case Tamil: -
1853 name = QT_TRANSLATE_NOOP("QFontDatabase", "Tamil");
executed (the execution status of this line is deduced): name = "Tamil";
-
1854 break;
executed: break;
Execution Count:3
3
1855 case Telugu: -
1856 name = QT_TRANSLATE_NOOP("QFontDatabase", "Telugu");
executed (the execution status of this line is deduced): name = "Telugu";
-
1857 break;
executed: break;
Execution Count:3
3
1858 case Kannada: -
1859 name = QT_TRANSLATE_NOOP("QFontDatabase", "Kannada");
executed (the execution status of this line is deduced): name = "Kannada";
-
1860 break;
executed: break;
Execution Count:3
3
1861 case Malayalam: -
1862 name = QT_TRANSLATE_NOOP("QFontDatabase", "Malayalam");
executed (the execution status of this line is deduced): name = "Malayalam";
-
1863 break;
executed: break;
Execution Count:3
3
1864 case Sinhala: -
1865 name = QT_TRANSLATE_NOOP("QFontDatabase", "Sinhala");
executed (the execution status of this line is deduced): name = "Sinhala";
-
1866 break;
executed: break;
Execution Count:3
3
1867 case Thai: -
1868 name = QT_TRANSLATE_NOOP("QFontDatabase", "Thai");
executed (the execution status of this line is deduced): name = "Thai";
-
1869 break;
executed: break;
Execution Count:3
3
1870 case Lao: -
1871 name = QT_TRANSLATE_NOOP("QFontDatabase", "Lao");
executed (the execution status of this line is deduced): name = "Lao";
-
1872 break;
executed: break;
Execution Count:3
3
1873 case Tibetan: -
1874 name = QT_TRANSLATE_NOOP("QFontDatabase", "Tibetan");
executed (the execution status of this line is deduced): name = "Tibetan";
-
1875 break;
executed: break;
Execution Count:3
3
1876 case Myanmar: -
1877 name = QT_TRANSLATE_NOOP("QFontDatabase", "Myanmar");
executed (the execution status of this line is deduced): name = "Myanmar";
-
1878 break;
executed: break;
Execution Count:3
3
1879 case Georgian: -
1880 name = QT_TRANSLATE_NOOP("QFontDatabase", "Georgian");
executed (the execution status of this line is deduced): name = "Georgian";
-
1881 break;
executed: break;
Execution Count:3
3
1882 case Khmer: -
1883 name = QT_TRANSLATE_NOOP("QFontDatabase", "Khmer");
executed (the execution status of this line is deduced): name = "Khmer";
-
1884 break;
executed: break;
Execution Count:3
3
1885 case SimplifiedChinese: -
1886 name = QT_TRANSLATE_NOOP("QFontDatabase", "Simplified Chinese");
executed (the execution status of this line is deduced): name = "Simplified Chinese";
-
1887 break;
executed: break;
Execution Count:3
3
1888 case TraditionalChinese: -
1889 name = QT_TRANSLATE_NOOP("QFontDatabase", "Traditional Chinese");
executed (the execution status of this line is deduced): name = "Traditional Chinese";
-
1890 break;
executed: break;
Execution Count:3
3
1891 case Japanese: -
1892 name = QT_TRANSLATE_NOOP("QFontDatabase", "Japanese");
executed (the execution status of this line is deduced): name = "Japanese";
-
1893 break;
executed: break;
Execution Count:3
3
1894 case Korean: -
1895 name = QT_TRANSLATE_NOOP("QFontDatabase", "Korean");
executed (the execution status of this line is deduced): name = "Korean";
-
1896 break;
executed: break;
Execution Count:3
3
1897 case Vietnamese: -
1898 name = QT_TRANSLATE_NOOP("QFontDatabase", "Vietnamese");
executed (the execution status of this line is deduced): name = "Vietnamese";
-
1899 break;
executed: break;
Execution Count:3
3
1900 case Symbol: -
1901 name = QT_TRANSLATE_NOOP("QFontDatabase", "Symbol");
executed (the execution status of this line is deduced): name = "Symbol";
-
1902 break;
executed: break;
Execution Count:3
3
1903 case Ogham: -
1904 name = QT_TRANSLATE_NOOP("QFontDatabase", "Ogham");
executed (the execution status of this line is deduced): name = "Ogham";
-
1905 break;
executed: break;
Execution Count:3
3
1906 case Runic: -
1907 name = QT_TRANSLATE_NOOP("QFontDatabase", "Runic");
executed (the execution status of this line is deduced): name = "Runic";
-
1908 break;
executed: break;
Execution Count:3
3
1909 case Nko: -
1910 name = QT_TRANSLATE_NOOP("QFontDatabase", "N'Ko");
executed (the execution status of this line is deduced): name = "N'Ko";
-
1911 break;
executed: break;
Execution Count:3
3
1912 default: -
1913 Q_ASSERT_X(false, "QFontDatabase::writingSystemName", "invalid 'writingSystem' parameter");
never executed (the execution status of this line is deduced): qt_noop();
-
1914 break;
never executed: break;
0
1915 } -
1916 return QCoreApplication::translate("QFontDatabase", name);
executed: return QCoreApplication::translate("QFontDatabase", name);
Execution Count:102
102
1917} -
1918 -
1919 -
1920/*! -
1921 Returns a string with sample characters from \a writingSystem. -
1922*/ -
1923QString QFontDatabase::writingSystemSample(WritingSystem writingSystem) -
1924{ -
1925 QString sample;
executed (the execution status of this line is deduced): QString sample;
-
1926 switch (writingSystem) { -
1927 case Any: -
1928 case Symbol: -
1929 // show only ascii characters -
1930 sample += QLatin1String("AaBbzZ");
never executed (the execution status of this line is deduced): sample += QLatin1String("AaBbzZ");
-
1931 break;
never executed: break;
0
1932 case Latin: -
1933 // This is cheating... we only show latin-1 characters so that we don't -
1934 // end up loading lots of fonts - at least on X11... -
1935 sample = QLatin1String("Aa");
never executed (the execution status of this line is deduced): sample = QLatin1String("Aa");
-
1936 sample += QChar(0x00C3);
never executed (the execution status of this line is deduced): sample += QChar(0x00C3);
-
1937 sample += QChar(0x00E1);
never executed (the execution status of this line is deduced): sample += QChar(0x00E1);
-
1938 sample += QLatin1String("Zz");
never executed (the execution status of this line is deduced): sample += QLatin1String("Zz");
-
1939 break;
never executed: break;
0
1940 case Greek: -
1941 sample += QChar(0x0393);
never executed (the execution status of this line is deduced): sample += QChar(0x0393);
-
1942 sample += QChar(0x03B1);
never executed (the execution status of this line is deduced): sample += QChar(0x03B1);
-
1943 sample += QChar(0x03A9);
never executed (the execution status of this line is deduced): sample += QChar(0x03A9);
-
1944 sample += QChar(0x03C9);
never executed (the execution status of this line is deduced): sample += QChar(0x03C9);
-
1945 break;
never executed: break;
0
1946 case Cyrillic: -
1947 sample += QChar(0x0414);
never executed (the execution status of this line is deduced): sample += QChar(0x0414);
-
1948 sample += QChar(0x0434);
never executed (the execution status of this line is deduced): sample += QChar(0x0434);
-
1949 sample += QChar(0x0436);
never executed (the execution status of this line is deduced): sample += QChar(0x0436);
-
1950 sample += QChar(0x044f);
never executed (the execution status of this line is deduced): sample += QChar(0x044f);
-
1951 break;
never executed: break;
0
1952 case Armenian: -
1953 sample += QChar(0x053f);
never executed (the execution status of this line is deduced): sample += QChar(0x053f);
-
1954 sample += QChar(0x054f);
never executed (the execution status of this line is deduced): sample += QChar(0x054f);
-
1955 sample += QChar(0x056f);
never executed (the execution status of this line is deduced): sample += QChar(0x056f);
-
1956 sample += QChar(0x057f);
never executed (the execution status of this line is deduced): sample += QChar(0x057f);
-
1957 break;
never executed: break;
0
1958 case Hebrew: -
1959 sample += QChar(0x05D0);
never executed (the execution status of this line is deduced): sample += QChar(0x05D0);
-
1960 sample += QChar(0x05D1);
never executed (the execution status of this line is deduced): sample += QChar(0x05D1);
-
1961 sample += QChar(0x05D2);
never executed (the execution status of this line is deduced): sample += QChar(0x05D2);
-
1962 sample += QChar(0x05D3);
never executed (the execution status of this line is deduced): sample += QChar(0x05D3);
-
1963 break;
never executed: break;
0
1964 case Arabic: -
1965 sample += QChar(0x0628);
executed (the execution status of this line is deduced): sample += QChar(0x0628);
-
1966 sample += QChar(0x0629);
executed (the execution status of this line is deduced): sample += QChar(0x0629);
-
1967 sample += QChar(0x062A);
executed (the execution status of this line is deduced): sample += QChar(0x062A);
-
1968 sample += QChar(0x063A);
executed (the execution status of this line is deduced): sample += QChar(0x063A);
-
1969 break;
executed: break;
Execution Count:4
4
1970 case Syriac: -
1971 sample += QChar(0x0715);
never executed (the execution status of this line is deduced): sample += QChar(0x0715);
-
1972 sample += QChar(0x0725);
never executed (the execution status of this line is deduced): sample += QChar(0x0725);
-
1973 sample += QChar(0x0716);
never executed (the execution status of this line is deduced): sample += QChar(0x0716);
-
1974 sample += QChar(0x0726);
never executed (the execution status of this line is deduced): sample += QChar(0x0726);
-
1975 break;
never executed: break;
0
1976 case Thaana: -
1977 sample += QChar(0x0784);
never executed (the execution status of this line is deduced): sample += QChar(0x0784);
-
1978 sample += QChar(0x0794);
never executed (the execution status of this line is deduced): sample += QChar(0x0794);
-
1979 sample += QChar(0x078c);
never executed (the execution status of this line is deduced): sample += QChar(0x078c);
-
1980 sample += QChar(0x078d);
never executed (the execution status of this line is deduced): sample += QChar(0x078d);
-
1981 break;
never executed: break;
0
1982 case Devanagari: -
1983 sample += QChar(0x0905);
never executed (the execution status of this line is deduced): sample += QChar(0x0905);
-
1984 sample += QChar(0x0915);
never executed (the execution status of this line is deduced): sample += QChar(0x0915);
-
1985 sample += QChar(0x0925);
never executed (the execution status of this line is deduced): sample += QChar(0x0925);
-
1986 sample += QChar(0x0935);
never executed (the execution status of this line is deduced): sample += QChar(0x0935);
-
1987 break;
never executed: break;
0
1988 case Bengali: -
1989 sample += QChar(0x0986);
never executed (the execution status of this line is deduced): sample += QChar(0x0986);
-
1990 sample += QChar(0x0996);
never executed (the execution status of this line is deduced): sample += QChar(0x0996);
-
1991 sample += QChar(0x09a6);
never executed (the execution status of this line is deduced): sample += QChar(0x09a6);
-
1992 sample += QChar(0x09b6);
never executed (the execution status of this line is deduced): sample += QChar(0x09b6);
-
1993 break;
never executed: break;
0
1994 case Gurmukhi: -
1995 sample += QChar(0x0a05);
never executed (the execution status of this line is deduced): sample += QChar(0x0a05);
-
1996 sample += QChar(0x0a15);
never executed (the execution status of this line is deduced): sample += QChar(0x0a15);
-
1997 sample += QChar(0x0a25);
never executed (the execution status of this line is deduced): sample += QChar(0x0a25);
-
1998 sample += QChar(0x0a35);
never executed (the execution status of this line is deduced): sample += QChar(0x0a35);
-
1999 break;
never executed: break;
0
2000 case Gujarati: -
2001 sample += QChar(0x0a85);
never executed (the execution status of this line is deduced): sample += QChar(0x0a85);
-
2002 sample += QChar(0x0a95);
never executed (the execution status of this line is deduced): sample += QChar(0x0a95);
-
2003 sample += QChar(0x0aa5);
never executed (the execution status of this line is deduced): sample += QChar(0x0aa5);
-
2004 sample += QChar(0x0ab5);
never executed (the execution status of this line is deduced): sample += QChar(0x0ab5);
-
2005 break;
never executed: break;
0
2006 case Oriya: -
2007 sample += QChar(0x0b06);
never executed (the execution status of this line is deduced): sample += QChar(0x0b06);
-
2008 sample += QChar(0x0b16);
never executed (the execution status of this line is deduced): sample += QChar(0x0b16);
-
2009 sample += QChar(0x0b2b);
never executed (the execution status of this line is deduced): sample += QChar(0x0b2b);
-
2010 sample += QChar(0x0b36);
never executed (the execution status of this line is deduced): sample += QChar(0x0b36);
-
2011 break;
never executed: break;
0
2012 case Tamil: -
2013 sample += QChar(0x0b89);
never executed (the execution status of this line is deduced): sample += QChar(0x0b89);
-
2014 sample += QChar(0x0b99);
never executed (the execution status of this line is deduced): sample += QChar(0x0b99);
-
2015 sample += QChar(0x0ba9);
never executed (the execution status of this line is deduced): sample += QChar(0x0ba9);
-
2016 sample += QChar(0x0bb9);
never executed (the execution status of this line is deduced): sample += QChar(0x0bb9);
-
2017 break;
never executed: break;
0
2018 case Telugu: -
2019 sample += QChar(0x0c05);
never executed (the execution status of this line is deduced): sample += QChar(0x0c05);
-
2020 sample += QChar(0x0c15);
never executed (the execution status of this line is deduced): sample += QChar(0x0c15);
-
2021 sample += QChar(0x0c25);
never executed (the execution status of this line is deduced): sample += QChar(0x0c25);
-
2022 sample += QChar(0x0c35);
never executed (the execution status of this line is deduced): sample += QChar(0x0c35);
-
2023 break;
never executed: break;
0
2024 case Kannada: -
2025 sample += QChar(0x0c85);
never executed (the execution status of this line is deduced): sample += QChar(0x0c85);
-
2026 sample += QChar(0x0c95);
never executed (the execution status of this line is deduced): sample += QChar(0x0c95);
-
2027 sample += QChar(0x0ca5);
never executed (the execution status of this line is deduced): sample += QChar(0x0ca5);
-
2028 sample += QChar(0x0cb5);
never executed (the execution status of this line is deduced): sample += QChar(0x0cb5);
-
2029 break;
never executed: break;
0
2030 case Malayalam: -
2031 sample += QChar(0x0d05);
never executed (the execution status of this line is deduced): sample += QChar(0x0d05);
-
2032 sample += QChar(0x0d15);
never executed (the execution status of this line is deduced): sample += QChar(0x0d15);
-
2033 sample += QChar(0x0d25);
never executed (the execution status of this line is deduced): sample += QChar(0x0d25);
-
2034 sample += QChar(0x0d35);
never executed (the execution status of this line is deduced): sample += QChar(0x0d35);
-
2035 break;
never executed: break;
0
2036 case Sinhala: -
2037 sample += QChar(0x0d90);
never executed (the execution status of this line is deduced): sample += QChar(0x0d90);
-
2038 sample += QChar(0x0da0);
never executed (the execution status of this line is deduced): sample += QChar(0x0da0);
-
2039 sample += QChar(0x0db0);
never executed (the execution status of this line is deduced): sample += QChar(0x0db0);
-
2040 sample += QChar(0x0dc0);
never executed (the execution status of this line is deduced): sample += QChar(0x0dc0);
-
2041 break;
never executed: break;
0
2042 case Thai: -
2043 sample += QChar(0x0e02);
never executed (the execution status of this line is deduced): sample += QChar(0x0e02);
-
2044 sample += QChar(0x0e12);
never executed (the execution status of this line is deduced): sample += QChar(0x0e12);
-
2045 sample += QChar(0x0e22);
never executed (the execution status of this line is deduced): sample += QChar(0x0e22);
-
2046 sample += QChar(0x0e32);
never executed (the execution status of this line is deduced): sample += QChar(0x0e32);
-
2047 break;
never executed: break;
0
2048 case Lao: -
2049 sample += QChar(0x0e8d);
never executed (the execution status of this line is deduced): sample += QChar(0x0e8d);
-
2050 sample += QChar(0x0e9d);
never executed (the execution status of this line is deduced): sample += QChar(0x0e9d);
-
2051 sample += QChar(0x0ead);
never executed (the execution status of this line is deduced): sample += QChar(0x0ead);
-
2052 sample += QChar(0x0ebd);
never executed (the execution status of this line is deduced): sample += QChar(0x0ebd);
-
2053 break;
never executed: break;
0
2054 case Tibetan: -
2055 sample += QChar(0x0f00);
never executed (the execution status of this line is deduced): sample += QChar(0x0f00);
-
2056 sample += QChar(0x0f01);
never executed (the execution status of this line is deduced): sample += QChar(0x0f01);
-
2057 sample += QChar(0x0f02);
never executed (the execution status of this line is deduced): sample += QChar(0x0f02);
-
2058 sample += QChar(0x0f03);
never executed (the execution status of this line is deduced): sample += QChar(0x0f03);
-
2059 break;
never executed: break;
0
2060 case Myanmar: -
2061 sample += QChar(0x1000);
never executed (the execution status of this line is deduced): sample += QChar(0x1000);
-
2062 sample += QChar(0x1001);
never executed (the execution status of this line is deduced): sample += QChar(0x1001);
-
2063 sample += QChar(0x1002);
never executed (the execution status of this line is deduced): sample += QChar(0x1002);
-
2064 sample += QChar(0x1003);
never executed (the execution status of this line is deduced): sample += QChar(0x1003);
-
2065 break;
never executed: break;
0
2066 case Georgian: -
2067 sample += QChar(0x10a0);
never executed (the execution status of this line is deduced): sample += QChar(0x10a0);
-
2068 sample += QChar(0x10b0);
never executed (the execution status of this line is deduced): sample += QChar(0x10b0);
-
2069 sample += QChar(0x10c0);
never executed (the execution status of this line is deduced): sample += QChar(0x10c0);
-
2070 sample += QChar(0x10d0);
never executed (the execution status of this line is deduced): sample += QChar(0x10d0);
-
2071 break;
never executed: break;
0
2072 case Khmer: -
2073 sample += QChar(0x1780);
never executed (the execution status of this line is deduced): sample += QChar(0x1780);
-
2074 sample += QChar(0x1790);
never executed (the execution status of this line is deduced): sample += QChar(0x1790);
-
2075 sample += QChar(0x17b0);
never executed (the execution status of this line is deduced): sample += QChar(0x17b0);
-
2076 sample += QChar(0x17c0);
never executed (the execution status of this line is deduced): sample += QChar(0x17c0);
-
2077 break;
never executed: break;
0
2078 case SimplifiedChinese: -
2079 sample += QChar(0x4e2d);
never executed (the execution status of this line is deduced): sample += QChar(0x4e2d);
-
2080 sample += QChar(0x6587);
never executed (the execution status of this line is deduced): sample += QChar(0x6587);
-
2081 sample += QChar(0x8303);
never executed (the execution status of this line is deduced): sample += QChar(0x8303);
-
2082 sample += QChar(0x4f8b);
never executed (the execution status of this line is deduced): sample += QChar(0x4f8b);
-
2083 break;
never executed: break;
0
2084 case TraditionalChinese: -
2085 sample += QChar(0x4e2d);
never executed (the execution status of this line is deduced): sample += QChar(0x4e2d);
-
2086 sample += QChar(0x6587);
never executed (the execution status of this line is deduced): sample += QChar(0x6587);
-
2087 sample += QChar(0x7bc4);
never executed (the execution status of this line is deduced): sample += QChar(0x7bc4);
-
2088 sample += QChar(0x4f8b);
never executed (the execution status of this line is deduced): sample += QChar(0x4f8b);
-
2089 break;
never executed: break;
0
2090 case Japanese: -
2091 sample += QChar(0x30b5);
never executed (the execution status of this line is deduced): sample += QChar(0x30b5);
-
2092 sample += QChar(0x30f3);
never executed (the execution status of this line is deduced): sample += QChar(0x30f3);
-
2093 sample += QChar(0x30d7);
never executed (the execution status of this line is deduced): sample += QChar(0x30d7);
-
2094 sample += QChar(0x30eb);
never executed (the execution status of this line is deduced): sample += QChar(0x30eb);
-
2095 sample += QChar(0x3067);
never executed (the execution status of this line is deduced): sample += QChar(0x3067);
-
2096 sample += QChar(0x3059);
never executed (the execution status of this line is deduced): sample += QChar(0x3059);
-
2097 break;
never executed: break;
0
2098 case Korean: -
2099 sample += QChar(0xac00);
never executed (the execution status of this line is deduced): sample += QChar(0xac00);
-
2100 sample += QChar(0xac11);
never executed (the execution status of this line is deduced): sample += QChar(0xac11);
-
2101 sample += QChar(0xac1a);
never executed (the execution status of this line is deduced): sample += QChar(0xac1a);
-
2102 sample += QChar(0xac2f);
never executed (the execution status of this line is deduced): sample += QChar(0xac2f);
-
2103 break;
never executed: break;
0
2104 case Vietnamese: -
2105 { -
2106 static const char vietnameseUtf8[] = { -
2107 char(0xef), char(0xbb), char(0xbf), char(0xe1), char(0xbb), char(0x97), -
2108 char(0xe1), char(0xbb), char(0x99), -
2109 char(0xe1), char(0xbb), char(0x91), -
2110 char(0xe1), char(0xbb), char(0x93), -
2111 }; -
2112 sample += QString::fromUtf8(vietnameseUtf8, sizeof(vietnameseUtf8));
never executed (the execution status of this line is deduced): sample += QString::fromUtf8(vietnameseUtf8, sizeof(vietnameseUtf8));
-
2113 break;
never executed: break;
0
2114 } -
2115 case Ogham: -
2116 sample += QChar(0x1681);
never executed (the execution status of this line is deduced): sample += QChar(0x1681);
-
2117 sample += QChar(0x1682);
never executed (the execution status of this line is deduced): sample += QChar(0x1682);
-
2118 sample += QChar(0x1683);
never executed (the execution status of this line is deduced): sample += QChar(0x1683);
-
2119 sample += QChar(0x1684);
never executed (the execution status of this line is deduced): sample += QChar(0x1684);
-
2120 break;
never executed: break;
0
2121 case Runic: -
2122 sample += QChar(0x16a0);
never executed (the execution status of this line is deduced): sample += QChar(0x16a0);
-
2123 sample += QChar(0x16a1);
never executed (the execution status of this line is deduced): sample += QChar(0x16a1);
-
2124 sample += QChar(0x16a2);
never executed (the execution status of this line is deduced): sample += QChar(0x16a2);
-
2125 sample += QChar(0x16a3);
never executed (the execution status of this line is deduced): sample += QChar(0x16a3);
-
2126 break;
never executed: break;
0
2127 case Nko: -
2128 sample += QChar(0x7ca);
never executed (the execution status of this line is deduced): sample += QChar(0x7ca);
-
2129 sample += QChar(0x7cb);
never executed (the execution status of this line is deduced): sample += QChar(0x7cb);
-
2130 sample += QChar(0x7cc);
never executed (the execution status of this line is deduced): sample += QChar(0x7cc);
-
2131 sample += QChar(0x7cd);
never executed (the execution status of this line is deduced): sample += QChar(0x7cd);
-
2132 break;
never executed: break;
0
2133 default: -
2134 break;
never executed: break;
0
2135 } -
2136 return sample;
executed: return sample;
Execution Count:4
4
2137} -
2138 -
2139 -
2140void QFontDatabase::parseFontName(const QString &name, QString &foundry, QString &family) -
2141{ -
2142 QT_PREPEND_NAMESPACE(parseFontName)(name, foundry, family);
executed (the execution status of this line is deduced): ::parseFontName(name, foundry, family);
-
2143}
executed: }
Execution Count:3908
3908
2144 -
2145void QFontDatabase::createDatabase() -
2146{ initializeDb(); }
executed: }
Execution Count:374
374
2147 -
2148// used from qfontengine_ft.cpp -
2149Q_GUI_EXPORT QByteArray qt_fontdata_from_index(int index) -
2150{ -
2151 QMutexLocker locker(fontDatabaseMutex());
never executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
2152 return privateDb()->applicationFonts.value(index).data;
never executed: return privateDb()->applicationFonts.value(index).data;
0
2153} -
2154 -
2155int QFontDatabasePrivate::addAppFont(const QByteArray &fontData, const QString &fileName) -
2156{ -
2157 QFontDatabasePrivate::ApplicationFont font;
executed (the execution status of this line is deduced): QFontDatabasePrivate::ApplicationFont font;
-
2158 font.data = fontData;
executed (the execution status of this line is deduced): font.data = fontData;
-
2159 font.fileName = fileName;
executed (the execution status of this line is deduced): font.fileName = fileName;
-
2160 -
2161 int i;
executed (the execution status of this line is deduced): int i;
-
2162 for (i = 0; i < applicationFonts.count(); ++i)
evaluated: i < applicationFonts.count()
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:4
4-17
2163 if (applicationFonts.at(i).families.isEmpty())
partially evaluated: applicationFonts.at(i).families.isEmpty()
TRUEFALSE
yes
Evaluation Count:17
no
Evaluation Count:0
0-17
2164 break;
executed: break;
Execution Count:17
17
2165 if (i >= applicationFonts.count()) {
evaluated: i >= applicationFonts.count()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:17
4-17
2166 applicationFonts.append(ApplicationFont());
executed (the execution status of this line is deduced): applicationFonts.append(ApplicationFont());
-
2167 i = applicationFonts.count() - 1;
executed (the execution status of this line is deduced): i = applicationFonts.count() - 1;
-
2168 }
executed: }
Execution Count:4
4
2169 -
2170 if (font.fileName.isEmpty() && !fontData.isEmpty())
evaluated: font.fileName.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:20
partially evaluated: !fontData.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-20
2171 font.fileName = QString::fromLatin1(":qmemoryfonts/") + QString::number(i);
executed: font.fileName = QString::fromLatin1(":qmemoryfonts/") + QString::number(i);
Execution Count:1
1
2172 -
2173 registerFont(&font);
executed (the execution status of this line is deduced): registerFont(&font);
-
2174 if (font.families.isEmpty())
partially evaluated: font.families.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
2175 return -1;
never executed: return -1;
0
2176 -
2177 applicationFonts[i] = font;
executed (the execution status of this line is deduced): applicationFonts[i] = font;
-
2178 -
2179 invalidate();
executed (the execution status of this line is deduced): invalidate();
-
2180 return i;
executed: return i;
Execution Count:21
21
2181} -
2182 -
2183bool QFontDatabasePrivate::isApplicationFont(const QString &fileName) -
2184{ -
2185 for (int i = 0; i < applicationFonts.count(); ++i)
never evaluated: i < applicationFonts.count()
0
2186 if (applicationFonts.at(i).fileName == fileName)
never evaluated: applicationFonts.at(i).fileName == fileName
0
2187 return true;
never executed: return true;
0
2188 return false;
never executed: return false;
0
2189} -
2190 -
2191/*! -
2192 \since 4.2 -
2193 -
2194 Loads the font from the file specified by \a fileName and makes it available to -
2195 the application. An ID is returned that can be used to remove the font again -
2196 with removeApplicationFont() or to retrieve the list of family names contained -
2197 in the font. -
2198 -
2199 The function returns -1 if the font could not be loaded. -
2200 -
2201 Currently only TrueType fonts, TrueType font collections, and OpenType fonts are -
2202 supported. -
2203 -
2204 \note Adding application fonts on Unix/X11 platforms without fontconfig is -
2205 currently not supported. -
2206 -
2207 \sa addApplicationFontFromData(), applicationFontFamilies(), removeApplicationFont() -
2208*/ -
2209int QFontDatabase::addApplicationFont(const QString &fileName) -
2210{ -
2211 QByteArray data;
executed (the execution status of this line is deduced): QByteArray data;
-
2212 if (!QFileInfo(fileName).isNativePath()) {
evaluated: !QFileInfo(fileName).isNativePath()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:19
1-19
2213 QFile f(fileName);
executed (the execution status of this line is deduced): QFile f(fileName);
-
2214 if (!f.open(QIODevice::ReadOnly))
partially evaluated: !f.open(QIODevice::ReadOnly)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2215 return -1;
never executed: return -1;
0
2216 data = f.readAll();
executed (the execution status of this line is deduced): data = f.readAll();
-
2217 }
executed: }
Execution Count:1
1
2218 QMutexLocker locker(fontDatabaseMutex());
executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
2219 return privateDb()->addAppFont(data, fileName);
executed: return privateDb()->addAppFont(data, fileName);
Execution Count:20
20
2220} -
2221 -
2222/*! -
2223 \since 4.2 -
2224 -
2225 Loads the font from binary data specified by \a fontData and makes it available to -
2226 the application. An ID is returned that can be used to remove the font again -
2227 with removeApplicationFont() or to retrieve the list of family names contained -
2228 in the font. -
2229 -
2230 The function returns -1 if the font could not be loaded. -
2231 -
2232 Currently only TrueType fonts and TrueType font collections are supported. -
2233 -
2234 \b{Note:} Adding application fonts on Unix/X11 platforms without fontconfig is -
2235 currently not supported. -
2236 -
2237 \sa addApplicationFont(), applicationFontFamilies(), removeApplicationFont() -
2238*/ -
2239int QFontDatabase::addApplicationFontFromData(const QByteArray &fontData) -
2240{ -
2241 QMutexLocker locker(fontDatabaseMutex());
executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
2242 return privateDb()->addAppFont(fontData, QString() /* fileName */);
executed: return privateDb()->addAppFont(fontData, QString() );
Execution Count:1
1
2243} -
2244 -
2245/*! -
2246 \since 4.2 -
2247 -
2248 Returns a list of font families for the given application font identified by -
2249 \a id. -
2250 -
2251 \sa addApplicationFont(), addApplicationFontFromData() -
2252*/ -
2253QStringList QFontDatabase::applicationFontFamilies(int id) -
2254{ -
2255 QMutexLocker locker(fontDatabaseMutex());
executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
2256 return privateDb()->applicationFonts.value(id).families;
executed: return privateDb()->applicationFonts.value(id).families;
Execution Count:2
2
2257} -
2258 -
2259/*! -
2260 \fn bool QFontDatabase::removeApplicationFont(int id) -
2261 \since 4.2 -
2262 -
2263 Removes the previously loaded application font identified by \a -
2264 id. Returns true if unloading of the font succeeded; otherwise -
2265 returns false. -
2266 -
2267 \sa removeAllApplicationFonts(), addApplicationFont(), -
2268 addApplicationFontFromData() -
2269*/ -
2270 -
2271/*! -
2272 \fn bool QFontDatabase::removeAllApplicationFonts() -
2273 \since 4.2 -
2274 -
2275 Removes all application-local fonts previously added using addApplicationFont() -
2276 and addApplicationFontFromData(). -
2277 -
2278 Returns true if unloading of the fonts succeeded; otherwise -
2279 returns false. -
2280 -
2281 \sa removeApplicationFont(), addApplicationFont(), addApplicationFontFromData() -
2282*/ -
2283 -
2284/*! -
2285 \fn bool QFontDatabase::supportsThreadedFontRendering() -
2286 \since 4.4 -
2287 -
2288 Returns true if font rendering is supported outside the GUI -
2289 thread, false otherwise. In other words, a return value of false -
2290 means that all QPainter::drawText() calls outside the GUI thread -
2291 will not produce readable output. -
2292 -
2293 \sa {Thread-Support in Qt Modules#Painting In Threads}{Painting In Threads} -
2294*/ -
2295 -
2296 -
2297QT_END_NAMESPACE -
2298 -
2299 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial