Qt 4.8
|
The QPlatformFontDatabase class makes it possible to customize how fonts are discovered and how they are rendered. More...
#include <qplatformfontdatabase_qpa.h>
Public Functions | |
virtual QStringList | addApplicationFont (const QByteArray &fontData, const QString &fileName) |
Adds an application font described by the font contained supplied fontData or using the font contained in the file referenced by fileName. More... | |
virtual QStringList | fallbacksForFamily (const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const |
Returns a list of alternative fonts for the specified family and style and script using the styleHint given. More... | |
virtual QString | fontDir () const |
Returns the path to the font directory. More... | |
virtual QFontEngine * | fontEngine (const QFontDef &fontDef, QUnicodeTables::Script script, void *handle) |
Returns the font engine that can be used to render the font described by the font definition, fontDef, in the specified script. More... | |
virtual QFontEngine * | fontEngine (const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) |
virtual void | populateFontDatabase () |
This function is called once at startup by Qts internal fontdatabase. More... | |
virtual void | releaseHandle (void *handle) |
Releases the font handle and deletes any associated data loaded from a file. More... | |
Static Public Functions | |
static void | registerFont (const QString &familyname, const QString &foundryname, QFont::Weight weight, QFont::Style style, QFont::Stretch stretch, bool antialiased, bool scalable, int pixelSize, 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. More... | |
static void | registerQPF2Font (const QByteArray &dataArray, void *handle) |
Registers the pre-rendered QPF2 font contained in the given dataArray. More... | |
The QPlatformFontDatabase class makes it possible to customize how fonts are discovered and how they are rendered.
QPlatformFontDatabase is the superclass which is intended to let platform implementations use native font handling.
Qt has its internal font database which it uses to discover available fonts on the user's system. To be able to populate this database subclass this class, and reimplement populateFontDatabase().
Use the function registerFont() to populate the internal font database.
Sometimes a specified font does not have the required glyphs; in such a case, the fallbackForFamily() function is called automatically to find alternative font families that can supply alternatives to the missing glyphs.
Definition at line 86 of file qplatformfontdatabase_qpa.h.
|
virtual |
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.
Reimplemented in QBasicUnixFontDatabase.
Definition at line 311 of file qplatformfontdatabase_qpa.cpp.
|
virtual |
Returns a list of alternative fonts for the specified family and style and script using the styleHint given.
Reimplemented in QBasicUnixFontDatabase, QCoreTextFontDatabase, and QFontconfigDatabase.
Definition at line 293 of file qplatformfontdatabase_qpa.cpp.
|
virtual |
Returns the path to the font directory.
The font directory is stored in the general Qt settings unless it has been overridden by the QT_QPA_FONTDIR
environment variable.
When using builds of Qt that do not support settings, the QT_QPA_FONTDIR
environment variable is the only way to specify the font directory.
Definition at line 338 of file qplatformfontdatabase_qpa.cpp.
Referenced by QBasicUnixFontDatabase::populateFontDatabase(), and populateFontDatabase().
|
virtual |
Returns the font engine that can be used to render the font described by the font definition, fontDef, in the specified script.
Reimplemented in QBasicUnixFontDatabase, QCoreTextFontDatabase, and QFontconfigDatabase.
Definition at line 269 of file qplatformfontdatabase_qpa.cpp.
Referenced by loadSingleEngine().
|
virtual |
Definition at line 279 of file qplatformfontdatabase_qpa.cpp.
|
virtual |
This function is called once at startup by Qts internal fontdatabase.
Reimplement this function in a subclass for a convenient place to initialise the internal fontdatabase.
The default implementation looks in the fontDir() location and registers all qpf2 fonts.
Reimplemented in QBasicUnixFontDatabase, QCoreTextFontDatabase, and QFontconfigDatabase.
Definition at line 242 of file qplatformfontdatabase_qpa.cpp.
Referenced by QBasicUnixFontDatabase::populateFontDatabase().
|
static |
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.
Additional information about whether the font can be scaled and antialiased can also be provided.
The foundry name and font family are described by foundryName and familyName. The font weight (light, normal, bold, etc.), style (normal, oblique, italic) and stretch information (condensed, expanded, unstretched, etc.) are specified by weight, style and stretch.
Some fonts can be antialiased and scaled; scalable and antialiased can be set to true for fonts with these attributes. The intended pixel size of non-scalable fonts is specified by pixelSize; this value will be ignored for scalable fonts.
The writing systems supported by the font are specified by the writingSystems argument.
Definition at line 124 of file qplatformfontdatabase_qpa.cpp.
Referenced by QBasicUnixFontDatabase::addTTFile(), QFontconfigDatabase::populateFontDatabase(), QCoreTextFontDatabase::populateFontDatabase(), and registerQPF2Font().
|
static |
Registers the pre-rendered QPF2 font contained in the given dataArray.
Definition at line 61 of file qplatformfontdatabase_qpa.cpp.
Referenced by populateFontDatabase().
|
virtual |
Releases the font handle and deletes any associated data loaded from a file.
Reimplemented in QBasicUnixFontDatabase.
Definition at line 323 of file qplatformfontdatabase_qpa.cpp.
Referenced by QtFontStyle::~QtFontStyle().