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

Add support for configuring default font-variation-settings for a font-family #10034

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/corePlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -1814,13 +1814,16 @@ export let corePlugins = {
font: (value) => {
let [families, options = {}] =
Array.isArray(value) && isPlainObject(value[1]) ? value : [value]
let { fontFeatureSettings } = options
let { fontFeatureSettings, fontVariationSettings } = options

return {
'font-family': Array.isArray(families) ? families.join(', ') : families,
...(fontFeatureSettings === undefined
? {}
: { 'font-feature-settings': fontFeatureSettings }),
...(fontVariationSettings === undefined
? {}
: { 'font-variation-settings': fontVariationSettings }),
}
},
},
Expand Down
2 changes: 2 additions & 0 deletions src/css/preflight.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
3. Use a more readable tab size.
4. Use the user's configured `sans` font-family by default.
5. Use the user's configured `sans` font-feature-settings by default.
6. Use the user's configured `sans` font-variation-settings by default.
*/

html {
Expand All @@ -32,6 +33,7 @@ html {
tab-size: 4; /* 3 */
font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
}

/*
Expand Down
Loading