Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QPlatformFontDatabase Class

TheQPlatformFontDatabase class makes it possible to customize how fonts are discovered and how they are renderedMore...

Header:#include <QPlatformFontDatabase>
Since: Qt 4.8

Public Functions

virtual QStringListaddApplicationFont(const QByteArray & fontData, const QString & fileName)
virtual QStringListfallbacksForFamily(const QString family, const QFont::Style & style, const QFont::StyleHint & styleHint, const QUnicodeTables::Script & script) const
virtual QStringfontDir() const
virtual QFontEngine *fontEngine(const QFontDef & fontDef, QUnicodeTables::Script script, void * handle)
virtual QFontEngine *fontEngine(const QByteArray & fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
virtual voidpopulateFontDatabase()
virtual voidreleaseHandle(void * handle)

Static Public Members

voidregisterFont(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 * usrPtr)
voidregisterQPF2Font(const QByteArray & dataArray, void * handle)

Detailed Description

TheQPlatformFontDatabase 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 reimplementpopulateFontDatabase().

Use the functionregisterFont() 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.

See alsoQSupportedWritingSystems.

Member Function Documentation

[virtual]QStringList QPlatformFontDatabase::addApplicationFont(constQByteArray & fontData, constQString & fileName)

Adds an application font described by the font contained suppliedfontData or using the font contained in the file referenced byfileName. Returns a list of family names, or an empty list if the font could not be added.

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.

[virtual]QStringList QPlatformFontDatabase::fallbacksForFamily(constQString family, constQFont::Style & style, constQFont::StyleHint & styleHint, constQUnicodeTables::Script & script) const

Returns a list of alternative fonts for the specifiedfamily andstyle andscript using thestyleHint given.

[virtual]QString QPlatformFontDatabase::fontDir() const

Returns the path to the font directory.

The font directory is stored in the general Qt settings unless it has been overridden by theQT_QPA_FONTDIR environment variable.

When using builds of Qt that do not support settings, theQT_QPA_FONTDIR environment variable is the only way to specify the font directory.

[virtual]QFontEngine * QPlatformFontDatabase::fontEngine(constQFontDef & 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 specifiedscript.

[virtual]QFontEngine * QPlatformFontDatabase::fontEngine(constQByteArray & fontData,qreal pixelSize,QFont::HintingPreference hintingPreference)

[virtual]void QPlatformFontDatabase::populateFontDatabase()

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 thefontDir() location and registers all qpf2 fonts.

[static]void QPlatformFontDatabase::registerFont(constQString & familyName, constQString & foundryName,QFont::Weight weight,QFont::Style style,QFont::Stretch stretch,bool antialiased,bool scalable,int pixelSize, constQSupportedWritingSystems & writingSystems,void * usrPtr)

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 byfoundryName andfamilyName. The font weight (light, normal, bold, etc.), style (normal, oblique, italic) and stretch information (condensed, expanded, unstretched, etc.) are specified byweight,style andstretch.

Some fonts can be antialiased and scaled;scalable andantialiased can be set to true for fonts with these attributes. The intended pixel size of non-scalable fonts is specified bypixelSize; this value will be ignored for scalable fonts.

The writing systems supported by the font are specified by thewritingSystems argument.

See alsoregisterQPF2Font().

[static]void QPlatformFontDatabase::registerQPF2Font(constQByteArray & dataArray,void * handle)

Registers the pre-rendered QPF2 font contained in the givendataArray.

See alsoregisterFont().

[virtual]void QPlatformFontDatabase::releaseHandle(void * handle)

Releases the font handle and deletes any associated data loaded from a file.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp