summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2014-03-04 16:27:38 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-05 13:55:35 +0100
commit3fec94fd07f23dabfa23524d55028dc09cd1ddbb (patch)
tree106e8a4accf46cc8668fdcf899925a63181cc831 /src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
parent9f1089531d75b0a831e03c3a31ef8b4e5c0b54f4 (diff)
Prevent repeated and unnecessary font population QCoreTextFontDatabase
The platform font database is populated from QFontDatabase, through the static initializeDb() function, whenever the font database determines that the platform database has not been initialized (by checking if the font database is empty). There are other clients of QPlatformFontDatabase though, such as QFont, which uses the platform font database to check for the default family. The CoreText implementation of determining the default family relies on data that is computed during font population, and hence does an internal (self-triggered) populate. To prevent repeated populates as a result of calling QFont::defaultFamily() we guard the populate by a similar isEmpty() check as QFontDatabase does, but to ensure that this check works in the case of an invalidated font database, we need to propagate the font database invalidation down to the platform font database. Change-Id: I8d06c6f6fc5da6353c087335859eaca008c2f6a6 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h')
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
index 1560d36644..5b2fc2ed7e 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
@@ -72,6 +72,8 @@ public:
QCoreTextFontDatabase();
~QCoreTextFontDatabase();
void populateFontDatabase();
+ void invalidate() Q_DECL_OVERRIDE;
+
QFontEngine *fontEngine(const QFontDef &fontDef, void *handle);
QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference);
QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const;