![]() |
Qt 6.x
The Qt SDK
|
#include <qcoretextfontdatabase_p.h>
Public Member Functions | |
QCoreTextFontDatabase () | |
~QCoreTextFontDatabase () | |
void | populateFontDatabase () override |
This function is called once at startup by Qt's internal font database. | |
bool | populateFamilyAliases (const QString &missingFamily) override |
void | populateFamily (const QString &familyName) override |
This function is called whenever a lazily populated family, populated through registerFontFamily(), needs full population. | |
void | invalidate () override |
This function is called whenever the font database is invalidated. | |
QStringList | fallbacksForFamily (const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override |
Returns a list of alternative fonts for the specified family and style and script using the styleHint given. | |
QStringList | addApplicationFont (const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont=nullptr) override |
Adds an application font described by the font contained supplied fontData or using the font contained in the file referenced by fileName. | |
void | releaseHandle (void *handle) override |
Releases the specified font handle. | |
bool | isPrivateFontFamily (const QString &family) const override |
Returns true if the font family is private. | |
QFont | defaultFont () const override |
Returns the default system font. | |
bool | fontsAlwaysScalable () const override |
Return true if all fonts are considered scalable when using this font database. | |
QList< int > | standardSizes () const override |
Return list of standard font sizes when using this font database. | |
QFont * | themeFont (QPlatformTheme::Font) const |
![]() | |
virtual | ~QPlatformFontDatabase () |
virtual void | populateFontDatabase () |
This function is called once at startup by Qt's internal font database. | |
virtual bool | populateFamilyAliases (const QString &missingFamily) |
virtual void | populateFamily (const QString &familyName) |
This function is called whenever a lazily populated family, populated through registerFontFamily(), needs full population. | |
virtual void | invalidate () |
This function is called whenever the font database is invalidated. | |
virtual QStringList | fallbacksForFamily (const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const |
Returns a list of alternative fonts for the specified family and style and script using the styleHint given. | |
virtual QStringList | addApplicationFont (const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *font=nullptr) |
Adds an application font described by the font contained supplied fontData or using the font contained in the file referenced by fileName. | |
virtual QFontEngine * | fontEngine (const QFontDef &fontDef, void *handle) |
Returns the font engine that can be used to render the font described by the font definition, fontDef, in the specified script. | |
virtual QFontEngine * | fontEngine (const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) |
Returns the font engine that will be used to back a QRawFont, based on the given \fontData, pixelSize, and hintingPreference. | |
virtual QFontEngineMulti * | fontEngineMulti (QFontEngine *fontEngine, QChar::Script script) |
Returns a multi font engine in the specified script to encapsulate fontEngine with the option to fall back to the fonts given by fallbacks if fontEngine does not support a certain character. | |
virtual void | releaseHandle (void *handle) |
Releases the specified font handle. | |
virtual QString | fontDir () const |
Returns the directory containing the fonts used by the database. | |
virtual QFont | defaultFont () const |
Returns the default system font. | |
virtual bool | isPrivateFontFamily (const QString &family) const |
Returns true if the font family is private. | |
virtual QString | resolveFontFamilyAlias (const QString &family) const |
Resolve alias to actual font family names. | |
virtual bool | fontsAlwaysScalable () const |
Return true if all fonts are considered scalable when using this font database. | |
virtual QList< int > | standardSizes () const |
Return list of standard font sizes when using this font database. | |
Additional Inherited Members | |
![]() | |
static QSupportedWritingSystems | writingSystemsFromTrueTypeBits (quint32 unicodeRange[4], quint32 codePageRange[2]) |
Helper function that determines the writing systems support by a given unicodeRange and codePageRange. | |
static QSupportedWritingSystems | writingSystemsFromOS2Table (const char *os2Table, size_t length) |
Helper function that determines the writing system support based on the contents of the OS/2 table in the font. | |
static void | registerFont (const QString &familyname, const QString &stylename, const QString &foundryname, QFont::Weight weight, QFont::Style style, QFont::Stretch stretch, bool antialiased, bool scalable, int pixelSize, bool fixedPitch, const QSupportedWritingSystems &writingSystems, void *handle) |
Registers a font with the given set of attributes describing the font's foundry, family name, style and stretch information, pixel size, and supported writing systems. | |
static void | registerFontFamily (const QString &familyName) |
Registers a font family with the font database. | |
static void | registerAliasToFontFamily (const QString &familyName, const QString &alias) |
Helper function that register the alias for the familyName. | |
static void | repopulateFontDatabase () |
Requests that the platform font database should be repopulated. | |
static bool | isFamilyPopulated (const QString &familyName) |
Helper function that returns true if the font family has already been registered and populated. | |
Definition at line 32 of file qcoretextfontdatabase_p.h.
QCoreTextFontDatabase::QCoreTextFontDatabase | ( | ) |
Definition at line 77 of file qcoretextfontdatabase.mm.
References qCDebug, and QPlatformFontDatabase::repopulateFontDatabase().
QCoreTextFontDatabase::~QCoreTextFontDatabase | ( | ) |
Definition at line 88 of file qcoretextfontdatabase.mm.
References qDeleteAll().
|
overridevirtual |
Adds an application font described by the font contained supplied fontData or using the font contained in the file referenced by fileName.
Returns a list of family names, or an empty list if the font could not be added.
If applicationFont is non-null, its properties
list should be filled with information from the loaded fonts. This is exposed through FontLoader in Qt Quick where it is needed for disambiguating fonts in the same family. When the function exits, the applicationFont should contain an entry of properties per font in the file, or it should be empty if no font was loaded.
Reimplemented from QPlatformFontDatabase.
Definition at line 711 of file qcoretextfontdatabase.mm.
References fileName, QUrl::fromLocalFile(), i, and kQtFontDataAttribute.
|
overridevirtual |
Returns the default system font.
Reimplemented from QPlatformFontDatabase.
Definition at line 962 of file qcoretextfontdatabase.mm.
References QPlatformTheme::SystemFont, and themeFont().
|
overridevirtual |
Returns a list of alternative fonts for the specified family and style and script using the styleHint given.
Default implementation returns a list of fonts for which style and script support has been reported during the font database population.
Reimplemented from QPlatformFontDatabase.
Definition at line 605 of file qcoretextfontdatabase.mm.
References QSet< T >::contains(), descriptorForFamily(), descriptorForStyle(), fallbacksForDescriptor(), fallbacksForFamily(), i, QSet< T >::insert(), QString::isEmpty(), QPlatformFontDatabase::isFamilyPopulated(), isPrivateFontFamily(), pool, Q_UNUSED, qCDebug, qPrintable, QStringLiteral, qt_sort_families_by_writing_system(), QPlatformFontDatabase::registerFontFamily(), and QHash< Key, T >::value().
Referenced by fallbacksForFamily().
|
overridevirtual |
Return true if all fonts are considered scalable when using this font database.
Defaults to false.
Reimplemented from QPlatformFontDatabase.
Definition at line 967 of file qcoretextfontdatabase.mm.
|
overridevirtual |
This function is called whenever the font database is invalidated.
Reimplement this function to clear any internal data structures that will need to be rebuilt at the next call to populateFontDatabase().
Reimplemented from QPlatformFontDatabase.
Definition at line 311 of file qcoretextfontdatabase.mm.
References QHash< Key, T >::clear(), qCDebug, and qDeleteAll().
|
overridevirtual |
Returns true if the font family is private.
For any given family name, the result is platform dependent.
Reimplemented from QPlatformFontDatabase.
Definition at line 749 of file qcoretextfontdatabase.mm.
References QSet< T >::contains(), QPlatformFontDatabase::isPrivateFontFamily(), and QString::startsWith().
Referenced by fallbacksForFamily().
This function is called whenever a lazily populated family, populated through registerFontFamily(), needs full population.
You are expected to fully populate the family by calling registerFont() for each font that matches the family name.
Reimplemented from QPlatformFontDatabase.
Definition at line 292 of file qcoretextfontdatabase.mm.
References descriptorForFamily(), i, qCDebug, and qCWarning.
|
overridevirtual |
Reimplemented from QPlatformFontDatabase.
Definition at line 231 of file qcoretextfontdatabase.mm.
References QCFType< T >::as(), elapsed(), isEqual(), QPlatformFontDatabase::isFamilyPopulated(), QString::isNull(), Q_UNUSED, qCDebug, qCWarning, qPrintable, and QPlatformFontDatabase::registerAliasToFontFamily().
|
overridevirtual |
This function is called once at startup by Qt's internal font database.
Reimplement this function in a subclass for a convenient place to initialize the internal font database.
You may lazily populate the database by calling registerFontFamily() instead of registerFont(), in which case you'll get a callback to populateFamily() when the required family needs population. You then call registerFont() to finish population of the family.
The default implementation does nothing.
Reimplemented from QPlatformFontDatabase.
Definition at line 99 of file qcoretextfontdatabase.mm.
References QCFType< T >::as(), QHash< Key, T >::clear(), QOperatingSystemVersion::current(), elapsed(), QHash< Key, T >::keys(), QOperatingSystemVersion::MacOSCatalina, Q_ASSERT, qCDebug, qEnvironmentVariableIsSet(), QStringLiteral, QPlatformFontDatabase::registerFontFamily(), QChar::Script_Adlam, QChar::Script_Ahom, QChar::Script_Avestan, QChar::Script_Balinese, QChar::Script_Bamum, QChar::Script_BassaVah, QChar::Script_Batak, QChar::Script_Bhaiksuki, QChar::Script_Brahmi, QChar::Script_Buginese, QChar::Script_Buhid, QChar::Script_Carian, QChar::Script_CaucasianAlbanian, QChar::Script_Chakma, QChar::Script_Cham, QChar::Script_Coptic, QChar::Script_Cuneiform, QChar::Script_Cypriot, QChar::Script_Duployan, QChar::Script_EgyptianHieroglyphs, QChar::Script_Elbasan, QChar::Script_Glagolitic, QChar::Script_Gothic, QChar::Script_HanifiRohingya, QChar::Script_Hanunoo, QChar::Script_Hatran, QChar::Script_ImperialAramaic, QChar::Script_InscriptionalPahlavi, QChar::Script_InscriptionalParthian, QChar::Script_Javanese, QChar::Script_Kaithi, QChar::Script_KayahLi, QChar::Script_Kharoshthi, QChar::Script_Khojki, QChar::Script_Khudawadi, QChar::Script_Lepcha, QChar::Script_Limbu, QChar::Script_LinearA, QChar::Script_LinearB, QChar::Script_Lisu, QChar::Script_Lycian, QChar::Script_Lydian, QChar::Script_Mahajani, QChar::Script_Mandaic, QChar::Script_Manichaean, QChar::Script_Marchen, QChar::Script_MeeteiMayek, QChar::Script_MendeKikakui, QChar::Script_MeroiticCursive, QChar::Script_MeroiticHieroglyphs, QChar::Script_Miao, QChar::Script_Modi, QChar::Script_Mongolian, QChar::Script_Mro, QChar::Script_Multani, QChar::Script_Nabataean, QChar::Script_Newa, QChar::Script_NewTaiLue, QChar::Script_Nko, QChar::Script_OlChiki, QChar::Script_OldHungarian, QChar::Script_OldItalic, QChar::Script_OldNorthArabian, QChar::Script_OldPermic, QChar::Script_OldPersian, QChar::Script_OldSouthArabian, QChar::Script_OldTurkic, QChar::Script_Osage, QChar::Script_Osmanya, QChar::Script_PahawhHmong, QChar::Script_Palmyrene, QChar::Script_PauCinHau, QChar::Script_PhagsPa, QChar::Script_Phoenician, QChar::Script_PsalterPahlavi, QChar::Script_Rejang, QChar::Script_Samaritan, QChar::Script_Saurashtra, QChar::Script_Sharada, QChar::Script_Siddham, QChar::Script_SoraSompeng, QChar::Script_Sundanese, QChar::Script_SylotiNagri, QChar::Script_Tagalog, QChar::Script_Tagbanwa, QChar::Script_TaiLe, QChar::Script_TaiTham, QChar::Script_TaiViet, QChar::Script_Takri, QChar::Script_Thaana, QChar::Script_Tifinagh, QChar::Script_Tirhuta, QChar::Script_Ugaritic, QChar::Script_Vai, QChar::Script_Wancho, QChar::Script_WarangCiti, QChar::Script_Yi, and QHash< Key, T >::value().
Releases the specified font handle.
Reimplemented from QPlatformFontDatabase.
Definition at line 465 of file qcoretextfontdatabase.mm.
References kQtFontDataAttribute.
|
overridevirtual |
Return list of standard font sizes when using this font database.
Reimplemented from QPlatformFontDatabase.
Definition at line 972 of file qcoretextfontdatabase.mm.
References ret.
QFont * QCoreTextFontDatabase::themeFont | ( | QPlatformTheme::Font | f | ) | const |
Definition at line 952 of file qcoretextfontdatabase.mm.
References QHash< Key, T >::value().
Referenced by defaultFont(), QCocoaTheme::font(), and QIOSTheme::font().