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: Multiple Typeface resources not loaded #40487

Closed
pbking opened this issue Apr 20, 2022 · 1 comment · Fixed by #40489
Closed

Webfonts: Multiple Typeface resources not loaded #40487

pbking opened this issue Apr 20, 2022 · 1 comment · Fixed by #40489
Labels
[Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed

Comments

@pbking
Copy link
Contributor

pbking commented Apr 20, 2022

Description

As noted elsewhere when multiple targets are defined via theme.json for the webfonts API only the first is loaded. This seems to be true both for italic variations as well as typefaces for various font weights.

Step-by-step reproduction instructions

With the following fonts defined in theme.json:

...
		"typography": {
			"fontFamilies": [
				{
					"fontFamily": "Inter, sans-serif",
					"slug": "body-font",
					"name": "Body",
					"fontFace": [
						{
							"fontDisplay": "block",
							"fontFamily": "Inter",
							"fontWeight": "100",
							"fontStyle": "normal",
							"fontStretch": "normal",
							"src": [
								"file:./assets/fonts/Inter-Light.ttf"
							]
						},
						{
							"fontDisplay": "block",
							"fontFamily": "Inter",
							"fontWeight": "500",
							"fontStyle": "normal",
							"fontStretch": "normal",
							"src": [
								"file:./assets/fonts/Inter-Regular.ttf"
							]
						}
				}
			],
		}
...

Note that only the following is rendered:

<style id='webfonts-inline-css'>
@font-face{font-family:Inter;font-style:normal;font-weight:100;font-display:block;src:local(Inter), url('/wp-content/themes/themes/pendant/assets/fonts/Inter-Light.ttf') format('truetype');font-stretch:normal;}
</style>

whereas entries for both Inter-Light and Inter-Regular are expected.

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress 5.9
  • Gutenberg Trunk

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

@skorasaurus
Copy link
Member

thanks for reporting; it's a duplicate #40453 ; so I'm closing this to consolidate discussion.

@skorasaurus skorasaurus added the [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed label Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants