• Resolved audunmb

    (@audunmb)


    I created a child theme with the Create Block Theme generator plugin as recommended. I want use the Libre Franklin font. This is variable font. According to all instructions I could find I should be able to use the following code in my theme.json file:

    "fontFamilies": [
    	{
    "fontFace": [{
    "fontFamily": "Libre Franklin",
    "fontStyle": "normal",
    "fontWeight": "100 900",
    "src": [
    "file:./assets/fonts/libre-franklin.woff2"
    ]
    },
    "fontFace": [{
    "fontFamily": "Libre Franklin",
    "fontStyle": "italic",
    "fontWeight": "100 900",
    "src": [
    "file:./assets/fonts/libre-franklin.woff2"
    ]
    },
    "fontFamily": "Libre Franklin",
    "slug": "libre-franklin"
    ],
    }

    This doesn’t work for some reason, the font doesn’t load even if the rest of the theme is applied (so any errors in the above code would be copy-paste-errors, not syntax errors). The child theme plugin generator automatically created the font files as separate .ttf-files for each weight and style, which means a 1mb of font files. That works, but a variable woff2-file would mean only some kb of files in total.

    Any idea why it won’t work?

    • This topic was modified 1 year, 9 months ago by audunmb.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter audunmb

    (@audunmb)

    Never mind, the woff2-file had errors. Downloaded new files from Google Fonts and converted to woff2 with an online converter, now it works. I’ll leave this in case anyone encounter the same issue.

Viewing 1 replies (of 1 total)
  • The topic ‘Using variable fonts and woff2-format in child theme’ is closed to new replies.