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-06 14:58:18 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-11 03:39:39 +0100
commitc466f2ed464a06ac6427df6135d3e905011aa50e (patch)
tree8422f7d8fd71667fda85380d86c586dc0e5569ec /src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
parent800232e1d3ebfbac28d07014a3c646ea00fcf6ad (diff)
Remove need to populate font database on OS X to get fallback families
Populating the whole database takes a while, and it's very easy to trigger the fallback family code path through eg. matching or getting the default font family from QFont. Instead of relying on populate to resolve family name to a PostScript name (which was required when using CTFontCreateWithName), we instead use the CTFontDescriptorCreateWithAttributes() function to create a descriptor based on the family name, and then use CTFontCreateWithFontDescriptor(). The other way around, we use CTFontDescriptorCreateWithNameAndSize, and then pull out the family name from the descriptor. The need for creating a CTFont for private fonts (eg '.Apple Symbols Fallback') does not seem necessary anymore, as tested on 10.7-10.9. The disadvantage of creating font descriptors instead of re-using the data computed by population is that we're doing the same work twice, but the end result is making the font database more lazy, and the 80% use-case is assumed to be that you're only interested in the fallback of a small number of fonts, which means you don't want to populate all of the fonts in the system (taking about 1100ms on the test system). Looking up the fallback of a single family or style now takes about 15-25ms. Task-number: QTBUG-37165 Change-Id: I6b904dbe796a3f236919d778d0168fdef9a20e69 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h')
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h3
1 files changed, 0 insertions, 3 deletions
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
index 5b2fc2ed7e..c6fc791503 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
@@ -72,7 +72,6 @@ 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);
@@ -86,8 +85,6 @@ private:
void populateFromDescriptor(CTFontDescriptorRef font);
mutable QString defaultFontName;
- mutable QHash<QString, QString> psNameToFamily;
- mutable QHash<QString, QString> familyNameToPsName;
void removeApplicationFonts();