Skip to content

[Fonts API] does not correctly handle variable fonts files in .woff2 format #41158

@alexandrebuffet

Description

@alexandrebuffet

Description

When I register custom font families with variable font files in .woff2 format into my theme.json, the browser doesn't seem to understand the font format and the "variable" properties doesn't work.

Tested up with WordPress 5.9.3 + Gutenberg 13.2.1 and a webfont registration via theme.json in a custom Block Theme (as explained in #37140 PR).

Maybe I'm wrong, but it seems to be the format declared in the @font-face that is incorrect. I believe that a variable font file in .woff2 format should be declared with format('woff2' supports variations) hint.

Currently, it's the Webfonts Provider that deduces the format. Wouldn't it be better to leave the possibility to declare the "format" inside src array (via PHP or theme.json) for each source file?

Step-by-step reproduction instructions

  1. Register a new font family with local .woff2 variable webfont file as source
  2. Apply font family to Heading block
  3. Try to change font weight, doesn't work

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress 5.9.3, Gutenberg 13.2.1 with Custom Block Theme

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

Metadata

Metadata

Assignees

Labels

[Status] BlockedUsed to indicate that a current effort isn't able to move forward[Status] Needs More InfoFollow-up required in order to be actionable.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions