You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on a project, i noticed that my font styles were not displaying as they should (italic style was simulated and font weights other than regular weren't working at all).
I then realized, that apparently only the first @font-face declaration of a webfont is being output in frontend when you register them via theme.json.
It works as expected in the editor, where every style is being enqeued and therefore displayed properly.
I also was able to reproduce the issue on a fresh local WordPress installation with just the Gutenberg plugin and the TT2 theme.
What i expect:
Every @font-face declaration in a font-family is being registered and output (at least when they're used on the current page).
What actually happens:
Only the first @font-face in a font-family definition is being output (frontend only).
Step-by-step reproduction instructions
Follow the testing instructions mentioned in Webfonts API #37140
(or just define a fontFamily with more than one fontFace declaration in theme.json[settings][typography][fontFamilies])
Inspect the html output inline style webfonts-inline-css
And i'm having even more trouble using wp_register_webfonts to add webfonts.
In frontend the inline style with the @font-face declarations is not being printed out at all - but again, in the editor this is working properly, as all font-faces seem to be enqeued and displayed.
I am really not sure what i could be missing here since i followed the testing instructions in #37140 very closely (including the suggestions mentioned in #37140 (review)).
jakobwiens7
changed the title
Webfonts API outputs only the first @font-face definition per font-family
Webfonts API outputs only the first @font-face of a theme.json defined font-family in frontend
Apr 20, 2022
Description
While working on a project, i noticed that my font styles were not displaying as they should (italic style was simulated and font weights other than regular weren't working at all).
I then realized, that apparently only the first
@font-face
declaration of a webfont is being output in frontend when you register them viatheme.json
.It works as expected in the editor, where every style is being enqeued and therefore displayed properly.
I also was able to reproduce the issue on a fresh local WordPress installation with just the Gutenberg plugin and the TT2 theme.
What i expect:
Every
@font-face
declaration in a font-family is being registered and output (at least when they're used on the current page).What actually happens:
Only the first
@font-face
in a font-family definition is being output (frontend only).Step-by-step reproduction instructions
(or just define a
fontFamily
with more than onefontFace
declaration intheme.json[settings][typography][fontFamilies]
)webfonts-inline-css
Screenshots, screen recording, code snippet
The above
theme.json[settings][typography][fontFamilies]
definition outputs the following style in frontend:(Notice the missing italic style
@font-face
declaration)Environment info
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
The text was updated successfully, but these errors were encountered: