Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QWindowsFontDatabaseBase Class Reference

#include <qwindowsfontdatabasebase_p.h>

+ Inheritance diagram for QWindowsFontDatabaseBase:
+ Collaboration diagram for QWindowsFontDatabaseBase:

Classes

class  EmbeddedFont
 
class  FontTable
 

Public Member Functions

 QWindowsFontDatabaseBase ()
 
 ~QWindowsFontDatabaseBase () override
 
QFontEnginefontEngine (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.
 
QFontEnginefontEngine (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
 
- Public Member Functions inherited from QPlatformFontDatabase
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 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, 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.
 

Static Public Member Functions

static int defaultVerticalDPI ()
 
static QSharedPointer< QWindowsFontEngineDatadata ()
 
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 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, 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 50 of file qwindowsfontdatabasebase_p.h.

Constructor & Destructor Documentation

◆ QWindowsFontDatabaseBase()

QWindowsFontDatabaseBase::QWindowsFontDatabaseBase ( )

Definition at line 501 of file qwindowsfontdatabasebase.cpp.

◆ ~QWindowsFontDatabaseBase()

QWindowsFontDatabaseBase::~QWindowsFontDatabaseBase ( )
override

Definition at line 505 of file qwindowsfontdatabasebase.cpp.

Member Function Documentation

◆ data()

QSharedPointer< QWindowsFontEngineData > QWindowsFontDatabaseBase::data ( )
static

Definition at line 513 of file qwindowsfontdatabasebase.cpp.

References qCWarning.

Referenced by QWindowsFontDatabase::QWindowsFontDatabase(), QWindowsFontDatabase::fontEngine(), fontEngine(), QWindowsFontDatabase::fontEngine(), and QWindowsDirectWriteFontDatabase::populateFontDatabase().

+ Here is the caller graph for this function:

◆ defaultVerticalDPI()

int QWindowsFontDatabaseBase::defaultVerticalDPI ( )
static

Definition at line 569 of file qwindowsfontdatabasebase.cpp.

Referenced by QWindowsFontEngine::cloneWithSize(), QWindowsFontDatabase::fontEngine(), QWindowsDirectWriteFontDatabase::fontEngine(), QWindowsFontDatabase::fontEngine(), LOGFONT_to_QFont(), and systemDefaultFont().

+ Here is the caller graph for this function:

◆ extraTryFontsForFamily()

QStringList QWindowsFontDatabaseBase::extraTryFontsForFamily ( const QString family)
static

Definition at line 863 of file qwindowsfontdatabasebase.cpp.

References QString::append(), ch_CN_tryFonts, ch_TW_tryFonts, contains(), QFontDatabase::families(), QString::fromLatin1(), QFontDatabase::hasFamily(), jp_tryFonts, kr_tryFonts, other_tryFonts, QStringLiteral, QFontDatabase::Symbol, tryFonts, and QFontDatabase::writingSystems().

Referenced by QWindowsDirectWriteFontDatabase::fallbacksForFamily(), QWindowsFontDatabaseFT::fallbacksForFamily(), and QWindowsFontDatabase::fallbacksForFamily().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ familyForStyleHint()

QString QWindowsFontDatabaseBase::familyForStyleHint ( QFont::StyleHint  styleHint)
static

Definition at line 784 of file qwindowsfontdatabasebase.cpp.

References QFont::Courier, QFont::Cursive, QFont::Decorative, QFont::Fantasy, QFont::Helvetica, QFont::Monospace, QStringLiteral, QFont::System, and QFont::Times.

Referenced by QWindowsDirectWriteFontDatabase::fallbacksForFamily(), QWindowsFontDatabaseFT::fallbacksForFamily(), and QWindowsFontDatabase::fallbacksForFamily().

+ Here is the caller graph for this function:

◆ fontDefToLOGFONT()

LOGFONT QWindowsFontDatabaseBase::fontDefToLOGFONT ( const QFontDef fontDef,
const QString faceName 
)
static

Definition at line 574 of file qwindowsfontdatabasebase.cpp.

References CLEARTYPE_QUALITY, QFont::Courier, QFont::ForceOutline, QFont::Helvetica, hint(), QString::isEmpty(), QFont::NoAntialias, QFont::Normal, QFont::NoSubpixelAntialias, QFont::OldEnglish, QFont::PreferAntialias, QFont::PreferBitmap, QFont::PreferDevice, QFont::PreferMatch, QFont::PreferOutline, QFont::PreferQuality, Q_UNLIKELY, qCritical, qPrintable, qRound(), request, QString::size(), QFont::StyleNormal, QFont::System, QFont::Times, QString::truncate(), and QString::utf16().

Referenced by QWindowsFontDatabase::createEngine(), and QWindowsDirect2DPaintEnginePrivate::fontFaceFromFontEngine().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fontEngine() [1/2]

QFontEngine * QWindowsFontDatabaseBase::fontEngine ( const QByteArray fontData,
qreal  pixelSize,
QFont::HintingPreference  hintingPreference 
)
overridevirtual

Returns the font engine that will be used to back a QRawFont, based on the given \fontData, pixelSize, and hintingPreference.

This function is called by QRawFont, and does not play a part in the normal operations of QFontDatabase.

Reimplemented from QPlatformFontDatabase.

Definition at line 754 of file qwindowsfontdatabasebase.cpp.

References data(), QFontDef::families, font, QFontEngine::fontDef, fontEngine(), QFontDef::hintingPreference, and Q_UNUSED.

+ Here is the call graph for this function:

◆ fontEngine() [2/2]

QFontEngine * QWindowsFontDatabaseBase::fontEngine ( const QFontDef fontDef,
void handle 
)
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 747 of file qwindowsfontdatabasebase.cpp.

References QPlatformFontDatabase::fontEngine().

Referenced by QWindowsFontDatabase::fontEngine(), fontEngine(), and QWindowsFontDatabaseBase::EmbeddedFont::updateFromOS2Table().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LOGFONT_to_QFont()

QFont QWindowsFontDatabaseBase::LOGFONT_to_QFont ( const LOGFONT &  lf,
int  verticalDPI = 0 
)
static

Definition at line 659 of file qwindowsfontdatabasebase.cpp.

References defaultVerticalDPI(), QString::fromWCharArray(), qAbs(), QFont::setItalic(), QFont::setOverline(), QFont::setPointSizeF(), QFont::setStrikeOut(), QFont::setUnderline(), and QFont::setWeight().

Referenced by QWindowsTheme::refreshFonts(), and systemDefaultFont().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sanitizeRequest()

QFontDef QWindowsFontDatabaseBase::sanitizeRequest ( QFontDef  request) const

Definition at line 902 of file qwindowsfontdatabasebase.cpp.

References QFontDef::families, QString::isEmpty(), QFont::PreferBitmap, qRound(), QStringLiteral, request, and QFont::StyleItalic.

+ Here is the call graph for this function:

◆ systemDefaultFont()

QFont QWindowsFontDatabaseBase::systemDefaultFont ( )
static

Definition at line 683 of file qwindowsfontdatabasebase.cpp.

References defaultVerticalDPI(), LOGFONT_to_QFont(), qCDebug, and systemFont().

Referenced by QWindowsFontDatabaseFT::defaultFont(), QWindowsFontDatabase::defaultFont(), QWindowsDirectWriteFontDatabase::populateFontDatabase(), QWindowsFontDatabaseFT::populateFontDatabase(), QWindowsFontDatabase::populateFontDatabase(), and QWindowsTheme::refreshFonts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ systemFont()

HFONT QWindowsFontDatabaseBase::systemFont ( )
static

Definition at line 676 of file qwindowsfontdatabasebase.cpp.

Referenced by QWindowsFontEngine::QWindowsFontEngine(), QWindowsFontEngine::~QWindowsFontEngine(), QWindowsFontDatabase::createEngine(), and systemDefaultFont().

+ Here is the caller graph for this function:

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