Fonts API: allow deprecating fonts #46434
Labels
[Feature] Font Library
[Feature] Typography
Font and typography-related issues and PRs
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
Both Themes and Plugins can add Global Styles font families via the Webfonts API .
Sometimes we might want to deprecate font in such way that it continues to work for users who are already using the font at their site, but isn't available for the rest. There isn't obvious way to do so.
Deprecating font is needed when a plugin, theme, or host is offering tightly curated list of fonts and wants to make changes to the curated list by removing some of the fonts without breaking existing sites.
There could also be situations were a theme was created for a specific company or brand. Theme uses a brand font that is deprecated, and sites' users shouldn't be able to pick it. Meanwhile the font has to continue working on some pages for historical reasons.
What is your proposed solution?
Couple solutions come to mind:
I also looked at building custom solution by filtering fonts from blocks (
WP_Theme_JSON_Resolver::get_block_data()
) & user (WP_Theme_JSON_Resolver::get_user_data()
), comparing those with the list of deprecated fonts and the un-registering font if the font wasn't present in blocks or user styles.Problems:
wp_theme_json_data_theme
.var:preset|font-family|noto-sans-jp
.FYI @hellofromtonya @aristath for consideration as part of fonts API roadmap.
The text was updated successfully, but these errors were encountered: