In theme.json, how to declare multiple related fonts using 1 variable font?
-
So I have the variable font for Source Serif 4, and aside from the normal font, it also includes fonts in different optical sizes (Source Serif 4 Display, Source Serif 4 Subhead, Source Serif 4 Caption, etc.). These different fonts also come in different weights.
I could declare these fonts and their font-weights separately using separate static fonts, but then the file size would be heavier than if I used just 1 all-encompassing variable font.
What I want to achieve: Have separate font options in the Gutenberg font picker for each separate font included in the variable font. All fonts and font-weights are declared with 1 variable font.
What I’ve done:
I tried this code:
"fontFace": [ { “fontFamily”: “Source Serif 4”, “fontStretch”: “normal”, “fontStyle”: “normal”, “fontWeight”: “400 500 600 700 800 900”, “src”: [ “file:./assets/fonts/SourceSerif4/SourceSerif4Variable-Roman.otf.woff2” ] } ]
But all it does is show me one Source Serif 4 option (the normal one) in the Gutenberg font picker. I cannot pick between whether I want the Display, Subhead, Caption, etc. version. Font weights load just fine, though.
- The topic ‘In theme.json, how to declare multiple related fonts using 1 variable font?’ is closed to new replies.