-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
This is an epic ticket to share the ongoing roadmap including:
- the vision of how this supports typography features (e.g. see Global Styles Ongoing Roadmap #41232 and Global Styles/Typography: Managing fonts #45271).
- tracking of ongoing work and needs in preparation for WordPress 6.4.
Updates:
- 28 July 2022 After discussing with @mtias, added the Font Library and FAQ sections
- 18 Jan 2023 API renamed to Fonts API
- 19 Jun 2023 Scope changed, introduce Font Face, and deprecate Fonts API
Changed to Font Face: to server-side generate and print fonts' @font-face styles
With the introduction of the new Fonts Library, the role of the Fonts API has significantly changed as noted in #41479 (comment).
Previously, its roles were:
- Role 1: Generate and print the @font-face styles for all “enqueued” fonts.
- Role 2: Provide a means for plugins to present fonts to users, who can then decide whether to use these fonts (i.e. through the Site Editor).
Its new role is:
- Generate and print the @font-face styles for all theme defined and user activated fonts.
Fonts will be presented to users via the Fonts Library, rather than through the Fonts API.
Plugins will no longer interact with the Fonts API. Instead, they will integrate directly into the Font Library (once that capability exists).
Font Face "gets" the fonts to print from Theme JSON merged data layer. Fonts are no longer registered or enqueued directly with it.
A full API is no longer needed. Thus, Font Face replaces the Fonts API.
Vision
As part of fonts management and Fonts Library,
This API's job is to provide the backend capabilities to support the "font library" to include font management and dynamic building of the @font-face styles.
The "font library" feature will continue to be built, refined, stabilized, and tuned over multiple WordPress releases.
Font Library
See #50927.
The idea is to have the concept of a font library on a site to
- manage and catalogue fonts
- and then provide users an interface for them to select which fonts to use in the live site.
The fonts in the library can come from:
- a theme bundling them
- a user uploading fonts they purchased
- a plugin
The fonts to be used in the site are saved and available via Theme JSON merged data layer, i.e. WP_Theme_JSON_Resolver_Gutenberg::get_merged_data()->get_settings().
FAQ
What about classic sites?
Yes, supported ✅
Classic themes and plugins can have their @font-face styles generated and printed. How?
Classic themes have 2 options:
- Option 1: Add a callback function hooked in
'wp_head'and'admin_print_styles'and within that callback function, invoke a new print method and pass their fonts to it. - Option 2: Add a
theme.jsonfile that only defines the fonts. See issue [Fonts API] Proposal: classic themes define fonts in a theme.json file #51714 for more information.
Plugins supporting classic sites can use Option 1.
Ongoing work
Architecture
⭐ Required for Core introduction:
- Font Face: redesign the Fonts API to become only a font-face styles generator and printer #51769 ✅ Done 10 Jul 2023
- [Fonts API] Deprecate and remove all functionality (in favor of Font Face) #51819 ✅ Done 18 Jul 2023
- [Fonts API] Deprecate and remove all functionality (in favor of Font Face) #51819 🚫 until Fonts Library is merged
Performance
⭐ Required for Core introduction:
None
Feature needs
⭐ Required for Core introduction:
None
Future enhancements
- Add font management UI to Customizer for classic themes
Bugs
None
Documentation
Backports
Future.
Tracking key
✅ Done
⚪ WIP: work in progress
🟡 Experiment WIP
🍏 in testing or code review
🔴 Danger > immediate action needed
🚫 Blocked
⭐ Needed for WP Core introduction