Skip to content
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

[css-fonts] Allow UA to not download font hints if it would have ignored them #3926

Open
davelab6 opened this issue May 12, 2019 · 5 comments

Comments

Projects
None yet
5 participants
@davelab6
Copy link
Contributor

commented May 12, 2019

@zachleat proposed a uses-hints media query in order to have different @font-face rules (URLs really) to fonts with and without hinting data - which can be up to 50% of the file size, but is ignored on most systems (iOS, Android, Chrome)

https://twitter.com/zachleat/status/1127548970128019456?s=19

@litherum

This comment has been minimized.

Copy link
Contributor

commented May 12, 2019

Why media query? Why not modify @font-face instead? It would be simpler and wouldn't require nested at-rules. I believe we already have the infrastructure to do this; we could add a production to the font-technology term in https://drafts.csswg.org/css-fonts-4/#src-desc

@litherum litherum changed the title [css-fonts] [css-fonts] Allow UA to not download font hints if it would have ignored them May 12, 2019

@moyogo

This comment has been minimized.

Copy link

commented May 12, 2019

As far as I know, Android and Chrome use hinting if it is there. I assume iOS uses it some way or another as well, if it does anything like macOS.

This should could be requires-hints instead.

@litherum

This comment has been minimized.

Copy link
Contributor

commented May 12, 2019

My biggest concern is I’m not sure how many existing fonts out there already have versions with hints and without hints. If this keyword can’t be used on 99% of existing fonts, I’m not sure it’s worth it.

@litherum

This comment has been minimized.

Copy link
Contributor

commented May 12, 2019

Also, just saying “hinting” may be insufficient, as there are different possible ways to represent hints inside a font file (e.g. TrueType instructions, and the vstem family of commands)

@AmeliaBR

This comment has been minimized.

Copy link
Contributor

commented May 13, 2019

This seems to me like a logical extension of the format(<format> supports <technology>) specifier. As currently defined, the supports specifier allows authors to limit font downloads to user agents that support opentype features, color fonts, or variable fonts (see #633 and #2540).

We could define a hints font technology keyword, probably with parameter format for different types of hinting. Then, you could have one source file restricted to browsers that support the relevant type of hinting, and the simplified font file for other user agents:

@font-face {
  font-family: MyWebFont;
  src: url("font-full.otf") format(opentype supports hints(truetype)),
     url("font-no-hints.otf") format(opentype);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.