Skip to content

Is it possible to add font-feature-settings to theme.json #47127

Answered by t-hamano
CGTS asked this question in Q&A
Discussion options

You must be logged in to vote

Hi.

When specifying a font family, its properties can also be defined. Like this:

{
	"$schema": "https://schemas.wp.org/trunk/theme.json",
	"version": 2,
	"settings": {
		"typography": {
			"fontFamilies": [
				{
					"fontFace": [
						{
							"fontFamily": "Source Serif Pro",
							"fontFeatureSettings": "some-value",
							"src": [
								"file:./assets/fonts/source-serif-pro/SourceSerif4Variable-Roman.ttf.woff2"
							]
						}
					],
					"fontFamily": "\"Source Serif Pro\", serif",
					"name": "Source Serif Pro",
					"slug": "source-serif-pro"
				}
			]
		}
	}
}

From this definition, the following styles are output:

<style id="wp-fonts-local">
@font-face{
	font-family:"S…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@CGTS
Comment options

Answer selected by CGTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants