Fonts should be loaded through theme.json
Introduction
Use theme.json to register fonts, to ensure that font files are properly enqueued throughout the site.
Decision
Fonts should be added to theme.json settings in settings.typography.fontFamilies
. You can either reference an existing font family, such as a system font, or use the font-face declaration for custom fonts by using the src
parameter to add a link to the font file.
Context
Loading fonts through theme.json ensures that the font files are properly enqueued for both the editor and front end of the site. This approach also simplifies font management.
Consequences
- Extra step to download fonts.
Exceptions
- None.