text/qfontdatabase_qpa.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 "qlibraryinfo.h" -
43#include <QtCore/qsettings.h> -
44 -
45#include "qfontengine_qpa_p.h" -
46#include "qplatformdefs.h" -
47 -
48#include <QtGui/private/qguiapplication_p.h> -
49#include <qpa/qplatformfontdatabase.h> -
50 -
51#include <QtCore/qmath.h> -
52 -
53QT_BEGIN_NAMESPACE -
54 -
55Q_GUI_EXPORT void qt_registerFont(const QString &familyName, const QString &stylename, -
56 const QString &foundryname, int weight, -
57 QFont::Style style, int stretch, bool antialiased, -
58 bool scalable, int pixelSize, bool fixedPitch, -
59 const QSupportedWritingSystems &writingSystems, void *handle) -
60{ -
61 QFontDatabasePrivate *d = privateDb();
executed (the execution status of this line is deduced): QFontDatabasePrivate *d = privateDb();
-
62// qDebug() << "Adding font" << familyName << weight << style << pixelSize << antialiased; -
63 QtFontStyle::Key styleKey;
executed (the execution status of this line is deduced): QtFontStyle::Key styleKey;
-
64 styleKey.style = style;
executed (the execution status of this line is deduced): styleKey.style = style;
-
65 styleKey.weight = weight;
executed (the execution status of this line is deduced): styleKey.weight = weight;
-
66 styleKey.stretch = stretch;
executed (the execution status of this line is deduced): styleKey.stretch = stretch;
-
67 QtFontFamily *f = d->family(familyName, true);
executed (the execution status of this line is deduced): QtFontFamily *f = d->family(familyName, true);
-
68 f->fixedPitch = fixedPitch;
executed (the execution status of this line is deduced): f->fixedPitch = fixedPitch;
-
69 -
70 for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
evaluated: i < QFontDatabase::WritingSystemsCount
TRUEFALSE
yes
Evaluation Count:1752156
yes
Evaluation Count:51534
51534-1752156
71 if (writingSystems.supported(QFontDatabase::WritingSystem(i))) {
evaluated: writingSystems.supported(QFontDatabase::WritingSystem(i))
TRUEFALSE
yes
Evaluation Count:89758
yes
Evaluation Count:1662398
89758-1662398
72 f->writingSystems[i] = QtFontFamily::Supported;
executed (the execution status of this line is deduced): f->writingSystems[i] = QtFontFamily::Supported;
-
73 } else {
executed: }
Execution Count:89758
89758
74 f->writingSystems[i] = QtFontFamily::Unsupported;
executed (the execution status of this line is deduced): f->writingSystems[i] = QtFontFamily::Unsupported;
-
75 }
executed: }
Execution Count:1662398
1662398
76 } -
77 -
78 QtFontFoundry *foundry = f->foundry(foundryname, true);
executed (the execution status of this line is deduced): QtFontFoundry *foundry = f->foundry(foundryname, true);
-
79 QtFontStyle *fontStyle = foundry->style(styleKey, stylename, true);
executed (the execution status of this line is deduced): QtFontStyle *fontStyle = foundry->style(styleKey, stylename, true);
-
80 fontStyle->smoothScalable = scalable;
executed (the execution status of this line is deduced): fontStyle->smoothScalable = scalable;
-
81 fontStyle->antialiased = antialiased;
executed (the execution status of this line is deduced): fontStyle->antialiased = antialiased;
-
82 QtFontSize *size = fontStyle->pixelSize(pixelSize ? pixelSize : SMOOTH_SCALABLE, true);
executed (the execution status of this line is deduced): QtFontSize *size = fontStyle->pixelSize(pixelSize ? pixelSize : 0xffff, true);
-
83 if (size->handle) {
evaluated: size->handle
TRUEFALSE
yes
Evaluation Count:16163
yes
Evaluation Count:35371
16163-35371
84 QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();
executed (the execution status of this line is deduced): QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();
-
85 if (integration)
partially evaluated: integration
TRUEFALSE
yes
Evaluation Count:16163
no
Evaluation Count:0
0-16163
86 integration->fontDatabase()->releaseHandle(size->handle);
executed: integration->fontDatabase()->releaseHandle(size->handle);
Execution Count:16163
16163
87 }
executed: }
Execution Count:16163
16163
88 size->handle = handle;
executed (the execution status of this line is deduced): size->handle = handle;
-
89}
executed: }
Execution Count:51534
51534
90 -
91Q_GUI_EXPORT void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias) -
92{ -
93 if (alias.isEmpty())
never evaluated: alias.isEmpty()
0
94 return;
never executed: return;
0
95 -
96 QFontDatabasePrivate *d = privateDb();
never executed (the execution status of this line is deduced): QFontDatabasePrivate *d = privateDb();
-
97 QtFontFamily *f = d->family(familyName, false);
never executed (the execution status of this line is deduced): QtFontFamily *f = d->family(familyName, false);
-
98 if (!f)
never evaluated: !f
0
99 return;
never executed: return;
0
100 -
101 if (f->aliases.contains(alias, Qt::CaseInsensitive))
never evaluated: f->aliases.contains(alias, Qt::CaseInsensitive)
0
102 return;
never executed: return;
0
103 -
104 f->aliases.push_back(alias);
never executed (the execution status of this line is deduced): f->aliases.push_back(alias);
-
105}
never executed: }
0
106 -
107static QStringList fallbackFamilies(const QString &family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) -
108{ -
109 QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
executed (the execution status of this line is deduced): QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
-
110 QFontDatabasePrivate *db = privateDb();
executed (the execution status of this line is deduced): QFontDatabasePrivate *db = privateDb();
-
111 -
112 QStringList::iterator i;
executed (the execution status of this line is deduced): QStringList::iterator i;
-
113 for (i = retList.begin(); i != retList.end(); ++i) {
evaluated: i != retList.end()
TRUEFALSE
yes
Evaluation Count:51836
yes
Evaluation Count:593
593-51836
114 bool contains = false;
executed (the execution status of this line is deduced): bool contains = false;
-
115 for (int j = 0; j < db->count; j++) {
partially evaluated: j < db->count
TRUEFALSE
yes
Evaluation Count:2338652
no
Evaluation Count:0
0-2338652
116 QtFontFamily *qtFamily = db->families[j];
executed (the execution status of this line is deduced): QtFontFamily *qtFamily = db->families[j];
-
117 if (!(i->compare(qtFamily->name,Qt::CaseInsensitive))) {
evaluated: !(i->compare(qtFamily->name,Qt::CaseInsensitive))
TRUEFALSE
yes
Evaluation Count:51836
yes
Evaluation Count:2286816
51836-2286816
118 contains = true;
executed (the execution status of this line is deduced): contains = true;
-
119 break;
executed: break;
Execution Count:51836
51836
120 } -
121 }
executed: }
Execution Count:2286816
2286816
122 if (!contains) {
partially evaluated: !contains
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:51836
0-51836
123 i = retList.erase(i);
never executed (the execution status of this line is deduced): i = retList.erase(i);
-
124 i--;
never executed (the execution status of this line is deduced): i--;
-
125 }
never executed: }
0
126 }
executed: }
Execution Count:51836
51836
127 return retList;
executed: return retList;
Execution Count:593
593
128} -
129 -
130static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt); -
131 -
132static void initializeDb() -
133{ -
134 QFontDatabasePrivate *db = privateDb();
executed (the execution status of this line is deduced): QFontDatabasePrivate *db = privateDb();
-
135 -
136 // init by asking for the platformfontdb for the first time or after invalidation -
137 if (!db->count)
evaluated: !db->count
TRUEFALSE
yes
Evaluation Count:151
yes
Evaluation Count:352
151-352
138 QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
executed: QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
Execution Count:151
151
139 -
140 if (db->reregisterAppFonts) {
evaluated: db->reregisterAppFonts
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:462
41-462
141 for (int i = 0; i < db->applicationFonts.count(); i++) {
evaluated: i < db->applicationFonts.count()
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:41
41
142 if (!db->applicationFonts.at(i).families.isEmpty())
evaluated: !db->applicationFonts.at(i).families.isEmpty()
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:20
20-21
143 registerFont(&db->applicationFonts[i]);
executed: registerFont(&db->applicationFonts[i]);
Execution Count:21
21
144 }
executed: }
Execution Count:41
41
145 db->reregisterAppFonts = false;
executed (the execution status of this line is deduced): db->reregisterAppFonts = false;
-
146 }
executed: }
Execution Count:41
41
147}
executed: }
Execution Count:503
503
148 -
149static inline void load(const QString & = QString(), int = -1) -
150{ -
151 // Only initialize the database if it has been cleared or not initialized yet -
152 if (!privateDb()->count)
evaluated: !privateDb()->count
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4309
4-4309
153 initializeDb();
executed: initializeDb();
Execution Count:4
4
154}
executed: }
Execution Count:4313
4313
155 -
156static -
157QFontEngine *loadSingleEngine(int script, -
158 const QFontDef &request, -
159 QtFontFoundry *foundry, -
160 QtFontStyle *style, QtFontSize *size) -
161{ -
162 Q_UNUSED(foundry);
executed (the execution status of this line is deduced): (void)foundry;;
-
163 -
164 Q_ASSERT(size);
executed (the execution status of this line is deduced): qt_noop();
-
165 QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
executed (the execution status of this line is deduced): QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
-
166 int pixelSize = size->pixelSize;
executed (the execution status of this line is deduced): int pixelSize = size->pixelSize;
-
167 if (!pixelSize || (style->smoothScalable && pixelSize == SMOOTH_SCALABLE)
partially evaluated: !pixelSize
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:891
partially evaluated: style->smoothScalable
TRUEFALSE
yes
Evaluation Count:891
no
Evaluation Count:0
partially evaluated: pixelSize == 0xffff
TRUEFALSE
yes
Evaluation Count:891
no
Evaluation Count:0
0-891
168 || pfdb->fontsAlwaysScalable()) {
never evaluated: pfdb->fontsAlwaysScalable()
0
169 pixelSize = request.pixelSize;
executed (the execution status of this line is deduced): pixelSize = request.pixelSize;
-
170 }
executed: }
Execution Count:891
891
171 -
172 QFontDef def = request;
executed (the execution status of this line is deduced): QFontDef def = request;
-
173 def.pixelSize = pixelSize;
executed (the execution status of this line is deduced): def.pixelSize = pixelSize;
-
174 -
175 QFontCache::Key key(def,script);
executed (the execution status of this line is deduced): QFontCache::Key key(def,script);
-
176 QFontEngine *engine = QFontCache::instance()->findEngine(key);
executed (the execution status of this line is deduced): QFontEngine *engine = QFontCache::instance()->findEngine(key);
-
177 if (!engine) {
partially evaluated: !engine
TRUEFALSE
yes
Evaluation Count:891
no
Evaluation Count:0
0-891
178 engine = pfdb->fontEngine(def,QUnicodeTables::Script(script),size->handle);
executed (the execution status of this line is deduced): engine = pfdb->fontEngine(def,QUnicodeTables::Script(script),size->handle);
-
179 if (engine) {
evaluated: engine
TRUEFALSE
yes
Evaluation Count:626
yes
Evaluation Count:265
265-626
180 QFontCache::Key key(def,script);
executed (the execution status of this line is deduced): QFontCache::Key key(def,script);
-
181 QFontCache::instance()->instance()->insertEngine(key,engine);
executed (the execution status of this line is deduced): QFontCache::instance()->instance()->insertEngine(key,engine);
-
182 }
executed: }
Execution Count:626
626
183 }
executed: }
Execution Count:891
891
184 return engine;
executed: return engine;
Execution Count:891
891
185} -
186 -
187static -
188QFontEngine *loadEngine(int script, const QFontDef &request, -
189 QtFontFamily *family, QtFontFoundry *foundry, -
190 QtFontStyle *style, QtFontSize *size) -
191{ -
192 -
193 QFontEngine *engine = loadSingleEngine(script, request, foundry, style, size);
executed (the execution status of this line is deduced): QFontEngine *engine = loadSingleEngine(script, request, foundry, style, size);
-
194 //make sure that the db has all fallback families -
195 if (engine && engine->type() != QFontEngine::Multi
evaluated: engine
TRUEFALSE
yes
Evaluation Count:626
yes
Evaluation Count:265
partially evaluated: engine->type() != QFontEngine::Multi
TRUEFALSE
yes
Evaluation Count:626
no
Evaluation Count:0
0-626
196 && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol ) {
evaluated: !(request.styleStrategy & QFont::NoFontMerging)
TRUEFALSE
yes
Evaluation Count:624
yes
Evaluation Count:2
evaluated: !engine->symbol
TRUEFALSE
yes
Evaluation Count:600
yes
Evaluation Count:24
2-624
197 -
198 if (family && !family->askedForFallback) {
partially evaluated: family
TRUEFALSE
yes
Evaluation Count:600
no
Evaluation Count:0
evaluated: !family->askedForFallback
TRUEFALSE
yes
Evaluation Count:386
yes
Evaluation Count:214
0-600
199 QFont::Style fontStyle = QFont::Style(style->key.style);
executed (the execution status of this line is deduced): QFont::Style fontStyle = QFont::Style(style->key.style);
-
200 QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);
executed (the execution status of this line is deduced): QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);
-
201 if (styleHint == QFont::AnyStyle && request.fixedPitch)
partially evaluated: styleHint == QFont::AnyStyle
TRUEFALSE
yes
Evaluation Count:386
no
Evaluation Count:0
partially evaluated: request.fixedPitch
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:386
0-386
202 styleHint = QFont::TypeWriter;
never executed: styleHint = QFont::TypeWriter;
0
203 family->fallbackFamilies = fallbackFamilies(family->name,fontStyle,styleHint,QUnicodeTables::Script(script));
executed (the execution status of this line is deduced): family->fallbackFamilies = fallbackFamilies(family->name,fontStyle,styleHint,QUnicodeTables::Script(script));
-
204 -
205 family->askedForFallback = true;
executed (the execution status of this line is deduced): family->askedForFallback = true;
-
206 }
executed: }
Execution Count:386
386
207 -
208 QStringList fallbacks = privateDb()->fallbackFamilies;
executed (the execution status of this line is deduced): QStringList fallbacks = privateDb()->fallbackFamilies;
-
209 if (family && !family->fallbackFamilies.isEmpty())
partially evaluated: family
TRUEFALSE
yes
Evaluation Count:600
no
Evaluation Count:0
partially evaluated: !family->fallbackFamilies.isEmpty()
TRUEFALSE
yes
Evaluation Count:600
no
Evaluation Count:0
0-600
210 fallbacks = family->fallbackFamilies;
executed: fallbacks = family->fallbackFamilies;
Execution Count:600
600
211 -
212 QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
executed (the execution status of this line is deduced): QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
-
213 QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QUnicodeTables::Script(script));
executed (the execution status of this line is deduced): QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QUnicodeTables::Script(script));
-
214 pfMultiEngine->setFallbackFamiliesList(fallbacks);
executed (the execution status of this line is deduced): pfMultiEngine->setFallbackFamiliesList(fallbacks);
-
215 engine = pfMultiEngine;
executed (the execution status of this line is deduced): engine = pfMultiEngine;
-
216 -
217 // Cache Multi font engine as well in case we got the FT single -
218 // font engine when we are actually looking for a Multi one -
219 QFontCache::Key key(request, script, 1);
executed (the execution status of this line is deduced): QFontCache::Key key(request, script, 1);
-
220 QFontCache::instance()->instance()->insertEngine(key, engine);
executed (the execution status of this line is deduced): QFontCache::instance()->instance()->insertEngine(key, engine);
-
221 }
executed: }
Execution Count:600
600
222 -
223 return engine;
executed: return engine;
Execution Count:891
891
224} -
225 -
226static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) -
227{ -
228 QFontDatabasePrivate *db = privateDb();
executed (the execution status of this line is deduced): QFontDatabasePrivate *db = privateDb();
-
229 -
230 fnt->families = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName);
executed (the execution status of this line is deduced): fnt->families = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName);
-
231 -
232 db->reregisterAppFonts = true;
executed (the execution status of this line is deduced): db->reregisterAppFonts = true;
-
233}
executed: }
Execution Count:42
42
234 -
235bool QFontDatabase::removeApplicationFont(int handle) -
236{ -
237 QMutexLocker locker(fontDatabaseMutex());
executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
238 -
239 QFontDatabasePrivate *db = privateDb();
executed (the execution status of this line is deduced): QFontDatabasePrivate *db = privateDb();
-
240 if (handle < 0 || handle >= db->applicationFonts.count())
partially evaluated: handle < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
partially evaluated: handle >= db->applicationFonts.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
241 return false;
never executed: return false;
0
242 -
243 db->applicationFonts[handle] = QFontDatabasePrivate::ApplicationFont();
executed (the execution status of this line is deduced): db->applicationFonts[handle] = QFontDatabasePrivate::ApplicationFont();
-
244 -
245 db->reregisterAppFonts = true;
executed (the execution status of this line is deduced): db->reregisterAppFonts = true;
-
246 db->invalidate();
executed (the execution status of this line is deduced): db->invalidate();
-
247 return true;
executed: return true;
Execution Count:21
21
248} -
249 -
250bool QFontDatabase::removeAllApplicationFonts() -
251{ -
252 QMutexLocker locker(fontDatabaseMutex());
never executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
253 -
254 QFontDatabasePrivate *db = privateDb();
never executed (the execution status of this line is deduced): QFontDatabasePrivate *db = privateDb();
-
255 if (db->applicationFonts.isEmpty())
never evaluated: db->applicationFonts.isEmpty()
0
256 return false;
never executed: return false;
0
257 -
258 db->applicationFonts.clear();
never executed (the execution status of this line is deduced): db->applicationFonts.clear();
-
259 db->invalidate();
never executed (the execution status of this line is deduced): db->invalidate();
-
260 return true;
never executed: return true;
0
261} -
262 -
263bool QFontDatabase::supportsThreadedFontRendering() -
264{ -
265 return true;
executed: return true;
Execution Count:1
1
266} -
267 -
268/*! -
269 \internal -
270*/ -
271QFontEngine * -
272QFontDatabase::findFont(int script, const QFontPrivate *fp, -
273 const QFontDef &request, bool multi) -
274{ -
275 QMutexLocker locker(fontDatabaseMutex());
executed (the execution status of this line is deduced): QMutexLocker locker(fontDatabaseMutex());
-
276 -
277 const int force_encoding_id = -1;
executed (the execution status of this line is deduced): const int force_encoding_id = -1;
-
278 -
279 if (!privateDb()->count)
evaluated: !privateDb()->count
TRUEFALSE
yes
Evaluation Count:125
yes
Evaluation Count:521
125-521
280 initializeDb();
executed: initializeDb();
Execution Count:125
125
281 -
282 QFontEngine *engine;
executed (the execution status of this line is deduced): QFontEngine *engine;
-
283 QFontCache::Key key(request, script, multi ? 1 : 0);
executed (the execution status of this line is deduced): QFontCache::Key key(request, script, multi ? 1 : 0);
-
284 engine = QFontCache::instance()->findEngine(key);
executed (the execution status of this line is deduced): engine = QFontCache::instance()->findEngine(key);
-
285 if (engine) {
evaluated: engine
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:639
7-639
286 FM_DEBUG("Cache hit level 1");
never executed: QMessageLogger("text/qfontdatabase_qpa.cpp", 286, __PRETTY_FUNCTION__).debug("Cache hit level 1");
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
287 return engine;
executed: return engine;
Execution Count:7
7
288 } -
289 -
290 QString family_name, foundry_name;
executed (the execution status of this line is deduced): QString family_name, foundry_name;
-
291 -
292 parseFontName(request.family, foundry_name, family_name);
executed (the execution status of this line is deduced): parseFontName(request.family, foundry_name, family_name);
-
293 -
294 if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) {
partially evaluated: qt_enable_test_font
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:639
never evaluated: request.family == QLatin1String("__Qt__Box__Engine__")
0-639
295 engine =new QTestFontEngine(request.pixelSize);
never executed (the execution status of this line is deduced): engine =new QTestFontEngine(request.pixelSize);
-
296 engine->fontDef = request;
never executed (the execution status of this line is deduced): engine->fontDef = request;
-
297 }
never executed: }
0
298 -
299 QtFontDesc desc;
executed (the execution status of this line is deduced): QtFontDesc desc;
-
300 match(script, request, family_name, foundry_name, force_encoding_id, &desc);
executed (the execution status of this line is deduced): match(script, request, family_name, foundry_name, force_encoding_id, &desc);
-
301 if (desc.family != 0 && desc.foundry != 0 && desc.style != 0) {
evaluated: desc.family != 0
TRUEFALSE
yes
Evaluation Count:607
yes
Evaluation Count:32
partially evaluated: desc.foundry != 0
TRUEFALSE
yes
Evaluation Count:607
no
Evaluation Count:0
partially evaluated: desc.style != 0
TRUEFALSE
yes
Evaluation Count:607
no
Evaluation Count:0
0-607
302 engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size);
executed (the execution status of this line is deduced): engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size);
-
303 } else {
executed: }
Execution Count:607
607
304 FM_DEBUG(" NO MATCH FOUND\n");
never executed: QMessageLogger("text/qfontdatabase_qpa.cpp", 304, __PRETTY_FUNCTION__).debug(" NO MATCH FOUND\n");
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:32
0-32
305 }
executed: }
Execution Count:32
32
306 -
307 if (engine && engine->type() != QFontEngine::TestFontEngine) {
evaluated: engine
TRUEFALSE
yes
Evaluation Count:430
yes
Evaluation Count:209
partially evaluated: engine->type() != QFontEngine::TestFontEngine
TRUEFALSE
yes
Evaluation Count:430
no
Evaluation Count:0
0-430
308 initFontDef(desc, request, &engine->fontDef, engine->type() == QFontEngine::Multi);
executed (the execution status of this line is deduced): initFontDef(desc, request, &engine->fontDef, engine->type() == QFontEngine::Multi);
-
309 -
310 if (fp) {
evaluated: fp
TRUEFALSE
yes
Evaluation Count:428
yes
Evaluation Count:2
2-428
311 QFontDef def = request;
executed (the execution status of this line is deduced): QFontDef def = request;
-
312 if (def.family.isEmpty()) {
partially evaluated: def.family.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:428
0-428
313 def.family = fp->request.family;
never executed (the execution status of this line is deduced): def.family = fp->request.family;
-
314 def.family = def.family.left(def.family.indexOf(QLatin1Char(',')));
never executed (the execution status of this line is deduced): def.family = def.family.left(def.family.indexOf(QLatin1Char(',')));
-
315 }
never executed: }
0
316 }
executed: }
Execution Count:428
428
317 }
executed: }
Execution Count:430
430
318 -
319 if (!engine) {
evaluated: !engine
TRUEFALSE
yes
Evaluation Count:209
yes
Evaluation Count:430
209-430
320 if (!request.family.isEmpty()) {
evaluated: !request.family.isEmpty()
TRUEFALSE
yes
Evaluation Count:207
yes
Evaluation Count:2
2-207
321 QStringList fallbacks = request.fallBackFamilies
executed (the execution status of this line is deduced): QStringList fallbacks = request.fallBackFamilies
-
322 + fallbackFamilies(request.family,
executed (the execution status of this line is deduced): + fallbackFamilies(request.family,
-
323 QFont::Style(request.style),
executed (the execution status of this line is deduced): QFont::Style(request.style),
-
324 QFont::StyleHint(request.styleHint),
executed (the execution status of this line is deduced): QFont::StyleHint(request.styleHint),
-
325 QUnicodeTables::Script(script));
executed (the execution status of this line is deduced): QUnicodeTables::Script(script));
-
326 -
327 for (int i = 0; !engine && i < fallbacks.size(); i++) {
evaluated: !engine
TRUEFALSE
yes
Evaluation Count:418
yes
Evaluation Count:205
evaluated: i < fallbacks.size()
TRUEFALSE
yes
Evaluation Count:416
yes
Evaluation Count:2
2-418
328 QFontDef def = request;
executed (the execution status of this line is deduced): QFontDef def = request;
-
329 def.family = fallbacks.at(i);
executed (the execution status of this line is deduced): def.family = fallbacks.at(i);
-
330 QFontCache::Key key(def, script, multi ? 1 : 0);
executed (the execution status of this line is deduced): QFontCache::Key key(def, script, multi ? 1 : 0);
-
331 engine = QFontCache::instance()->findEngine(key);
executed (the execution status of this line is deduced): engine = QFontCache::instance()->findEngine(key);
-
332 if (!engine) {
evaluated: !engine
TRUEFALSE
yes
Evaluation Count:407
yes
Evaluation Count:9
9-407
333 QtFontDesc desc;
executed (the execution status of this line is deduced): QtFontDesc desc;
-
334 match(script, def, def.family, QLatin1String(""), 0, &desc);
executed (the execution status of this line is deduced): match(script, def, def.family, QLatin1String(""), 0, &desc);
-
335 if (desc.family == 0 && desc.foundry == 0 && desc.style == 0) {
evaluated: desc.family == 0
TRUEFALSE
yes
Evaluation Count:123
yes
Evaluation Count:284
partially evaluated: desc.foundry == 0
TRUEFALSE
yes
Evaluation Count:123
no
Evaluation Count:0
partially evaluated: desc.style == 0
TRUEFALSE
yes
Evaluation Count:123
no
Evaluation Count:0
0-284
336 continue;
executed: continue;
Execution Count:123
123
337 } -
338 engine = loadEngine(script, def, desc.family, desc.foundry, desc.style, desc.size);
executed (the execution status of this line is deduced): engine = loadEngine(script, def, desc.family, desc.foundry, desc.style, desc.size);
-
339 if (engine) {
evaluated: engine
TRUEFALSE
yes
Evaluation Count:196
yes
Evaluation Count:88
88-196
340 initFontDef(desc, def, &engine->fontDef, engine->type() == QFontEngine::Multi);
executed (the execution status of this line is deduced): initFontDef(desc, def, &engine->fontDef, engine->type() == QFontEngine::Multi);
-
341 }
executed: }
Execution Count:196
196
342 }
executed: }
Execution Count:284
284
343 }
executed: }
Execution Count:293
293
344 }
executed: }
Execution Count:207
207
345 -
346 if (!engine)
evaluated: !engine
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:205
4-205
347 engine = new QFontEngineBox(request.pixelSize);
executed: engine = new QFontEngineBox(request.pixelSize);
Execution Count:4
4
348 -
349 FM_DEBUG("returning box engine");
never executed: QMessageLogger("text/qfontdatabase_qpa.cpp", 349, __PRETTY_FUNCTION__).debug("returning box engine");
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:209
0-209
350 }
executed: }
Execution Count:209
209
351 -
352 if (fp && fp->dpi > 0) {
evaluated: fp
TRUEFALSE
yes
Evaluation Count:637
yes
Evaluation Count:2
evaluated: fp->dpi > 0
TRUEFALSE
yes
Evaluation Count:635
yes
Evaluation Count:2
2-637
353 engine->fontDef.pointSize = qreal(double((engine->fontDef.pixelSize * 72) / fp->dpi));
executed (the execution status of this line is deduced): engine->fontDef.pointSize = qreal(double((engine->fontDef.pixelSize * 72) / fp->dpi));
-
354 } else {
executed: }
Execution Count:635
635
355 engine->fontDef.pointSize = request.pointSize;
executed (the execution status of this line is deduced): engine->fontDef.pointSize = request.pointSize;
-
356 }
executed: }
Execution Count:4
4
357 -
358 return engine;
executed: return engine;
Execution Count:639
639
359} -
360 -
361void QFontDatabase::load(const QFontPrivate *d, int script) -
362{ -
363 QFontDef req = d->request;
executed (the execution status of this line is deduced): QFontDef req = d->request;
-
364 -
365 if (req.pixelSize == -1) {
evaluated: req.pixelSize == -1
TRUEFALSE
yes
Evaluation Count:29815
yes
Evaluation Count:114
114-29815
366 req.pixelSize = floor(((req.pointSize * d->dpi) / 72) * 100 + 0.5) / 100;
executed (the execution status of this line is deduced): req.pixelSize = floor(((req.pointSize * d->dpi) / 72) * 100 + 0.5) / 100;
-
367 req.pixelSize = qRound(req.pixelSize);
executed (the execution status of this line is deduced): req.pixelSize = qRound(req.pixelSize);
-
368 }
executed: }
Execution Count:29815
29815
369 if (req.pointSize < 0)
evaluated: req.pointSize < 0
TRUEFALSE
yes
Evaluation Count:114
yes
Evaluation Count:29815
114-29815
370 req.pointSize = req.pixelSize*72.0/d->dpi;
executed: req.pointSize = req.pixelSize*72.0/d->dpi;
Execution Count:114
114
371 if (req.weight == 0)
partially evaluated: req.weight == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29929
0-29929
372 req.weight = QFont::Normal;
never executed: req.weight = QFont::Normal;
0
373 if (req.stretch == 0)
partially evaluated: req.stretch == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29929
0-29929
374 req.stretch = 100;
never executed: req.stretch = 100;
0
375 -
376 // Until we specifically asked not to, try looking for Multi font engine -
377 // first, the last '1' indicates that we want Multi font engine instead -
378 // of single ones -
379 bool multi = !(req.styleStrategy & QFont::NoFontMerging);
executed (the execution status of this line is deduced): bool multi = !(req.styleStrategy & QFont::NoFontMerging);
-
380 QFontCache::Key key(req, script, multi ? 1 : 0);
executed (the execution status of this line is deduced): QFontCache::Key key(req, script, multi ? 1 : 0);
-
381 -
382 if (!d->engineData)
evaluated: !d->engineData
TRUEFALSE
yes
Evaluation Count:29910
yes
Evaluation Count:19
19-29910
383 getEngineData(d, req);
executed: getEngineData(d, req);
Execution Count:29910
29910
384 -
385 // the cached engineData could have already loaded the engine we want -
386 if (d->engineData->engines[script])
evaluated: d->engineData->engines[script]
TRUEFALSE
yes
Evaluation Count:29292
yes
Evaluation Count:637
637-29292
387 return;
executed: return;
Execution Count:29292
29292
388 -
389 QFontEngine *fe = QFontCache::instance()->findEngine(key);
executed (the execution status of this line is deduced): QFontEngine *fe = QFontCache::instance()->findEngine(key);
-
390 -
391 // list of families to try -
392 QStringList family_list;
executed (the execution status of this line is deduced): QStringList family_list;
-
393 -
394 if (!req.family.isEmpty()) {
partially evaluated: !req.family.isEmpty()
TRUEFALSE
yes
Evaluation Count:637
no
Evaluation Count:0
0-637
395 QStringList familiesForRequest = familyList(req);
executed (the execution status of this line is deduced): QStringList familiesForRequest = familyList(req);
-
396 -
397 // Add primary selection -
398 family_list << familiesForRequest.takeFirst();
executed (the execution status of this line is deduced): family_list << familiesForRequest.takeFirst();
-
399 -
400 // Fallbacks requested in font request -
401 req.fallBackFamilies = familiesForRequest;
executed (the execution status of this line is deduced): req.fallBackFamilies = familiesForRequest;
-
402 -
403 // add the default family -
404 QString defaultFamily = QGuiApplication::font().family();
executed (the execution status of this line is deduced): QString defaultFamily = QGuiApplication::font().family();
-
405 if (! family_list.contains(defaultFamily))
evaluated: ! family_list.contains(defaultFamily)
TRUEFALSE
yes
Evaluation Count:460
yes
Evaluation Count:177
177-460
406 family_list << defaultFamily;
executed: family_list << defaultFamily;
Execution Count:460
460
407 -
408 }
executed: }
Execution Count:637
637
409 -
410 // null family means find the first font matching the specified script -
411 family_list << QString();
executed (the execution status of this line is deduced): family_list << QString();
-
412 -
413 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();
-
414 for (; !fe && it != end; ++it) {
evaluated: !fe
TRUEFALSE
yes
Evaluation Count:637
yes
Evaluation Count:637
partially evaluated: it != end
TRUEFALSE
yes
Evaluation Count:637
no
Evaluation Count:0
0-637
415 req.family = *it;
executed (the execution status of this line is deduced): req.family = *it;
-
416 -
417 fe = QFontDatabase::findFont(script, d, req, multi);
executed (the execution status of this line is deduced): fe = QFontDatabase::findFont(script, d, req, multi);
-
418 if (fe && (fe->type()==QFontEngine::Box) && !req.family.isEmpty()) {
partially evaluated: fe
TRUEFALSE
yes
Evaluation Count:637
no
Evaluation Count:0
evaluated: (fe->type()==QFontEngine::Box)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:633
evaluated: !req.family.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
0-637
419 if (fe->ref.load() == 0)
partially evaluated: fe->ref.load() == 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
420 delete fe;
executed: delete fe;
Execution Count:2
2
421 -
422 fe = 0;
executed (the execution status of this line is deduced): fe = 0;
-
423 }
executed: }
Execution Count:2
2
424 -
425 // No need to check requested fallback families again -
426 req.fallBackFamilies.clear();
executed (the execution status of this line is deduced): req.fallBackFamilies.clear();
-
427 }
executed: }
Execution Count:637
637
428 -
429 if (fe->symbol || (d->request.styleStrategy & QFont::NoFontMerging)) {
evaluated: fe->symbol
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:613
partially evaluated: (d->request.styleStrategy & QFont::NoFontMerging)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:613
0-613
430 for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) {
evaluated: i < QUnicodeTables::ScriptCount
TRUEFALSE
yes
Evaluation Count:672
yes
Evaluation Count:24
24-672
431 if (!d->engineData->engines[i]) {
partially evaluated: !d->engineData->engines[i]
TRUEFALSE
yes
Evaluation Count:672
no
Evaluation Count:0
0-672
432 d->engineData->engines[i] = fe;
executed (the execution status of this line is deduced): d->engineData->engines[i] = fe;
-
433 fe->ref.ref();
executed (the execution status of this line is deduced): fe->ref.ref();
-
434 }
executed: }
Execution Count:672
672
435 }
executed: }
Execution Count:672
672
436 } else {
executed: }
Execution Count:24
24
437 d->engineData->engines[script] = fe;
executed (the execution status of this line is deduced): d->engineData->engines[script] = fe;
-
438 fe->ref.ref();
executed (the execution status of this line is deduced): fe->ref.ref();
-
439 }
executed: }
Execution Count:613
613
440} -
441 -
442QString QFontDatabase::resolveFontFamilyAlias(const QString &family) -
443{ -
444 return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->resolveFontFamilyAlias(family);
executed: return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->resolveFontFamilyAlias(family);
Execution Count:9
9
445} -
446 -
447QT_END_NAMESPACE -
448 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial