Skip to content

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

@kjellr

Description

@kjellr

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

Metadata

Metadata

Assignees

Labels

Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions