Chromium Code Reviews
DescriptionSkip redundant fonts returned by FontFallbackIterator
HarfBuzzShaper asks FontFallbackIterator::next for a font by calling
next() each time it is done shaping with this font and still has
non-rendered glyphs. Depending on what the font-stack, user-preference
font, and fallback fonts returned by the system are, the shaper may try
to shape with the same font several times, and still end up not finding a
result before the LastResort font.
Since HarfBuzzFace objects are cached internally to that class and
unified using Skia unique SkTypeface IDs, we can filter for SkTypeFace
uniqueIds earlier in FontFallbackIterator and skip redundant shaping.
Examples would be:
Empty font-family CSS, but CSS code seems to set the default serif font
before we reach shaping, then we try with that, and afterwards attempt
to shape with the users default font again, which is the same, Times New
Roman in both cases. Similarly, a font-family: that has Times or Times
New Roman which we alias to the same font, etc.
BUG=636347
TEST=Manually tested this by adding debug code to HarfBuzzShaper and
detecting incoming duplicates.
Committed: https://crrev.com/5fdb26babe2d64e6f09175edffd5efe4abf220d8
Cr-Commit-Position: refs/heads/master@{#411164}
Patch Set 1 #Patch Set 2 : Don't skip subsetted ranges, plus minor fix in FontDataForRangeSet #Patch Set 3 : Logging removed #
Total comments: 2
Messages
Total messages: 22 (14 generated)
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||