Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QCoreTextFontDatabase Class Reference

#include <qcoretextfontdatabase_p.h>

Inheritance diagram for QCoreTextFontDatabase:
Collaboration diagram for QCoreTextFontDatabase:

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, QFontDatabasePrivate::ExtendedScript 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.
bool supportsVariableApplicationFonts () const override
 Returns true if this font database supports loading named instances from variable application fonts.
bool supportsColrv0Fonts () const override
 Returns true if this font database supports loading color fonts in the COLRv0 format.
QFontthemeFont (QPlatformTheme::Font) const
Public Member Functions inherited from QPlatformFontDatabase
virtual ~QPlatformFontDatabase ()
virtual QFontEnginefontEngine (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 QFontEnginefontEngine (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 QFontEngineMultifontEngineMulti (QFontEngine *fontEngine, QFontDatabasePrivate::ExtendedScript 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 QString fontDir () const
 Returns the directory containing the fonts used by the database.
virtual QString resolveFontFamilyAlias (const QString &family) const
 Resolve alias to actual font family names.

Additional Inherited Members

Static Public Member Functions inherited from QPlatformFontDatabase
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, bool colorFont, 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.

Detailed Description

Definition at line 32 of file qcoretextfontdatabase_p.h.

Constructor & Destructor Documentation

◆ QCoreTextFontDatabase()

QCoreTextFontDatabase::QCoreTextFontDatabase ( )

Definition at line 78 of file qcoretextfontdatabase.mm.

◆ ~QCoreTextFontDatabase()

QCoreTextFontDatabase::~QCoreTextFontDatabase ( )

Definition at line 89 of file qcoretextfontdatabase.mm.

Member Function Documentation

◆ addApplicationFont()

QStringList QCoreTextFontDatabase::addApplicationFont ( const QByteArray & fontData,
const QString & fileName,
QFontDatabasePrivate::ApplicationFont * applicationFont = nullptr )
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.

Note
The default implementation of this function does not add an application font. Subclasses should reimplement this function to perform the necessary loading and registration of fonts.

Reimplemented from QPlatformFontDatabase.

Definition at line 759 of file qcoretextfontdatabase.mm.

◆ defaultFont()

QFont QCoreTextFontDatabase::defaultFont ( ) const
overridevirtual

Returns the default system font.

See also
QGuiApplication::font()
Since
5.0

Reimplemented from QPlatformFontDatabase.

Definition at line 1015 of file qcoretextfontdatabase.mm.

◆ fallbacksForFamily()

QStringList QCoreTextFontDatabase::fallbacksForFamily ( const QString & family,
QFont::Style style,
QFont::StyleHint styleHint,
QFontDatabasePrivate::ExtendedScript script ) const
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 648 of file qcoretextfontdatabase.mm.

◆ fontsAlwaysScalable()

bool QCoreTextFontDatabase::fontsAlwaysScalable ( ) const
overridevirtual

Return true if all fonts are considered scalable when using this font database.

Defaults to false.

Since
5.0

Reimplemented from QPlatformFontDatabase.

Definition at line 1020 of file qcoretextfontdatabase.mm.

◆ invalidate()

void QCoreTextFontDatabase::invalidate ( )
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 312 of file qcoretextfontdatabase.mm.

◆ isPrivateFontFamily()

bool QCoreTextFontDatabase::isPrivateFontFamily ( const QString & family) const
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 804 of file qcoretextfontdatabase.mm.

◆ populateFamily()

void QCoreTextFontDatabase::populateFamily ( const QString & familyName)
overridevirtual

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 293 of file qcoretextfontdatabase.mm.

◆ populateFamilyAliases()

bool QCoreTextFontDatabase::populateFamilyAliases ( const QString & missingFamily)
overridevirtual

Reimplemented from QPlatformFontDatabase.

Definition at line 232 of file qcoretextfontdatabase.mm.

◆ populateFontDatabase()

void QCoreTextFontDatabase::populateFontDatabase ( )
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 100 of file qcoretextfontdatabase.mm.

◆ releaseHandle()

void QCoreTextFontDatabase::releaseHandle ( void * handle)
overridevirtual

Releases the specified font handle.

Reimplemented from QPlatformFontDatabase.

Definition at line 473 of file qcoretextfontdatabase.mm.

◆ standardSizes()

QList< int > QCoreTextFontDatabase::standardSizes ( ) const
overridevirtual

Return list of standard font sizes when using this font database.

Since
5.0

Reimplemented from QPlatformFontDatabase.

Definition at line 1025 of file qcoretextfontdatabase.mm.

◆ supportsColrv0Fonts()

bool QCoreTextFontDatabase::supportsColrv0Fonts ( ) const
overridevirtual

Returns true if this font database supports loading color fonts in the COLRv0 format.

Since
6.9

Reimplemented from QPlatformFontDatabase.

Definition at line 1036 of file qcoretextfontdatabase.mm.

◆ supportsVariableApplicationFonts()

bool QCoreTextFontDatabase::supportsVariableApplicationFonts ( ) const
overridevirtual

Returns true if this font database supports loading named instances from variable application fonts.

Since
6.7

Reimplemented from QPlatformFontDatabase.

Definition at line 1041 of file qcoretextfontdatabase.mm.

◆ themeFont()

QFont * QCoreTextFontDatabase::themeFont ( QPlatformTheme::Font f) const

Definition at line 1005 of file qcoretextfontdatabase.mm.


The documentation for this class was generated from the following files: