💄 style(fonts): change font fallback implementation #473
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.
Summary
Instead of defining fall back from local font to URL download in
@font-face
at-rules, implement fall back more in thefont-family
font stacks.Using the font-family is the simplest way to allow the browser to fully use local font families, including italic fonts.
Using custom font-family names in the
@font-face
rules avoids conflict with well-known font families so that the custom subsets will only be referenced explicitly, not unintentionally.Related issue
#472
Changes
Move the prioritisation of local fonts from @font-face to the main CSS font-family declarations and use custom font-family names in the @font-face at-rules. For example, change from:
To:
The fallback functions the same but:
@font-face
rules.Cascadia Code
without having knowledge of tabi implementationNotable differences that could be considered notable or possibly breaking changes:
Inter
,Source Serif
, orCascadia Code
then they will no longer have a fallback to the theme-bundled subsets.Screenshots
Before the tabi site viewed on Windows has a local regular font for italic text in code block:
After, the italics are rendered with the local italic font:
On a Mac when I override the fonts with my desired font stack I can see
Menlo Italic
being used, with no requests to download fonts.Type of change
Checklist