diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-03-10 15:16:47 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-20 19:01:53 +0100 |
commit | 2bc7a40048ada41c59ddac0988bb2e04c227a18d (patch) | |
tree | 549092659e1e2c9e29c16eee3f850c809408fb44 /src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h | |
parent | 7a08f714a582b2dd1dbdcbc4c20cebc3d7536fe1 (diff) |
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 <ritt.ks@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h')
-rw-r--r-- | src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h | 1 |
1 files changed, 1 insertions, 0 deletions
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); |