Correct CSS styles for variable fonts #171
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There's a bug in a private project (cc @emmamarichal) whereby proofing the italic styles is going wrong; the italic angle appears way too italic. This is because italicization is happening twice: once with the
font-variation-settingsCSS rule, and then a faux italic is being applied on top of that because we sayfont-style: italic.The classic weight/width/style CSS rules were good for static fonts, because we had a number of files representing different members of a family and we wanted to use the CSS rules to tell the browser how they were connected together as a family. But in variable fonts, we just have one font, and its style information is conveyed through applying
font-variation-settingsto the text; we don't need to tell the browser about weight/width/style separately - in fact it can cause these faux bold / faux italic problems if we do so.So what we need to do is keep track of whether a font is variable or static; if it's variable, we just apply
font-variation-settingsto the text style, but if it's static, we put weight/width/style rules in both the font face definition and the text style.