-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
If you have a font family with a slug containing a number the presets renders presets wrongly and the font is not loaded. Example with a font called N27 and using slug n27.
In this case CSS property that is given to the elements is:
font-family: var(--wp--preset--font-family--n27);
Meanwhile the preset definition in <style id="global-styles-inline-css"> is:
--wp--preset--font-family--n-27: n27;
Pay attention to the dash in the preset definition vs the lack of it in the element font-family value: ...--n-27 vs ...--n27
Step-by-step reproduction instructions
- Add a font family with a number in their name to your
theme.jsonfile.
Example:
{
"fontFace": [
{
"fontFamily": "n27",
"fontStyle": "normal",
"fontWeight": "700",
"src": [
"file:./assets/fonts/n27_normal_700.woff2"
]
},
{
"fontFamily": "n27",
"fontStyle": "normal",
"fontWeight": "400",
"src": [
"file:./assets/fonts/n27_normal_400.woff2"
]
},
{
"fontFamily": "n27",
"fontStyle": "italic",
"fontWeight": "400",
"src": [
"file:./assets/fonts/n27_italic_400.woff2"
]
}
],
"fontFamily": "n27",
"slug": "n27"
}
- Set this font family to an element and save
- Load the public page displaying the element.
- Check that the font family is not applied.
Screenshots, screen recording, code snippet
You can download and use these theme to test. It is using the font called N27:
Environment info
- WordPress core 6.3 with and without Gutenberg 16.4
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended