Make cache of opentype tables in Harfbuzz face lazy
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Fri, 2 Mar 2012 15:20:55 +0000 (16:20 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 6 Mar 2012 11:43:27 +0000 (12:43 +0100)
commit9f13a7d020749e936dfe0b4c0a1d46f4dbee810f
tree6c57ce12ee48ff0a47ec15d19ba44b3341ccfdd6
parente5dabe8338cb3dacf24079e315e07f2705fd0a70
Make cache of opentype tables in Harfbuzz face lazy

The mechanism in fontconfig which determines if a certain character
is available (FcCharSetHasChar()) may give false positives, in which
case we would load and unload those fonts per every char for which
FC gave us a false positive. This was a major performance regression.
Specifically the false positives happened when looking at e.g.
italic variants of certain multilingual fonts, since we only check
the charset of the font family as a whole and not of the specific variant,
which may only support a subset of the chars.

To optimize this, we remove the deletion of the font engines after
loading them, but also wait with loading the opentype tables until
they are actually needed. This means that for the false positives,
we will load the font, but the cached data for each unused font will
be much smaller.

Change-Id: Idfc794401a2080da5946bf65204eb947aeb635ed
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
src/corelib/tools/qharfbuzz.cpp
src/corelib/tools/qharfbuzz_p.h
src/gui/text/qfontengine.cpp
src/gui/text/qfontengine_p.h
src/gui/text/qtextengine.cpp