[wp-trac] [WordPress Trac] #45731: Twenty Nineteen: Implement a less aggressive approach for alternate approach for non-latin font fallbacks.
WordPress Trac
noreply at wordpress.org
Fri Dec 21 15:34:20 UTC 2018
#45731: Twenty Nineteen: Implement a less aggressive approach for alternate
approach for non-latin font fallbacks.
---------------------------+-----------------------------
Reporter: kjellr | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Bundled Theme | Version: 5.0.2
Severity: normal | Keywords: has-patch
Focuses: |
---------------------------+-----------------------------
For non-latin languages, Twenty Nineteen currently uses a lightweight but
aggressive way of implementing font fallbacks. This roughly illustrates
the method used:
{{{
html[lang="$language"] $global_wrapper * {
font-family: $font_fallbacks !important;
}
}}}
Using `!important` here is not ideal, and has already caused broken icons
in the classic editor block (as reported in
https://github.com/WordPress/twentynineteen/issues/719 ). It's bound to
cause more problems down the line, and should be avoided.
The attached patch uses a different approach, and avoids using
`!important` everywhere.
- In our sass files, it replaces all of our font-family declarations with
a mixin that bundles font fallbacks by default.
- This mixin uses the `:lang()` pseudoclass along with a Sass `@each`
directive to generate fallback rules each time a font family is defined.
To save space and avoid repetition, these fallback rules are grouped
together using a sass placeholder.
This patch was previously tested + approved on Twenty Nineteen's GitHub,
but it's a big patch and should definitely be re-tested thoroughly here
too.
''Original thread: https://github.com/WordPress/twentynineteen/pull/728''
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45731>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list