Line | Source Code | Coverage |
---|
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 "qplatformfontdatabase.h" | - |
43 | #include <QtGui/private/qfontengine_p.h> | - |
44 | #include <QtGui/private/qfontengine_qpa_p.h> | - |
45 | #include <QtCore/QLibraryInfo> | - |
46 | #include <QtCore/QDir> | - |
47 | | - |
48 | QT_BEGIN_NAMESPACE | - |
49 | | - |
50 | extern void qt_registerFont(const QString &familyname, const QString &stylename, | - |
51 | const QString &foundryname, int weight, | - |
52 | QFont::Style style, int stretch, bool antialiased, | - |
53 | bool scalable, int pixelSize, bool fixedPitch, | - |
54 | const QSupportedWritingSystems &writingSystems, void *hanlde); | - |
55 | | - |
56 | /*! | - |
57 | \fn void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *handle) | - |
58 | | - |
59 | Registers the pre-rendered QPF2 font contained in the given \a dataArray. | - |
60 | | - |
61 | \sa registerFont() | - |
62 | */ | - |
63 | void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *handle) | - |
64 | { | - |
65 | if (dataArray.size() == 0) never evaluated: dataArray.size() == 0 | 0 |
66 | return; | 0 |
67 | | - |
68 | const uchar *data = reinterpret_cast<const uchar *>(dataArray.constData()); never executed (the execution status of this line is deduced): const uchar *data = reinterpret_cast<const uchar *>(dataArray.constData()); | - |
69 | if (QFontEngineQPA::verifyHeader(data, dataArray.size())) { never evaluated: QFontEngineQPA::verifyHeader(data, dataArray.size()) | 0 |
70 | QString fontName = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_FontName).toString(); never executed (the execution status of this line is deduced): QString fontName = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_FontName).toString(); | - |
71 | int pixelSize = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_PixelSize).toInt(); never executed (the execution status of this line is deduced): int pixelSize = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_PixelSize).toInt(); | - |
72 | QVariant weight = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_Weight); never executed (the execution status of this line is deduced): QVariant weight = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_Weight); | - |
73 | QVariant style = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_Style); never executed (the execution status of this line is deduced): QVariant style = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_Style); | - |
74 | QByteArray writingSystemBits = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_WritingSystems).toByteArray(); never executed (the execution status of this line is deduced): QByteArray writingSystemBits = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_WritingSystems).toByteArray(); | - |
75 | | - |
76 | if (!fontName.isEmpty() && pixelSize) { never evaluated: !fontName.isEmpty() never evaluated: pixelSize | 0 |
77 | QFont::Weight fontWeight = QFont::Normal; never executed (the execution status of this line is deduced): QFont::Weight fontWeight = QFont::Normal; | - |
78 | if (weight.type() == QVariant::Int || weight.type() == QVariant::UInt) never evaluated: weight.type() == QVariant::Int never evaluated: weight.type() == QVariant::UInt | 0 |
79 | fontWeight = QFont::Weight(weight.toInt()); never executed: fontWeight = QFont::Weight(weight.toInt()); | 0 |
80 | | - |
81 | QFont::Style fontStyle = static_cast<QFont::Style>(style.toInt()); never executed (the execution status of this line is deduced): QFont::Style fontStyle = static_cast<QFont::Style>(style.toInt()); | - |
82 | | - |
83 | QSupportedWritingSystems writingSystems; never executed (the execution status of this line is deduced): QSupportedWritingSystems writingSystems; | - |
84 | for (int i = 0; i < writingSystemBits.count(); ++i) { never evaluated: i < writingSystemBits.count() | 0 |
85 | uchar currentByte = writingSystemBits.at(i); never executed (the execution status of this line is deduced): uchar currentByte = writingSystemBits.at(i); | - |
86 | for (int j = 0; j < 8; ++j) { | 0 |
87 | if (currentByte & 1) never evaluated: currentByte & 1 | 0 |
88 | writingSystems.setSupported(QFontDatabase::WritingSystem(i * 8 + j)); never executed: writingSystems.setSupported(QFontDatabase::WritingSystem(i * 8 + j)); | 0 |
89 | currentByte >>= 1; never executed (the execution status of this line is deduced): currentByte >>= 1; | - |
90 | } | 0 |
91 | } | 0 |
92 | QFont::Stretch stretch = QFont::Unstretched; never executed (the execution status of this line is deduced): QFont::Stretch stretch = QFont::Unstretched; | - |
93 | registerFont(fontName,QString(),QString(),fontWeight,fontStyle,stretch,true,false,pixelSize,false,writingSystems,handle); never executed (the execution status of this line is deduced): registerFont(fontName,QString(),QString(),fontWeight,fontStyle,stretch,true,false,pixelSize,false,writingSystems,handle); | - |
94 | } | 0 |
95 | } else { | 0 |
96 | qDebug() << "header verification of QPF2 font failed. maybe it is corrupt?"; never executed (the execution status of this line is deduced): QMessageLogger("text/qplatformfontdatabase.cpp", 96, __PRETTY_FUNCTION__).debug() << "header verification of QPF2 font failed. maybe it is corrupt?"; | - |
97 | } | 0 |
98 | } | - |
99 | | - |
100 | /*! | - |
101 | Registers a font with the given set of attributes describing the font's | - |
102 | foundry, family name, style and stretch information, pixel size, and | - |
103 | supported writing systems. Additional information about whether the font | - |
104 | can be scaled and antialiased can also be provided. | - |
105 | | - |
106 | The foundry name and font family are described by \a foundryName and | - |
107 | \a familyName. The font weight (light, normal, bold, etc.), style (normal, | - |
108 | oblique, italic) and stretch information (condensed, expanded, unstretched, | - |
109 | etc.) are specified by \a weight, \a style and \a stretch. | - |
110 | | - |
111 | Some fonts can be antialiased and scaled; \a scalable and \a antialiased | - |
112 | can be set to true for fonts with these attributes. The intended pixel | - |
113 | size of non-scalable fonts is specified by \a pixelSize; this value will be | - |
114 | ignored for scalable fonts. | - |
115 | | - |
116 | The writing systems supported by the font are specified by the | - |
117 | \a writingSystems argument. | - |
118 | | - |
119 | \sa registerQPF2Font() | - |
120 | */ | - |
121 | void QPlatformFontDatabase::registerFont(const QString &familyname, const QString &stylename, | - |
122 | const QString &foundryname, QFont::Weight weight, | - |
123 | QFont::Style style, QFont::Stretch stretch, bool antialiased, | - |
124 | bool scalable, int pixelSize, bool fixedPitch, | - |
125 | const QSupportedWritingSystems &writingSystems, void *usrPtr) | - |
126 | { | - |
127 | if (scalable) partially evaluated: scalable yes Evaluation Count:51534 | no Evaluation Count:0 |
| 0-51534 |
128 | pixelSize = 0; executed: pixelSize = 0; Execution Count:51534 | 51534 |
129 | | - |
130 | qt_registerFont(familyname, stylename, foundryname, weight, style, executed (the execution status of this line is deduced): qt_registerFont(familyname, stylename, foundryname, weight, style, | - |
131 | stretch, antialiased, scalable, pixelSize, executed (the execution status of this line is deduced): stretch, antialiased, scalable, pixelSize, | - |
132 | fixedPitch, writingSystems, usrPtr); executed (the execution status of this line is deduced): fixedPitch, writingSystems, usrPtr); | - |
133 | } executed: } Execution Count:51534 | 51534 |
134 | | - |
135 | class QWritingSystemsPrivate | - |
136 | { | - |
137 | public: | - |
138 | QWritingSystemsPrivate() | - |
139 | : ref(1) | - |
140 | , vector(QFontDatabase::WritingSystemsCount,false) | - |
141 | { | - |
142 | } executed: } Execution Count:50326 | 50326 |
143 | | - |
144 | QWritingSystemsPrivate(const QWritingSystemsPrivate *other) | - |
145 | : ref(1) | - |
146 | , vector(other->vector) | - |
147 | { | - |
148 | } | 0 |
149 | | - |
150 | QAtomicInt ref; | - |
151 | QVector<bool> vector; | - |
152 | }; | - |
153 | | - |
154 | /*! | - |
155 | Constructs a new object to handle supported writing systems. | - |
156 | */ | - |
157 | QSupportedWritingSystems::QSupportedWritingSystems() | - |
158 | { | - |
159 | d = new QWritingSystemsPrivate; executed (the execution status of this line is deduced): d = new QWritingSystemsPrivate; | - |
160 | } executed: } Execution Count:50326 | 50326 |
161 | | - |
162 | /*! | - |
163 | Constructs a copy of the \a other writing systems object. | - |
164 | */ | - |
165 | QSupportedWritingSystems::QSupportedWritingSystems(const QSupportedWritingSystems &other) | - |
166 | { | - |
167 | d = other.d; never executed (the execution status of this line is deduced): d = other.d; | - |
168 | d->ref.ref(); never executed (the execution status of this line is deduced): d->ref.ref(); | - |
169 | } | 0 |
170 | | - |
171 | /*! | - |
172 | Constructs a copy of the \a other writing systems object. | - |
173 | */ | - |
174 | QSupportedWritingSystems &QSupportedWritingSystems::operator=(const QSupportedWritingSystems &other) | - |
175 | { | - |
176 | if (d != other.d) { never evaluated: d != other.d | 0 |
177 | other.d->ref.ref(); never executed (the execution status of this line is deduced): other.d->ref.ref(); | - |
178 | if (!d->ref.deref()) never evaluated: !d->ref.deref() | 0 |
179 | delete d; never executed: delete d; | 0 |
180 | d = other.d; never executed (the execution status of this line is deduced): d = other.d; | - |
181 | } | 0 |
182 | return *this; never executed: return *this; | 0 |
183 | } | - |
184 | | - |
185 | /*! | - |
186 | Destroys the supported writing systems object. | - |
187 | */ | - |
188 | QSupportedWritingSystems::~QSupportedWritingSystems() | - |
189 | { | - |
190 | if (!d->ref.deref()) partially evaluated: !d->ref.deref() yes Evaluation Count:50326 | no Evaluation Count:0 |
| 0-50326 |
191 | delete d; executed: delete d; Execution Count:50326 | 50326 |
192 | } executed: } Execution Count:50326 | 50326 |
193 | | - |
194 | /*! | - |
195 | \internal | - |
196 | */ | - |
197 | void QSupportedWritingSystems::detach() | - |
198 | { | - |
199 | if (d->ref.load() != 1) { partially evaluated: d->ref.load() != 1 no Evaluation Count:0 | yes Evaluation Count:89607 |
| 0-89607 |
200 | QWritingSystemsPrivate *newd = new QWritingSystemsPrivate(d); never executed (the execution status of this line is deduced): QWritingSystemsPrivate *newd = new QWritingSystemsPrivate(d); | - |
201 | if (!d->ref.deref()) never evaluated: !d->ref.deref() | 0 |
202 | delete d; never executed: delete d; | 0 |
203 | d = newd; never executed (the execution status of this line is deduced): d = newd; | - |
204 | } | 0 |
205 | } executed: } Execution Count:89607 | 89607 |
206 | | - |
207 | /*! | - |
208 | Sets or clears support for the specified \a writingSystem based on the | - |
209 | value given by \a support. | - |
210 | */ | - |
211 | void QSupportedWritingSystems::setSupported(QFontDatabase::WritingSystem writingSystem, bool support) | - |
212 | { | - |
213 | detach(); executed (the execution status of this line is deduced): detach(); | - |
214 | d->vector[writingSystem] = support; executed (the execution status of this line is deduced): d->vector[writingSystem] = support; | - |
215 | } executed: } Execution Count:89607 | 89607 |
216 | | - |
217 | /*! | - |
218 | Returns true if the writing system specified by \a writingSystem is | - |
219 | supported; otherwise returns false. | - |
220 | */ | - |
221 | bool QSupportedWritingSystems::supported(QFontDatabase::WritingSystem writingSystem) const | - |
222 | { | - |
223 | return d->vector.at(writingSystem); executed: return d->vector.at(writingSystem); Execution Count:3407931 | 3407931 |
224 | } | - |
225 | | - |
226 | /*! | - |
227 | \class QSupportedWritingSystems | - |
228 | \brief The QSupportedWritingSystems class is used when registering fonts with the internal Qt | - |
229 | fontdatabase | - |
230 | \ingroup painting | - |
231 | \inmodule QtGui | - |
232 | | - |
233 | Its to provide an easy to use interface for indicating what writing systems a specific font | - |
234 | supports. | - |
235 | | - |
236 | */ | - |
237 | | - |
238 | /*! | - |
239 | \internal | - |
240 | */ | - |
241 | QPlatformFontDatabase::~QPlatformFontDatabase() | - |
242 | { | - |
243 | } | - |
244 | | - |
245 | /*! | - |
246 | This function is called once at startup by Qt's internal font database. | - |
247 | Reimplement this function in a subclass for a convenient place to initialize | - |
248 | the internal font database. | - |
249 | | - |
250 | The default implementation looks in the fontDir() location and registers all | - |
251 | QPF2 fonts. | - |
252 | */ | - |
253 | void QPlatformFontDatabase::populateFontDatabase() | - |
254 | { | - |
255 | QString fontpath = fontDir(); never executed (the execution status of this line is deduced): QString fontpath = fontDir(); | - |
256 | if(!QFile::exists(fontpath)) { never evaluated: !QFile::exists(fontpath) | 0 |
257 | qWarning("QFontDatabase: Cannot find font directory '%s' - is Qt installed correctly?", never executed (the execution status of this line is deduced): QMessageLogger("text/qplatformfontdatabase.cpp", 257, __PRETTY_FUNCTION__).warning("QFontDatabase: Cannot find font directory '%s' - is Qt installed correctly?", | - |
258 | qPrintable(QDir::toNativeSeparators(fontpath))); never executed (the execution status of this line is deduced): QString(QDir::toNativeSeparators(fontpath)).toLocal8Bit().constData()); | - |
259 | return; | 0 |
260 | } | - |
261 | | - |
262 | QDir dir(fontpath); never executed (the execution status of this line is deduced): QDir dir(fontpath); | - |
263 | dir.setNameFilters(QStringList() << QLatin1String("*.qpf2")); never executed (the execution status of this line is deduced): dir.setNameFilters(QStringList() << QLatin1String("*.qpf2")); | - |
264 | dir.refresh(); never executed (the execution status of this line is deduced): dir.refresh(); | - |
265 | for (int i = 0; i < int(dir.count()); ++i) { never evaluated: i < int(dir.count()) | 0 |
266 | const QByteArray fileName = QFile::encodeName(dir.absoluteFilePath(dir[i])); never executed (the execution status of this line is deduced): const QByteArray fileName = QFile::encodeName(dir.absoluteFilePath(dir[i])); | - |
267 | QFile file(QString::fromLocal8Bit(fileName)); never executed (the execution status of this line is deduced): QFile file(QString::fromLocal8Bit(fileName)); | - |
268 | if (file.open(QFile::ReadOnly)) { never evaluated: file.open(QFile::ReadOnly) | 0 |
269 | const QByteArray fileData = file.readAll(); never executed (the execution status of this line is deduced): const QByteArray fileData = file.readAll(); | - |
270 | QByteArray *fileDataPtr = new QByteArray(fileData); never executed (the execution status of this line is deduced): QByteArray *fileDataPtr = new QByteArray(fileData); | - |
271 | registerQPF2Font(fileData, fileDataPtr); never executed (the execution status of this line is deduced): registerQPF2Font(fileData, fileDataPtr); | - |
272 | } | 0 |
273 | } | 0 |
274 | } | 0 |
275 | | - |
276 | /*! | - |
277 | Returns a multi font engine in the specified \a script to encapsulate \a fontEngine with the | - |
278 | option to fall back to the fonts given by \a fallbacks if \a fontEngine does not support | - |
279 | a certain character. | - |
280 | */ | - |
281 | QFontEngineMulti *QPlatformFontDatabase::fontEngineMulti(QFontEngine *fontEngine, | - |
282 | QUnicodeTables::Script script) | - |
283 | { | - |
284 | return new QFontEngineMultiQPA(fontEngine, script); never executed: return new QFontEngineMultiQPA(fontEngine, script); | 0 |
285 | } | - |
286 | | - |
287 | /*! | - |
288 | Returns the font engine that can be used to render the font described by | - |
289 | the font definition, \a fontDef, in the specified \a script. | - |
290 | */ | - |
291 | QFontEngine *QPlatformFontDatabase::fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle) | - |
292 | { | - |
293 | Q_UNUSED(script); never executed (the execution status of this line is deduced): (void)script;; | - |
294 | Q_UNUSED(handle); never executed (the execution status of this line is deduced): (void)handle;; | - |
295 | QByteArray *fileDataPtr = static_cast<QByteArray *>(handle); never executed (the execution status of this line is deduced): QByteArray *fileDataPtr = static_cast<QByteArray *>(handle); | - |
296 | QFontEngineQPA *engine = new QFontEngineQPA(fontDef,*fileDataPtr); never executed (the execution status of this line is deduced): QFontEngineQPA *engine = new QFontEngineQPA(fontDef,*fileDataPtr); | - |
297 | //qDebug() << fontDef.pixelSize << fontDef.weight << fontDef.style << fontDef.stretch << fontDef.styleHint << fontDef.styleStrategy << fontDef.family << script; | - |
298 | return engine; never executed: return engine; | 0 |
299 | } | - |
300 | | - |
301 | QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, | - |
302 | QFont::HintingPreference hintingPreference) | - |
303 | { | - |
304 | Q_UNUSED(fontData); never executed (the execution status of this line is deduced): (void)fontData;; | - |
305 | Q_UNUSED(pixelSize); never executed (the execution status of this line is deduced): (void)pixelSize;; | - |
306 | Q_UNUSED(hintingPreference); never executed (the execution status of this line is deduced): (void)hintingPreference;; | - |
307 | qWarning("This plugin does not support font engines created directly from font data"); never executed (the execution status of this line is deduced): QMessageLogger("text/qplatformfontdatabase.cpp", 307, __PRETTY_FUNCTION__).warning("This plugin does not support font engines created directly from font data"); | - |
308 | return 0; never executed: return 0; | 0 |
309 | } | - |
310 | | - |
311 | /*! | - |
312 | Returns a list of alternative fonts for the specified \a family and | - |
313 | \a style and \a script using the \a styleHint given. | - |
314 | */ | - |
315 | QStringList QPlatformFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const | - |
316 | { | - |
317 | Q_UNUSED(family); never executed (the execution status of this line is deduced): (void)family;; | - |
318 | Q_UNUSED(style); never executed (the execution status of this line is deduced): (void)style;; | - |
319 | Q_UNUSED(styleHint); never executed (the execution status of this line is deduced): (void)styleHint;; | - |
320 | Q_UNUSED(script); never executed (the execution status of this line is deduced): (void)script;; | - |
321 | return QStringList(); never executed: return QStringList(); | 0 |
322 | } | - |
323 | | - |
324 | /*! | - |
325 | Adds an application font described by the font contained supplied \a fontData | - |
326 | or using the font contained in the file referenced by \a fileName. Returns | - |
327 | a list of family names, or an empty list if the font could not be added. | - |
328 | | - |
329 | \note The default implementation of this function does not add an application | - |
330 | font. Subclasses should reimplement this function to perform the necessary | - |
331 | loading and registration of fonts. | - |
332 | */ | - |
333 | QStringList QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) | - |
334 | { | - |
335 | Q_UNUSED(fontData); never executed (the execution status of this line is deduced): (void)fontData;; | - |
336 | Q_UNUSED(fileName); never executed (the execution status of this line is deduced): (void)fileName;; | - |
337 | | - |
338 | qWarning("This plugin does not support application fonts"); never executed (the execution status of this line is deduced): QMessageLogger("text/qplatformfontdatabase.cpp", 338, __PRETTY_FUNCTION__).warning("This plugin does not support application fonts"); | - |
339 | return QStringList(); never executed: return QStringList(); | 0 |
340 | } | - |
341 | | - |
342 | /*! | - |
343 | Releases the specified font \a handle. | - |
344 | */ | - |
345 | void QPlatformFontDatabase::releaseHandle(void *handle) | - |
346 | { | - |
347 | QByteArray *fileDataPtr = static_cast<QByteArray *>(handle); never executed (the execution status of this line is deduced): QByteArray *fileDataPtr = static_cast<QByteArray *>(handle); | - |
348 | delete fileDataPtr; never executed (the execution status of this line is deduced): delete fileDataPtr; | - |
349 | } | 0 |
350 | | - |
351 | /*! | - |
352 | Returns the directory containing the fonts used by the database. | - |
353 | */ | - |
354 | QString QPlatformFontDatabase::fontDir() const | - |
355 | { | - |
356 | QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QPA_FONTDIR")); never executed (the execution status of this line is deduced): QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QPA_FONTDIR")); | - |
357 | if (fontpath.isEmpty()) { never evaluated: fontpath.isEmpty() | 0 |
358 | fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath); never executed (the execution status of this line is deduced): fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath); | - |
359 | fontpath += QLatin1String("/fonts"); never executed (the execution status of this line is deduced): fontpath += QLatin1String("/fonts"); | - |
360 | } | 0 |
361 | | - |
362 | return fontpath; never executed: return fontpath; | 0 |
363 | } | - |
364 | | - |
365 | /*! | - |
366 | Returns the default system font. | - |
367 | | - |
368 | \sa QGuiApplication::font() | - |
369 | \since 5.0 | - |
370 | */ | - |
371 | | - |
372 | QFont QPlatformFontDatabase::defaultFont() const | - |
373 | { | - |
374 | return QFont(QLatin1String("Helvetica")); never executed: return QFont(QLatin1String("Helvetica")); | 0 |
375 | } | - |
376 | | - |
377 | /*! | - |
378 | Resolve alias to actual font family names. | - |
379 | | - |
380 | \since 5.0 | - |
381 | */ | - |
382 | | - |
383 | QString QPlatformFontDatabase::resolveFontFamilyAlias(const QString &family) const | - |
384 | { | - |
385 | return family; never executed: return family; | 0 |
386 | } | - |
387 | | - |
388 | /*! | - |
389 | Return true if all fonts are considered scalable when using this font database. | - |
390 | Defaults to false. | - |
391 | | - |
392 | \since 5.0 | - |
393 | */ | - |
394 | | - |
395 | bool QPlatformFontDatabase::fontsAlwaysScalable() const | - |
396 | { | - |
397 | return false; executed: return false; Execution Count:209 | 209 |
398 | } | - |
399 | | - |
400 | /*! | - |
401 | Return list of standard font sizes when using this font database. | - |
402 | | - |
403 | \since 5.0 | - |
404 | */ | - |
405 | | - |
406 | QList<int> QPlatformFontDatabase::standardSizes() const | - |
407 | { | - |
408 | QList<int> ret; executed (the execution status of this line is deduced): QList<int> ret; | - |
409 | static const unsigned short standard[] = | - |
410 | { 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72, 0 }; | - |
411 | ret.reserve(int(sizeof(standard) / sizeof(standard[0]))); executed (the execution status of this line is deduced): ret.reserve(int(sizeof(standard) / sizeof(standard[0]))); | - |
412 | const unsigned short *sizes = standard; executed (the execution status of this line is deduced): const unsigned short *sizes = standard; | - |
413 | while (*sizes) ret << *sizes++; executed: ret << *sizes++; Execution Count:3762 evaluated: *sizes yes Evaluation Count:3762 | yes Evaluation Count:209 |
| 209-3762 |
414 | return ret; executed: return ret; Execution Count:209 | 209 |
415 | } | - |
416 | | - |
417 | /*! | - |
418 | \class QPlatformFontDatabase | - |
419 | \since 5.0 | - |
420 | \internal | - |
421 | \preliminary | - |
422 | \ingroup qpa | - |
423 | \ingroup painting | - |
424 | | - |
425 | \brief The QPlatformFontDatabase class makes it possible to customize how fonts | - |
426 | are discovered and how they are rendered | - |
427 | | - |
428 | QPlatformFontDatabase is the superclass which is intended to let platform implementations use | - |
429 | native font handling. | - |
430 | | - |
431 | Qt has its internal font database which it uses to discover available fonts on the | - |
432 | user's system. To be able to populate this database subclass this class, and | - |
433 | reimplement populateFontDatabase(). | - |
434 | | - |
435 | Use the function registerFont() to populate the internal font database. | - |
436 | | - |
437 | Sometimes a specified font does not have the required glyphs; in such a case, the | - |
438 | fallbackForFamily() function is called automatically to find alternative font | - |
439 | families that can supply alternatives to the missing glyphs. | - |
440 | | - |
441 | \sa QSupportedWritingSystems | - |
442 | */ | - |
443 | QT_END_NAMESPACE | - |
444 | | - |
| | |