Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webfonts API: Document fontFace and it’s values in theme.json schema #41844

Merged
merged 8 commits into from Jun 27, 2022

Conversation

grappler
Copy link
Member

@grappler grappler commented Jun 21, 2022

What?

Document the fontFace properties that we introduced in WordPress 6.0 as part of the WebFonts API.

Why?

Because there is no documentation.

How?

By including the basic technical documentation to the theme.json schema.

Testing Instructions

Create a theme.json and paste the following in the code. Currently, it says that the fontFace is not allowed. Replace https://schemas.wp.org/trunk/theme.json with https://raw.githubusercontent.com/grappler/gutenberg/schema-fontFace/schemas/json/theme.json to test changes.

`theme.json` code
{
	"$schema": "https://schemas.wp.org/trunk/theme.json",
	"version": 2,
	"settings": {
		"typography": {
			"fontFamilies": [
				{
					"fontFamily": "\"Source Serif Pro\", serif",
					"name": "Source Serif Pro",
					"slug": "source-serif-pro"
				},
				{
					"fontFamily": "\"Inter\", sans-serif",
					"name": "Inter",
					"slug": "inter",
					"fontFace": [
						{
							"fontFamily": "Inter",
							"fontWeight": "200 900",
							"fontStyle": "normal",
							"fontStretch": "normal",
							"src": [ "file:./assets/fonts/inter/Inter.ttf" ]
						}
					]
				}
			]
		}
	}
}

Screenshots

image

@grappler grappler requested a review from ajlende as a code owner June 21, 2022 15:46
@grappler grappler changed the title Document fontFace and it’s values in theme.json schema Webfonts API: Document fontFace and it’s values in theme.json schema Jun 21, 2022
@grappler grappler changed the title Webfonts API: Document fontFace and it’s values in theme.json schema Webfonts API: Document fontFace and it’s values in theme.json schema Jun 21, 2022
Copy link
Member

@fabiankaegy fabiankaegy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great addition :) Added one comment. But that can also happen in a follow up 👍

schemas/json/theme.json Outdated Show resolved Hide resolved
@grappler
Copy link
Member Author

It would be great if this could be backported to wp/6.0 too. Happy to create a second PR for that.

@Mamaduka Mamaduka merged commit afe7165 into WordPress:trunk Jun 27, 2022
@github-actions github-actions bot added this to the Gutenberg 13.6 milestone Jun 27, 2022
@Mamaduka
Copy link
Member

@adamziel, I think this needs to be backported so that the schema URL is correctly resolved. It's not a blocker for a minor release.

@Mamaduka Mamaduka added the Backport to WP Minor Release Pull request that needs to be backported to a WordPress minor release label Jun 27, 2022
@grappler grappler deleted the schema-fontFace branch June 27, 2022 08:28
@Mamaduka Mamaduka added this to Done in Fonts API Jun 27, 2022
adamziel pushed a commit that referenced this pull request Jun 30, 2022
…ema (#41844)

* Document fontFace and it’s values in theme.json schema

* npm run docs:build

* Fully document all options

* required & additionalProperties placed incorrectly

* Missing properties and small fixes

* Remove extra space

* Font-weight is not required

* Font weight can be either a string or an integer
@adamziel
Copy link
Contributor

I just cherry-picked this PR to the wp/6.0 branch to get it included in the next release: 6a79add

@adamziel adamziel removed the Backport to WP Minor Release Pull request that needs to be backported to a WordPress minor release label Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants