DescriptionUse unicode-range to prevent unnecessary @font-face donwnloads
This patch delays font loading until creation of GlyphPage whose
codepoint range intersects with the @font-face's unicode-range value.
GlyphPage is created when glyph data for a character in its codepoint
range is requested, so web fonts are not donwloaded if its glyph data
is not used.
Even if any glyph is not used, font metrics may be used (for example,
<input> uses font metrics to calculate its size). These metrics are
accessed via SimpleFontData::primarySimpleFontData, so we start loading
there too.
Caveat:
Since GlyphPage has glyph data for contiguous 256 Unicode codepoints,
this patch does not 100% prevent unnecessary downloads. Use of codepoint
*near* the unicode-range can trigger the font load. To fix this, we need
to delay font loading until a codepoint in unicode-range is requested.
That may require changing the GlyphPage data structure.
BUG=247920
TEST=fast/css/font-face-unicode-range-load.html
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=157893
Patch Set 1 #
Total comments: 8
Patch Set 2 : #Patch Set 3 : rebase #
Total comments: 2
Patch Set 4 : rebase and add toSegmentedFontData() #Messages
Total messages: 13 (0 generated)
|