Coverage Report

Created: 2026-10-27 06:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qtbase/src/gui/text/qplatformfontdatabase.cpp
Line
Count
Source
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#include "qplatformfontdatabase.h"
5
#include <QtGui/private/qfontengine_p.h>
6
#include <QtGui/private/qfontdatabase_p.h>
7
#include <QtGui/QGuiApplication>
8
#include <QtGui/QScreen>
9
#include <qpa/qplatformscreen.h>
10
#include <QtCore/QLibraryInfo>
11
#include <QtCore/QDir>
12
#include <QtCore/QMetaEnum>
13
#include <QtCore/qendian.h>
14
15
#include <algorithm>
16
#include <iterator>
17
18
QT_BEGIN_NAMESPACE
19
20
using namespace Qt::StringLiterals;
21
22
Q_LOGGING_CATEGORY(lcQpaFonts, "qt.qpa.fonts")
23
24
void qt_registerFont(const QString &familyname, const QString &stylename,
25
                     const QString &foundryname, int weight,
26
                     QFont::Style style, int stretch, bool antialiased,
27
                     bool scalable, int pixelSize, bool fixedPitch, bool colorFont,
28
                     const QSupportedWritingSystems &writingSystems, void *hanlde);
29
30
void qt_registerFontFamily(const QString &familyName);
31
void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias);
32
bool qt_isFontFamilyPopulated(const QString &familyName);
33
34
/*!
35
    Registers a font with the given set of attributes describing the font's
36
    foundry, family name, style and stretch information, pixel size, and
37
    supported writing systems. Additional information about whether the font
38
    can be scaled and antialiased can also be provided.
39
40
    The foundry name and font family are described by \a foundryName and
41
    \a familyName. The font weight (light, normal, bold, etc.), style (normal,
42
    oblique, italic) and stretch information (condensed, expanded, unstretched,
43
    etc.) are specified by \a weight, \a style and \a stretch.
44
45
    Some fonts can be antialiased and scaled; \a scalable and \a antialiased
46
    can be set to true for fonts with these attributes. The intended pixel
47
    size of non-scalable fonts is specified by \a pixelSize; this value will be
48
    ignored for scalable fonts.
49
50
    The writing systems supported by the font are specified by the
51
    \a writingSystems argument.
52
53
    \sa registerFontFamily()
54
*/
55
void QPlatformFontDatabase::registerFont(const QString &familyname, const QString &stylename,
56
                                         const QString &foundryname, QFont::Weight weight,
57
                                         QFont::Style style, QFont::Stretch stretch, bool antialiased,
58
                                         bool scalable, int pixelSize, bool fixedPitch, bool colorFont,
59
                                         const QSupportedWritingSystems &writingSystems, void *usrPtr)
60
0
{
61
0
    if (scalable)
62
0
        pixelSize = 0;
63
64
0
    qt_registerFont(familyname, stylename, foundryname, weight, style,
65
0
                    stretch, antialiased, scalable, pixelSize,
66
0
                    fixedPitch, colorFont, writingSystems, usrPtr);
67
0
}
68
69
/*!
70
    Registers a font family with the font database. The font will be
71
    lazily populated by a callback to populateFamily() when the font
72
    database determines that the family needs population.
73
74
    \sa populateFamily(), registerFont()
75
*/
76
void QPlatformFontDatabase::registerFontFamily(const QString &familyName)
77
0
{
78
0
    qt_registerFontFamily(familyName);
79
0
}
80
81
class QWritingSystemsPrivate
82
{
83
public:
84
    QWritingSystemsPrivate()
85
0
        : ref(1)
86
0
        , list(QFontDatabase::WritingSystemsCount, false)
87
0
    {
88
0
    }
89
90
    QWritingSystemsPrivate(const QWritingSystemsPrivate *other)
91
0
        : ref(1)
92
0
        , list(other->list)
93
0
    {
94
0
    }
95
96
    QAtomicInt ref;
97
    QList<bool> list;
98
};
99
100
/*!
101
    Constructs a new object to handle supported writing systems.
102
*/
103
QSupportedWritingSystems::QSupportedWritingSystems()
104
0
{
105
0
    d = new QWritingSystemsPrivate;
106
0
}
107
108
/*!
109
    Constructs a copy of the \a other writing systems object.
110
*/
111
QSupportedWritingSystems::QSupportedWritingSystems(const QSupportedWritingSystems &other)
112
0
{
113
0
    d = other.d;
114
0
    d->ref.ref();
115
0
}
116
117
/*!
118
    Constructs a copy of the \a other writing systems object.
119
*/
120
QSupportedWritingSystems &QSupportedWritingSystems::operator=(const QSupportedWritingSystems &other)
121
0
{
122
0
    if (d != other.d) {
123
0
        other.d->ref.ref();
124
0
        if (!d->ref.deref())
125
0
            delete d;
126
0
        d = other.d;
127
0
    }
128
0
    return *this;
129
0
}
130
131
bool operator==(const QSupportedWritingSystems &lhs, const QSupportedWritingSystems &rhs)
132
0
{
133
0
    return !(lhs != rhs);
134
0
}
135
136
bool operator!=(const QSupportedWritingSystems &lhs, const QSupportedWritingSystems &rhs)
137
0
{
138
0
    if (lhs.d == rhs.d)
139
0
        return false;
140
141
0
    Q_ASSERT(lhs.d->list.size() == rhs.d->list.size());
142
0
    Q_ASSERT(lhs.d->list.size() == QFontDatabase::WritingSystemsCount);
143
0
    for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
144
0
        if (lhs.d->list.at(i) != rhs.d->list.at(i))
145
0
            return true;
146
0
    }
147
148
0
    return false;
149
0
}
150
151
#ifndef QT_NO_DEBUG_STREAM
152
QDebug operator<<(QDebug debug, const QSupportedWritingSystems &sws)
153
0
{
154
0
    const QMetaObject *mo = &QFontDatabase::staticMetaObject;
155
0
    QMetaEnum me = mo->enumerator(mo->indexOfEnumerator("WritingSystem"));
156
157
0
    QDebugStateSaver saver(debug);
158
0
    debug.nospace() << "QSupportedWritingSystems(";
159
0
    int i = sws.d->list.indexOf(true);
160
0
    while (i > 0) {
161
0
        debug << me.valueToKey(i);
162
0
        i = sws.d->list.indexOf(true, i + 1);
163
0
        if (i > 0)
164
0
            debug << ", ";
165
0
    }
166
0
    debug << ")";
167
0
    return debug;
168
0
}
169
#endif
170
171
/*!
172
    Destroys the supported writing systems object.
173
*/
174
QSupportedWritingSystems::~QSupportedWritingSystems()
175
0
{
176
0
    if (!d->ref.deref())
177
0
        delete d;
178
0
}
179
180
/*!
181
    \internal
182
*/
183
void QSupportedWritingSystems::detach()
184
0
{
185
0
    if (d->ref.loadRelaxed() != 1) {
186
0
        QWritingSystemsPrivate *newd = new QWritingSystemsPrivate(d);
187
0
        if (!d->ref.deref())
188
0
            delete d;
189
0
        d = newd;
190
0
    }
191
0
}
192
193
/*!
194
    Sets or clears support for the specified \a writingSystem based on the
195
    value given by \a support.
196
*/
197
void QSupportedWritingSystems::setSupported(QFontDatabase::WritingSystem writingSystem, bool support)
198
0
{
199
0
    detach();
200
0
    d->list[writingSystem] = support;
201
0
}
202
203
/*!
204
    Returns \c true if the writing system specified by \a writingSystem is
205
    supported; otherwise returns \c false.
206
*/
207
bool QSupportedWritingSystems::supported(QFontDatabase::WritingSystem writingSystem) const
208
0
{
209
0
    return d->list.at(writingSystem);
210
0
}
211
212
/*!
213
    \class QSupportedWritingSystems
214
    \brief The QSupportedWritingSystems class is used when registering fonts with the internal Qt
215
    fontdatabase.
216
    \ingroup painting
217
    \inmodule QtGui
218
219
    Its to provide an easy to use interface for indicating what writing systems a specific font
220
    supports.
221
222
*/
223
224
/*!
225
    \internal
226
 */
227
QPlatformFontDatabase::~QPlatformFontDatabase()
228
0
{
229
0
}
230
231
/*!
232
  This function is called once at startup by Qt's internal font database.
233
  Reimplement this function in a subclass for a convenient place to initialize
234
  the internal font database.
235
236
  You may lazily populate the database by calling registerFontFamily() instead
237
  of registerFont(), in which case you'll get a callback to populateFamily()
238
  when the required family needs population. You then call registerFont() to
239
  finish population of the family.
240
241
  The default implementation does nothing.
242
*/
243
void QPlatformFontDatabase::populateFontDatabase()
244
0
{
245
0
}
246
247
/*!
248
    This function is called whenever a lazily populated family, populated
249
    through registerFontFamily(), needs full population.
250
251
    You are expected to fully populate the family by calling registerFont()
252
    for each font that matches the family name.
253
*/
254
void QPlatformFontDatabase::populateFamily(const QString &familyName)
255
0
{
256
0
    Q_UNUSED(familyName);
257
0
}
258
259
/*!
260
    This function is called whenever the font database is invalidated.
261
262
    Reimplement this function to clear any internal data structures that
263
    will need to be rebuilt at the next call to populateFontDatabase().
264
*/
265
void QPlatformFontDatabase::invalidate()
266
0
{
267
0
}
268
269
/*!
270
    Returns a multi font engine in the specified \a script to encapsulate \a fontEngine with the
271
    option to fall back to the fonts given by \a fallbacks if \a fontEngine does not support
272
    a certain character.
273
*/
274
QFontEngineMulti *QPlatformFontDatabase::fontEngineMulti(QFontEngine *fontEngine,
275
                                                         QFontDatabasePrivate::ExtendedScript script)
276
0
{
277
0
    return new QFontEngineMulti(fontEngine, script);
278
0
}
279
280
/*!
281
    Returns the font engine that can be used to render the font described by
282
    the font definition, \a fontDef, in the specified \a script.
283
284
    This function is called by QFontDatabase both for system fonts provided
285
    by the platform font database, as well as for application fonts added by
286
    the application developer.
287
288
    The handle is the QPlatformFontDatabase specific handle passed when
289
    registering the font family via QPlatformFontDatabase::registerFont.
290
291
    The function is called for both fonts added via a filename as well
292
    as fonts added from QByteArray data. Subclasses will need to handle
293
    both cases via its platform specific handle.
294
*/
295
QFontEngine *QPlatformFontDatabase::fontEngine(const QFontDef &fontDef, void *handle)
296
0
{
297
0
    Q_UNUSED(fontDef);
298
0
    Q_UNUSED(handle);
299
0
    qWarning("This plugin does not support loading system fonts.");
300
0
    return nullptr;
301
0
}
302
303
/*!
304
    Returns the font engine that will be used to back a QRawFont,
305
    based on the given \a fontData, \a pixelSize, and \a hintingPreference.
306
307
    This function is called by QRawFont, and does not play a part in
308
    the normal operations of QFontDatabase.
309
*/
310
QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize,
311
                                               QFont::HintingPreference hintingPreference)
312
0
{
313
0
    Q_UNUSED(fontData);
314
0
    Q_UNUSED(pixelSize);
315
0
    Q_UNUSED(hintingPreference);
316
0
    qWarning("This plugin does not support font engines created directly from font data");
317
0
    return nullptr;
318
0
}
319
320
/*!
321
    Adds an application font described by the font contained supplied \a fontData
322
    or using the font contained in the file referenced by \a fileName. Returns
323
    a list of family names, or an empty list if the font could not be added.
324
325
    If \a applicationFont is non-null, its \c properties list should be filled
326
    with information from the loaded fonts. This is exposed through FontLoader in
327
    Qt Quick where it is needed for disambiguating fonts in the same family. When
328
    the function exits, the \a applicationFont should contain an entry of properties
329
    per font in the file, or it should be empty if no font was loaded.
330
331
    \note The default implementation of this function does not add an application
332
    font. Subclasses should reimplement this function to perform the necessary
333
    loading and registration of fonts.
334
*/
335
QStringList QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont)
336
0
{
337
0
    Q_UNUSED(fontData);
338
0
    Q_UNUSED(fileName);
339
0
    Q_UNUSED(applicationFont);
340
341
0
    if (applicationFont != nullptr)
342
0
        applicationFont->properties.clear();
343
344
0
    qWarning("This plugin does not support application fonts");
345
346
0
    return QStringList();
347
0
}
348
349
/*!
350
    Releases the specified font \a handle.
351
*/
352
void QPlatformFontDatabase::releaseHandle(void *handle)
353
0
{
354
0
    QByteArray *fileDataPtr = static_cast<QByteArray *>(handle);
355
0
    delete fileDataPtr;
356
0
}
357
358
/*!
359
    Returns the directory containing the fonts used by the database.
360
*/
361
QString QPlatformFontDatabase::fontDir() const
362
0
{
363
0
    QString fontpath = qEnvironmentVariable("QT_QPA_FONTDIR");
364
0
    if (fontpath.isEmpty()) {
365
0
        QStringList paths = QLibraryInfo::paths(QLibraryInfo::LibrariesPath);
366
0
        if (!paths.isEmpty())
367
0
            fontpath = paths.takeFirst() + "/fonts"_L1;
368
0
    }
369
370
0
    return fontpath;
371
0
}
372
373
/*!
374
    Returns true if the font family is private. For any given family name,
375
    the result is platform dependent.
376
*/
377
bool QPlatformFontDatabase::isPrivateFontFamily(const QString &family) const
378
0
{
379
0
    Q_UNUSED(family);
380
0
    return false;
381
0
}
382
383
/*!
384
    Returns the default system font.
385
386
    \sa QGuiApplication::font()
387
    \since 5.0
388
*/
389
390
QFont QPlatformFontDatabase::defaultFont() const
391
0
{
392
0
    return QFont("Helvetica"_L1);
393
0
}
394
395
396
QString qt_resolveFontFamilyAlias(const QString &alias);
397
398
/*!
399
    Resolve alias to actual font family names.
400
401
    \since 5.0
402
 */
403
QString QPlatformFontDatabase::resolveFontFamilyAlias(const QString &family) const
404
0
{
405
0
    return qt_resolveFontFamilyAlias(family);
406
0
}
407
408
/*!
409
    Return true if all fonts are considered scalable when using this font database.
410
    Defaults to false.
411
412
    \since 5.0
413
 */
414
415
bool QPlatformFontDatabase::fontsAlwaysScalable() const
416
0
{
417
0
    return false;
418
0
}
419
420
/*!
421
    Return list of standard font sizes when using this font database.
422
423
    \since 5.0
424
 */
425
426
 QList<int> QPlatformFontDatabase::standardSizes() const
427
0
{
428
0
    QList<int> ret;
429
0
    static const quint8 standard[] =
430
0
        { 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72 };
431
0
    static const int num_standards = int(sizeof standard / sizeof *standard);
432
0
    ret.reserve(num_standards);
433
0
    std::copy(standard, standard + num_standards, std::back_inserter(ret));
434
0
    return ret;
435
0
}
436
437
// see the Unicode subset bitfields in the MSDN docs
438
static const quint8 requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = {
439
    { 127, 127 }, // Any
440
    { 0, 127 },   // Latin
441
    { 7, 127 },   // Greek
442
    { 9, 127 },   // Cyrillic
443
    { 10, 127 },  // Armenian
444
    { 11, 127 },  // Hebrew
445
    { 13, 127 },  // Arabic
446
    { 71, 127 },  // Syriac
447
    { 72, 127 },  // Thaana
448
    { 15, 127 },  // Devanagari
449
    { 16, 127 },  // Bengali
450
    { 17, 127 },  // Gurmukhi
451
    { 18, 127 },  // Gujarati
452
    { 19, 127 },  // Oriya
453
    { 20, 127 },  // Tamil
454
    { 21, 127 },  // Telugu
455
    { 22, 127 },  // Kannada
456
    { 23, 127 },  // Malayalam
457
    { 73, 127 },  // Sinhala
458
    { 24, 127 },  // Thai
459
    { 25, 127 },  // Lao
460
    { 70, 127 },  // Tibetan
461
    { 74, 127 },  // Myanmar
462
    { 26, 127 },  // Georgian
463
    { 80, 127 },  // Khmer
464
    { 126, 127 }, // SimplifiedChinese
465
    { 126, 127 }, // TraditionalChinese
466
    { 126, 127 }, // Japanese
467
    { 56, 127 },  // Korean
468
    { 0, 127 },   // Vietnamese (same as latin1)
469
    { 126, 127 }, // Other
470
    { 78, 127 },  // Ogham
471
    { 79, 127 },  // Runic
472
    { 14, 127 },  // Nko
473
};
474
475
enum CsbBits {
476
    Latin1CsbBit = 0,
477
    CentralEuropeCsbBit = 1,
478
    TurkishCsbBit = 4,
479
    BalticCsbBit = 7,
480
    CyrillicCsbBit = 2,
481
    GreekCsbBit = 3,
482
    HebrewCsbBit = 5,
483
    ArabicCsbBit = 6,
484
    VietnameseCsbBit = 8,
485
    SimplifiedChineseCsbBit = 18,
486
    TraditionalChineseCsbBit = 20,
487
    ThaiCsbBit = 16,
488
    JapaneseCsbBit = 17,
489
    KoreanCsbBit = 19,
490
    KoreanJohabCsbBit = 21,
491
    SymbolCsbBit = 31
492
};
493
494
/*!
495
    Helper function that determines the writing system support based on the contents of the OS/2 table
496
    in the font.
497
498
    \since 6.0
499
*/
500
QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromOS2Table(const char *os2Table, size_t length)
501
0
{
502
0
    if (length >= 86)  {
503
0
        quint32 unicodeRange[4] = {
504
0
            qFromBigEndian<quint32>(os2Table + 42),
505
0
            qFromBigEndian<quint32>(os2Table + 46),
506
0
            qFromBigEndian<quint32>(os2Table + 50),
507
0
            qFromBigEndian<quint32>(os2Table + 54)
508
0
        };
509
0
        quint32 codePageRange[2] = {
510
0
            qFromBigEndian<quint32>(os2Table + 78),
511
0
            qFromBigEndian<quint32>(os2Table + 82)
512
0
        };
513
514
0
        return writingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
515
0
    }
516
517
0
    return QSupportedWritingSystems();
518
0
}
519
520
/*!
521
    Helper function that determines the writing systems support by a given
522
    \a unicodeRange and \a codePageRange.
523
524
    \since 5.1
525
*/
526
QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(quint32 unicodeRange[4], quint32 codePageRange[2])
527
0
{
528
0
    QSupportedWritingSystems writingSystems;
529
530
0
    bool hasScript = false;
531
0
    for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
532
0
        int bit = requiredUnicodeBits[i][0];
533
0
        int index = bit/32;
534
0
        int flag = 1 << (bit&31);
535
0
        if (bit != 126 && (unicodeRange[index] & flag)) {
536
0
            bit = requiredUnicodeBits[i][1];
537
0
            index = bit/32;
538
539
0
            flag = 1 << (bit&31);
540
0
            if (bit == 127 || (unicodeRange[index] & flag)) {
541
0
                writingSystems.setSupported(QFontDatabase::WritingSystem(i));
542
0
                hasScript = true;
543
                // qDebug("font %s: index=%d, flag=%8x supports script %d", familyName.latin1(), index, flag, i);
544
0
            }
545
0
        }
546
0
    }
547
0
    if (codePageRange[0] & ((1 << Latin1CsbBit) | (1 << CentralEuropeCsbBit) | (1 << TurkishCsbBit) | (1 << BalticCsbBit))) {
548
0
        writingSystems.setSupported(QFontDatabase::Latin);
549
0
        hasScript = true;
550
        //qDebug("font %s supports Latin", familyName.latin1());
551
0
    }
552
0
    if (codePageRange[0] & (1 << CyrillicCsbBit)) {
553
0
        writingSystems.setSupported(QFontDatabase::Cyrillic);
554
0
        hasScript = true;
555
        //qDebug("font %s supports Cyrillic", familyName.latin1());
556
0
    }
557
0
    if (codePageRange[0] & (1 << GreekCsbBit)) {
558
0
        writingSystems.setSupported(QFontDatabase::Greek);
559
0
        hasScript = true;
560
        //qDebug("font %s supports Greek", familyName.latin1());
561
0
    }
562
0
    if (codePageRange[0] & (1 << HebrewCsbBit)) {
563
0
        writingSystems.setSupported(QFontDatabase::Hebrew);
564
0
        hasScript = true;
565
        //qDebug("font %s supports Hebrew", familyName.latin1());
566
0
    }
567
0
    if (codePageRange[0] & (1 << ArabicCsbBit)) {
568
0
        writingSystems.setSupported(QFontDatabase::Arabic);
569
0
        hasScript = true;
570
        //qDebug("font %s supports Arabic", familyName.latin1());
571
0
    }
572
0
    if (codePageRange[0] & (1 << ThaiCsbBit)) {
573
0
        writingSystems.setSupported(QFontDatabase::Thai);
574
0
        hasScript = true;
575
        //qDebug("font %s supports Thai", familyName.latin1());
576
0
    }
577
0
    if (codePageRange[0] & (1 << VietnameseCsbBit)) {
578
0
        writingSystems.setSupported(QFontDatabase::Vietnamese);
579
0
        hasScript = true;
580
        //qDebug("font %s supports Vietnamese", familyName.latin1());
581
0
    }
582
0
    if (codePageRange[0] & (1 << SimplifiedChineseCsbBit)) {
583
0
        writingSystems.setSupported(QFontDatabase::SimplifiedChinese);
584
0
        hasScript = true;
585
        //qDebug("font %s supports Simplified Chinese", familyName.latin1());
586
0
    }
587
0
    if (codePageRange[0] & (1 << TraditionalChineseCsbBit)) {
588
0
        writingSystems.setSupported(QFontDatabase::TraditionalChinese);
589
0
        hasScript = true;
590
        //qDebug("font %s supports Traditional Chinese", familyName.latin1());
591
0
    }
592
0
    if (codePageRange[0] & (1 << JapaneseCsbBit)) {
593
0
        writingSystems.setSupported(QFontDatabase::Japanese);
594
0
        hasScript = true;
595
        //qDebug("font %s supports Japanese", familyName.latin1());
596
0
    }
597
0
    if (codePageRange[0] & ((1 << KoreanCsbBit) | (1 << KoreanJohabCsbBit))) {
598
0
        writingSystems.setSupported(QFontDatabase::Korean);
599
0
        hasScript = true;
600
        //qDebug("font %s supports Korean", familyName.latin1());
601
0
    }
602
0
    if (codePageRange[0] & (1U << SymbolCsbBit)) {
603
0
        writingSystems = QSupportedWritingSystems();
604
0
        hasScript = false;
605
0
    }
606
607
0
    if (!hasScript)
608
0
        writingSystems.setSupported(QFontDatabase::Symbol);
609
610
0
    return writingSystems;
611
0
}
612
613
/*!
614
    Helper function that register the \a alias for the \a familyName.
615
616
    \since 5.2
617
*/
618
619
void QPlatformFontDatabase::registerAliasToFontFamily(const QString &familyName, const QString &alias)
620
0
{
621
0
    qt_registerAliasToFontFamily(familyName, alias);
622
0
}
623
624
/*!
625
    Requests that the platform font database should be repopulated.
626
627
    This will result in invalidating the entire font database.
628
629
    The next time the font database is accessed it will be repopulated
630
    via a call to QPlatformFontDatabase::populate().
631
632
    Application fonts will not be removed, and will be automatically
633
    populated when the font database is repopulated.
634
635
    \since 6.4
636
*/
637
void QPlatformFontDatabase::repopulateFontDatabase()
638
0
{
639
0
    QFontDatabasePrivate::instance()->invalidate();
640
0
}
641
642
/*!
643
    Helper function that returns true if the font family has already been registered and populated.
644
645
    \since 5.14
646
*/
647
bool QPlatformFontDatabase::isFamilyPopulated(const QString &familyName)
648
0
{
649
0
    return qt_isFontFamilyPopulated(familyName);
650
0
}
651
652
/*!
653
    Returns true if this font database supports loading named instances from variable application
654
    fonts.
655
656
    \since 6.7
657
*/
658
bool QPlatformFontDatabase::supportsVariableApplicationFonts() const
659
0
{
660
0
    return false;
661
0
}
662
663
/*!
664
    Returns true if this font database supports loading color fonts in the COLRv0 format.
665
666
    \since 6.9
667
*/
668
bool QPlatformFontDatabase::supportsColrv0Fonts() const
669
0
{
670
0
    return false;
671
0
}
672
673
/*!
674
    \class QPlatformFontDatabase
675
    \since 5.0
676
    \internal
677
    \preliminary
678
    \ingroup qpa
679
    \ingroup painting
680
681
    \brief The QPlatformFontDatabase class makes it possible to customize how fonts
682
    are discovered and how they are rendered
683
684
    QPlatformFontDatabase is the superclass which is intended to let platform implementations use
685
    native font handling.
686
687
    Qt has its internal font database which it uses to discover available fonts on the
688
    user's system. To be able to populate this database subclass this class, and
689
    reimplement populateFontDatabase().
690
691
    Use the function registerFont() to populate the internal font database.
692
693
    Sometimes a specified font does not have the required glyphs; in such a case, the
694
    fallbackForFamily() function is called automatically to find alternative font
695
    families that can supply alternatives to the missing glyphs.
696
697
    \sa QSupportedWritingSystems
698
*/
699
QT_END_NAMESPACE