diff options
Diffstat (limited to 'src/gui/text/qplatformfontdatabase.cpp')
-rw-r--r-- | src/gui/text/qplatformfontdatabase.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index 5f277c878a..33301005c6 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -53,6 +53,7 @@ void qt_registerFont(const QString &familyname, const QString &stylename, bool scalable, int pixelSize, bool fixedPitch, const QSupportedWritingSystems &writingSystems, void *hanlde); +void qt_registerFontFamily(const QString &familyName); void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias); /*! @@ -118,7 +119,7 @@ void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void * The writing systems supported by the font are specified by the \a writingSystems argument. - \sa registerQPF2Font() + \sa registerQPF2Font(), registerFontFamily() */ void QPlatformFontDatabase::registerFont(const QString &familyname, const QString &stylename, const QString &foundryname, QFont::Weight weight, @@ -134,6 +135,18 @@ void QPlatformFontDatabase::registerFont(const QString &familyname, const QStrin fixedPitch, writingSystems, usrPtr); } +/*! + Registers a font family with the font database. The font will be + lazily populated by a callback to populateFamily() when the font + database determines that the family needs population. + + \sa populateFamily(), registerFont() +*/ +void QPlatformFontDatabase::registerFontFamily(const QString &familyName) +{ + qt_registerFontFamily(familyName); +} + class QWritingSystemsPrivate { public: @@ -249,6 +262,11 @@ QPlatformFontDatabase::~QPlatformFontDatabase() 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 looks in the fontDir() location and registers all QPF2 fonts. */ @@ -276,6 +294,18 @@ void QPlatformFontDatabase::populateFontDatabase() } /*! + 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. +*/ +void QPlatformFontDatabase::populateFamily(const QString &familyName) +{ + Q_UNUSED(familyName); +} + +/*! This function is called whenever the font database is invalidated. Reimplement this function to clear any internal data structures that |