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

'name' attribute is now required on Font Face definitions (breaking many existing themes) #54605

Closed
pbking opened this issue Sep 19, 2023 · 2 comments
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Feature] Typography Font and typography-related issues and PRs Needs Dev Note Requires a developer note for a major WordPress release cycle [Type] Developer Documentation Documentation for developers

Comments

@pbking
Copy link
Contributor

pbking commented Sep 19, 2023

Description

Previously the name attribute was not required in order for fonts to render.

Now, when a theme.json is missing the 'name' attribute the font will not render as expected (it is excluded from the resources in <style id='wp-fonts-local' element).

A theme.json file used to be able to be shaped like this:

				{
					"fontFace": [
						{
							"fontFamily": "Cardo",
							"fontStyle": "normal",
							"fontWeight": "400",
							"src": [
								"file:./assets/fonts/cardo_normal_400.woff2"
							]
						}
					],
					"fontFamily": "Cardo",
					"slug": "heading"
				}

wheras now it must be shaped like this

				{
					"fontFace": [
						{
							"fontFamily": "Cardo",
							"fontStyle": "normal",
							"fontWeight": "400",
							"src": [
								"file:./assets/fonts/cardo_normal_400.woff2"
							]
						}
					],
					"fontFamily": "Cardo",
					"name": "Cardo",
					"slug": "heading"
				}

While many themes DO have the name attribute as expected many do not. Those themes will no longer display correctly once this change is released.

Step-by-step reproduction instructions

Install and activate a theme that includes fonts but does not include a 'name' attribute. Currently TwentyTwentyFour is in that state (though that is likely to change soon). Another option is the CTLG theme.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@jeffikus
Copy link

Twenty Twenty Four PR WordPress/twentytwentyfour#422

@bph bph added [Feature] Fonts API [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Needs Dev Note Requires a developer note for a major WordPress release cycle labels Sep 19, 2023
@jordesign jordesign added [Type] Bug An existing feature does not function as intended [Type] Developer Documentation Documentation for developers and removed [Type] Bug An existing feature does not function as intended labels Sep 20, 2023
@annezazu annezazu added [Feature] Typography Font and typography-related issues and PRs and removed [Feature] Fonts API labels Sep 25, 2023
@bph
Copy link
Contributor

bph commented Oct 4, 2023

I close this as it seems to be solved by #54615

@bph bph closed this as completed Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Feature] Typography Font and typography-related issues and PRs Needs Dev Note Requires a developer note for a major WordPress release cycle [Type] Developer Documentation Documentation for developers
Projects
No open projects
Status: Done
5 participants