No lazy loading with range on unicode-range
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
People
(Reporter: me, Unassigned)
Details
Attachments
(1 file)
439 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0
Steps to reproduce:
Load[1] the bad.html example attached that contains:
- DOM with Latin alphabet only
- CSS with 2 font-face to load a custom font
The two font-face are taking advantage of the unicode-range property to be used only for characters in the unicode code range U+0600 to U+06FF (Arabic alphabet).
The first unicode-range is defined with wildcard in the format U+06??.
The second unicode-range is defined with range in the format U+0600–06FF.
Actual results:
See in the Network tab the requests :
- a request is made to load 'font-with-codepoint-range.ttf' (bad)
- 'font-with-wildcard.ttf' is not loaded (good)
Expected results:
According to the MDN page, the font files should NOT be loaded as no characters match the unicode-range definitions in any of the two font-face.
https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range
Both font-face should have the same behaviour and skip the font when not needed.
[1] to properly reproduce, the file must not be open directly but accessed via HTTP, through a server, otherwise, no request are logged in the Network tab.
For instance, on a system with python installed, use "python -m http.server" to have a quick local server
Comment 1•5 years ago
|
||
I think this is invalid, the second rule doesn't have a valid unicode-range
descriptor. You can verify it with:
document.styleSheets[0].cssRules[1].cssText
In the console (which doesn't show the unicode range, because it didn't parse).
Also, if you enable the devtools CSS errors:
Unknown descriptor ‘+0600–06FF’ in @font-face rule. Skipped to next declaration.
The reason for that is that you're using the wrong hyphen character. If I change the descriptor to be unicode-range: U+0600-06FF;
then the issue goes away.
Let me know if that's not the case and I'm happy to look into it further.
Thanks for the report :)
Reporter | ||
Comment 2•5 years ago
|
||
Damn, I feel stupid. Copy-paste from wikipedia which uses the "En Dash".
Thank you for the fast reply.
Description
•