DescriptionOptimize Complex Text Shaping and Caching
Change HarfBuzzShaper to return a ShapeResult instead of mutating itself
with the results from the shape operation. This allows the results to be
cached and reused without having the overhead of re-creating the shaper.
In addition this adds a new intermediary shaping step before calling the
HarfBuzzShaper; segmenting TextRuns based on spaces and shapes on a word
by word basis. In itself this adds extra overhead but when combined with
a new cache that caches the ShapeResults per word it allows for a higher
cache hit rate and enables full TextRuns to be shaped without additional
shaping as, in most cases, the full run can be satisfied based on cached
results computed for preferred width calculation or from a previous run.
The new cache replaces both the previous HarfBuzz and Font Width caches.
Word based shaping assumes that words are shaped the same way regardless
of where they occur in a sentence, as such it is currently disabled if a
given font has entry for space in either the GSUB or GPOS tables as that
indicates that the shape of a word may be affected by a space character.
If kerning and ligatures are disabled word based shaping is always used.
The current implementation hasn't been fully optimized and does a lot of
extra work yet it's quite a bit faster than our existing implementation.
Further optimization should allow even bigger wins. Similarly only width
and fillGlyphBuffer operations are currently serviced through the cache.
TEST=PerformanceTests/Layout
BUG=462643
R=behdad@chromium.org, drott@chromium.org, leviw@chromium.org
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=198501
Patch Set 1 : #
Total comments: 12
Patch Set 2 : w/TextExpectations #Patch Set 3 : Addressing review comments #
Total comments: 12
Patch Set 4 : Fix selection for vertical #Patch Set 5 : Fix emphasis computation #Patch Set 6 : Remove TypesettingFeatures check #
Total comments: 1
Patch Set 7 : Second attempt at fixing emphasis marks #Patch Set 8 : Take directionality into account for single glyph cache entries #Patch Set 9 : w/updated TestExpectations #
Total comments: 1
Patch Set 10 : Change CachingWordShaperTest as suggested #Messages
Total messages: 29 (9 generated)
|