diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-03-06 14:58:18 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-11 03:39:39 +0100 |
commit | c466f2ed464a06ac6427df6135d3e905011aa50e (patch) | |
tree | 8422f7d8fd71667fda85380d86c586dc0e5569ec /LICENSE.GPL | |
parent | 800232e1d3ebfbac28d07014a3c646ea00fcf6ad (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 'LICENSE.GPL')
0 files changed, 0 insertions, 0 deletions