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

[Styles] Webfonts enqueued using styles JSON files are not loaded #39702

Closed
kjellr opened this issue Mar 23, 2022 · 5 comments · Fixed by #39886
Closed

[Styles] Webfonts enqueued using styles JSON files are not loaded #39702

kjellr opened this issue Mar 23, 2022 · 5 comments · Fixed by #39886
Assignees
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended

Comments

@kjellr
Copy link
Contributor

kjellr commented Mar 23, 2022

Webfonts declared in custom styles json files are not enqueued. No error is thrown, but the fonts are not loaded in.


To reproduce:

  1. Add a style variation to emptytheme.
  2. Add font file(s)
  3. Declare the font using fontFace under settings.typography.fontFamilies.
  4. Open the Site Editor.
  5. Select the variation, notice that the correct font is not loaded.

Example PR here: WordPress/theme-experiments#304

In the PR example, the same code works properly when pasted into theme.json instead of styles/variation.json.


Screenshots:

styles

The correct font for the variation should be DM Sans. Instead, the default sans-serif fallback is being used, and no network call to the DM Sans font files is being made.

Screen Shot 2022-03-23 at 1 36 47 PM

@kjellr kjellr added [Type] Bug An existing feature does not function as intended [Feature] Webfonts [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Mar 23, 2022
@jasmussen
Copy link
Contributor

@youknowriad @aristath @jorgefilipecosta have you worked with fonts, or have an idea what might be up here?

@youknowriad
Copy link
Contributor

I guess we only load the fonts that are on the main theme.json and not the variations. It's going to be important to solve this in a way that lazy-loads these fonts. (In case variations will come from a directory later)

@aristath
Copy link
Member

aristath commented Mar 29, 2022

huh... tbh I wasn't even aware of the existence of variation.json files! 😬
Where do we parse these? I can't seem to find any reference to variation.json in Gutenberg's code 👀

@kjellr
Copy link
Contributor Author

kjellr commented Mar 29, 2022

👋 @aristath style variations were implemented over in #35619

@aristath
Copy link
Member

Thank you for the additional context @kjellr 👍
I added a PR for this in #39886

@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label May 22, 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. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
5 participants