Bug 122851
| Summary: | Use unicode-range to prevent unnecessary @font-face donwnloads | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ryosuke Niwa <rniwa> |
| Component: | Text | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Normal | CC: | enrica, jonlee, kling, koivisto, mmaxfield, syoichi |
| Priority: | P2 | Keywords: | BlinkMergeCandidate |
| Version: | 528+ (Nightly build) | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Ryosuke Niwa
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.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Ryosuke Niwa
Also see https://chromium.googlesource.com/chromium/blink/+/79ac8708f80986662c7a1458c3a91571db637d92
Myles C. Maxfield
*** This bug has been marked as a duplicate of bug 42154 ***