...
Setting variable fonts is easy enough as using normal fonts. Set up font-family
, src
, font-weight
range, and font-stretch
range, and you are good to go.
Setup
Download the font file and extract under
simplytheme/src/fonts/
Include the style file in
simplytheme.libraries.yml
under fonts: css: theme:src/fonts/yourfont/style.css: {}
To serve Google fonts locally, there’s no css file provided by default. Use this tool to generate the css file to save some effort. https://gwfh.mranftl.com/fonts
Make sure the font css file does have the
font-weight
range andfont-stretch
range defined.
Without defining the font-weight
and font-stretch
will produce issues for browser font weight rendering. Suggested font-weight range is: 100 1000; and font-stretch: 75% 100%; as default.
...