From 2bc7a40048ada41c59ddac0988bb2e04c227a18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 10 Mar 2014 15:16:47 +0100 Subject: Teach font database to populate families lazily Instead of requiring that QPlatformFontDatabase::populateFontDatabase() populates every single font in the system by calling registerFont(), we now allow the platform database to call registerFontFamily() instead, and then keep track of which families we've yet to fully populate in the font database. Once a property of a family is requested (such as its writing system, style, etc), the family is lazily populated by calling back to the platform database through QPlatformFontDatabase::populateFamily(), which in turn does the final call to registerFont() as before. This cuts application startup on OS X and iOS (of which the font population used to be a major limiting factor) from roughly one second to about 350ms. Task-number: QTBUG-37165 Change-Id: Ic2fc3447beb818ffe23635a5b7816ed7e70c93a7 Reviewed-by: Konstantin Ritt Reviewed-by: Erik Verbruggen Reviewed-by: Simon Hausmann --- src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h') diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index c6fc791503..c73f4a32ca 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -72,6 +72,7 @@ public: QCoreTextFontDatabase(); ~QCoreTextFontDatabase(); void populateFontDatabase(); + void populateFamily(const QString &familyName) Q_DECL_OVERRIDE; QFontEngine *fontEngine(const QFontDef &fontDef, void *handle); QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference); -- cgit v1.2.3