Bug 122851 - Use unicode-range to prevent unnecessary @font-face donwnloads
Summary: Use unicode-range to prevent unnecessary @font-face donwnloads
Status: RESOLVED DUPLICATE of bug 42154
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BlinkMergeCandidate
Depends on:
Blocks:
 
Reported: 2013-10-15 12:22 PDT by Ryosuke Niwa
Modified: 2016-05-05 23:36 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2013-10-15 12:22:03 PDT
Consider merging https://chromium.googlesource.com/chromium/blink/+/342fe16bb002b8ba9cc06a10d8124df6a28c786f

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.
Comment 2 Myles C. Maxfield 2016-05-05 23:36:06 PDT

*** This bug has been marked as a duplicate of bug 42154 ***