![]() |
Qt 6.x
The Qt SDK
|
#include <qwindowsdirectwritefontdatabase_p.h>
Public Member Functions | |
QWindowsDirectWriteFontDatabase () | |
~QWindowsDirectWriteFontDatabase () override | |
void | populateFontDatabase () override |
This function is called once at startup by Qt's internal font database. | |
void | populateFamily (const QString &familyName) override |
This function is called whenever a lazily populated family, populated through registerFontFamily(), needs full population. | |
QFontEngine * | fontEngine (const QFontDef &fontDef, void *handle) override |
Returns the font engine that can be used to render the font described by the font definition, fontDef, in the specified script. | |
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 *font=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. | |
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. | |
bool | isPrivateFontFamily (const QString &family) const override |
Returns true if the font family is private. | |
![]() | |
QWindowsFontDatabaseBase () | |
~QWindowsFontDatabaseBase () override | |
QFontEngine * | fontEngine (const QFontDef &fontDef, void *handle) override |
Returns the font engine that can be used to render the font described by the font definition, fontDef, in the specified script. | |
QFontEngine * | fontEngine (const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override |
Returns the font engine that will be used to back a QRawFont, based on the given \fontData, pixelSize, and hintingPreference. | |
QFontDef | sanitizeRequest (QFontDef request) 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 int | defaultVerticalDPI () |
static QSharedPointer< QWindowsFontEngineData > | data () |
static QFont | systemDefaultFont () |
static HFONT | systemFont () |
static LOGFONT | fontDefToLOGFONT (const QFontDef &fontDef, const QString &faceName) |
static QFont | LOGFONT_to_QFont (const LOGFONT &lf, int verticalDPI=0) |
static QString | familyForStyleHint (QFont::StyleHint styleHint) |
static QStringList | extraTryFontsForFamily (const QString &family) |
![]() | |
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 33 of file qwindowsdirectwritefontdatabase_p.h.
QWindowsDirectWriteFontDatabase::QWindowsDirectWriteFontDatabase | ( | ) |
Definition at line 21 of file qwindowsdirectwritefontdatabase.cpp.
References qCDebug.
|
override |
Definition at line 26 of file qwindowsdirectwritefontdatabase.cpp.
References QHash< Key, T >::begin(), QHash< Key, T >::end(), and it.
|
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 238 of file qwindowsdirectwritefontdatabase.cpp.
References QFontDatabase::Any, file, fileName, fromDirectWriteStretch(), fromDirectWriteStyle(), fromDirectWriteWeight(), QString::isEmpty(), QByteArray::isEmpty(), QFontDatabase::Latin, QFile::open(), properties, QFontDatabasePrivate::ApplicationFont::properties, qCDebug, qCWarning, QIODevice::readAll(), QIODeviceBase::ReadOnly, QPlatformFontDatabase::registerFont(), ret, QSupportedWritingSystems::setSupported(), and SMOOTH_SCALABLE.
|
overridevirtual |
Returns the default system font.
Reimplemented from QPlatformFontDatabase.
Definition at line 423 of file qwindowsdirectwritefontdatabase.cpp.
References QStringLiteral.
Referenced by populateFontDatabase().
|
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 226 of file qwindowsdirectwritefontdatabase.cpp.
References QWindowsFontDatabaseBase::extraTryFontsForFamily(), QPlatformFontDatabase::fallbacksForFamily(), QWindowsFontDatabaseBase::familyForStyleHint(), and qCDebug.
|
overridevirtual |
Returns the font engine that can be used to render the font described by the font definition, fontDef, in the specified script.
This function is called by QFontDatabase both for system fonts provided by the platform font database, as well as for application fonts added by the application developer.
The handle is the QPlatformFontDatabase specific handle passed when registering the font family via QPlatformFontDatabase::registerFont.
The function is called for both fonts added via a filename as well as fonts added from QByteArray data. Subclasses will need to handle both cases via its platform specific handle.
Reimplemented from QPlatformFontDatabase.
Definition at line 215 of file qwindowsdirectwritefontdatabase.cpp.
References QWindowsFontDatabaseBase::defaultVerticalDPI(), fontEngine(), QFontDef::pixelSize, and Q_ASSERT.
Referenced by fontEngine().
|
overridevirtual |
Return true if all fonts are considered scalable when using this font database.
Defaults to false.
Reimplemented from QPlatformFontDatabase.
Definition at line 354 of file qwindowsdirectwritefontdatabase.cpp.
|
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 359 of file qwindowsdirectwritefontdatabase.cpp.
References Q_UNUSED.
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 80 of file qwindowsdirectwritefontdatabase.cpp.
References QFontDatabase::Any, QVarLengthArray< T, Prealloc >::at(), QVarLengthArray< T, Prealloc >::data(), QHash< Key, T >::end(), QHash< Key, T >::find(), font, fromDirectWriteStretch(), fromDirectWriteStyle(), fromDirectWriteWeight(), i, QString::isEmpty(), it, j, MAKE_TAG, qCDebug, qCWarning, qt_error_string(), qt_writing_system_for_script(), QPlatformFontDatabase::registerFont(), QChar::script(), QSupportedWritingSystems::setSupported(), SMOOTH_SCALABLE, QFontDatabase::WritingSystemsCount, and QPlatformFontDatabase::writingSystemsFromOS2Table().
|
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 365 of file qwindowsdirectwritefontdatabase.cpp.
References QWindowsFontDatabaseBase::data(), defaultFont(), QFont::families(), i, QHash< Key, T >::insert(), QString::isEmpty(), qCDebug, qDebug, QPlatformFontDatabase::registerFontFamily(), and QWindowsFontDatabaseBase::systemDefaultFont().
Releases the specified font handle.
Reimplemented from QPlatformFontDatabase.
Definition at line 348 of file qwindowsdirectwritefontdatabase.cpp.