-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Font best-practices #848
Comments
As for language tagging, I put up an example of CJK ideographs looking slightly differently depending on language tagging: http://codepen.io/anon/pen/ENWmJQ An example what this looks like on Windows, where this probably works best: /cc @kojiishi |
How does unicode-range fits in this narrative? Does it help or not? On Mon, Nov 21, 2016, 11:39 PM Dominik Röttsches notifications@github.com
|
Adding some 2020 thoughts. No immediate plans to do this.
Would be interested to see how this affects performance. I'd think that if they are system fonts it would be no issue. I'd see a really bad case if there are a bunch of webfonts in the chain, and none contain the proper glyph.
this is the one I'm most interested in supporting in LH. CDT tells you how many glyphs are used in a text node from a specific font, but not what those glyphs are. I think we'd need to render a text node stuffed with all the characters on the page and count the number of glyphs used–then we also need a way to inspect a font fact to know how many glyphs it has. That last bit would require Chromium protocol work. If we are doing some protocol work, maybe we should just do the entire thing in Chromium–somehow wire a font's utilization from the font engine to devtools.
I think we do this already via axe. |
Had an interesting chat with @drott about font best practices. Some notes and ideas we might want to investigate in Lighthouse, in no particular order...
Long font-family lists as an anti-pattern
You should prioritize high-coverage fonts higher in your declarations, as that minimizes the amount of work the browser has to do to find the right glyph -- e.g. each step down the chain requires loading the file, querying for the character, etc. Ideally, your first~second font should provide coverage.
Byte efficiency of fetched fonts
It would be really interesting to see an efficiency metric -- e.g. you fetched 100kb of fonts vs how much of that 100kb was actually used? Low byte efficiency can help identify cases where you're using suboptimal subsetting.
Encourage use of language tagging
Scenario: you're in China and you're reading a language in Japanese. The page does not declare the language on the content and browser may default to a system fallback (China locale) that can render wrong kanji character(s).
Specifying language helps the browser select correct fallback font quickly and helps with performance if there are coverage gaps in the font stack.
@drott hope that's coherent.. please feel free to jump in and correct where/if needed.
/cc @KenjiBaheux
The text was updated successfully, but these errors were encountered: