MicrosoftEdge / Status

This repository tracks the roadmap for the Microsoft Edge web platform. This data is used on https://status.microsoftedge.com/ to provide implementation status and forward-looking plans for web standards in Edge and other browsers.
https://status.microsoftedge.com
Other
534 stars 200 forks source link

Add CSS unicode-range #102

Open KenjiBaheux opened 10 years ago

KenjiBaheux commented 10 years ago

http://dev.w3.org/csswg/css-fonts/#unicode-range-desc

"This descriptor defines the set of Unicode codepoints that may be supported by the font face for which it is declared. The descriptor value is a comma-delimited list of Unicode range () values. The union of these ranges defines the set of codepoints that serves as a hint for user agents when deciding whether or not to download a font resource for a given text run."

This is important for performance reasons. With unicode range, you can break a large font into smaller sets which cover specific "alphabets" (e.g. latin, cyrillic, vietnamese, chinese) or specific characters (e.g. mathematical symbols, icons in the Private Use Areas).

A compliant user agent would download the strict minimum for a given document.

With the test cases shared below, Internet Explorer 11 downloads all the fonts defined for a given font-family: all the unicode ranges as well as the fallback font (much larger binary size due to the sheer number of supported glyphs).

Test cases:

  1. : download nothing http://jsbin.com/jocodedi/1/quiet PASS
  2. "Text “Hello”: download latin" http://jsbin.com/cibalono/1/quiet FAIL: latin, cyrillic, vietnamese, fallback fonts are downloaded.
  3. Euro sign: download fallback http://jsbin.com/xadaluwo/1/quiet FAIL: latin, cyrillic, vietnamese, fallback fonts are downloaded.
  4. Text “лич”: download cyrillic http://jsbin.com/muwufeve/1/quiet FAIL: latin, cyrillic fonts are downloaded. (fallback not defined)
  5. Euro sign, no fallback font: download nothing http://jsbin.com/dopacilo/1/quiet FAIL: latin, cyrillic, vietnamese fonts are downloaded.(fallback not defined)
ericlaw1979 commented 10 years ago

Interesting. The feature owner and MSDN (http://msdn.microsoft.com/en-us/library/ie/ms530757(v=vs.85).aspx) claim that Unicode-range has been supported since IE9. Is there a bug here?

KenjiBaheux commented 10 years ago

Hi Eric,

Thanks for taking a look at this.

Unless I made a mistake in my experiment setup, I believe that IE fails at most of the tests above (the notable exception being the first test). The issue is that un-necessary web fonts end up being downloaded.

Note that Blink's implementation was failing the last 3 tests until very recently. In the latest Canary, we now pass all but the last test. That being said, we have good hope that we'll be able to fix it real soon™.

igrigorik commented 10 years ago

FWIW, found this: https://connect.microsoft.com/IE/feedback/details/789754/css-font-face-unicode-range-should-be-used-to-avoid-unnecessary-downloads