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

Font Face: Fix getting the font-family name #5298

Conversation

hellofromtonya
Copy link
Contributor

Fixes a BC break in how the font-family name is pulled from the incoming font data.

Merge from Gutenberg's PR WordPress/gutenberg#54615.

What?

Gets the font-family name from the "fontFamily" field, instead of the "name" field.

Why?

To avoid a back-compatibility (BC) break for themes that do not have the "name" field defined.

WP Core also does not require the "name" setting. Using it exclusively is a BC break.

It's not clearly documented that the "name" setting is required. Thus, it's been optional.

How?

Uses the font-family's fontFamily field instead of its name field.

As the fontFamily field could be a comma-separated list of font-families, it parses the list to extract the first entry.

Why fontFamily setting?

WP_Theme_JSON schema requires the fontFamily setting in each of the typography.fontFamilies.

Trac ticket: https://core.trac.wordpress.org/ticket/59165


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@hellofromtonya
Copy link
Contributor Author

@hellofromtonya hellofromtonya deleted the fix/get-font-family-name-from-fontFamily branch September 25, 2023 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant