WordPress/wp-admin/includes
hellofromTonya 8c4c35311b Introduce font-face styles generator and printer.
Introducing Font Face, a server-side `@font-face` styles generator and printer. 

tl;dr:
* Introduces Font Face.
* Deprecates `_wp_theme_json_webfonts_handler()`.

**Introduce Font Face**

From an array of fonts (i.e. each font-family and its font variations to be processed), it:

1. Validates each `font-face` declaration, i.e. the CSS property and value pairing. If validation fails, processing stops with no font-face styles printed.
3. Generates the `@font-face` CSS for each font-family.
4. Prints the CSS within a `<style id="wp-fonts-local">` element.

The entry point into Font Face is through a new global function called `wp_print_font_faces()`, which is automatically called:

* when the `'wp_head'` hook runs (for the front-end).
* when the `'admin_print_styles'` hook runs (for the back-end).
* when `_wp_get_iframed_editor_assets()` runs to inject the `@font-face` styles into the iframed editor.

Once called, it gets the fonts from Theme_JSON merged data layer, which includes theme defined fonts and user activated fonts (once the Font Library #59166 is introduced into Core).

For classic sites, themes and plugins can directly call `wp_print_font_faces()` and pass their fonts array to it for processing.

**Deprecates `_wp_theme_json_webfonts_handler()`.**

As Font Face is a direct replacement, the stopgap code in `_wp_theme_json_webfonts_handler()` (introduced in 6.0.0 via [53282]) is deprecated and unused in Core.

**Props note:**
There's a long multiple year history baked into Font Face, which dates back to the early versions of a web font API (see #46370 and [https://github.com/WordPress/gutenberg/issues/41479 roadmap]. The props list includes those who contributed from those early versions up to this commit.

**References:**
* #46370 original (Web)Fonts API proposal for registering and enqueuing web fonts.
* [https://github.com/WordPress/gutenberg/issues/41479 Gutenberg tracking issue] which includes the evolution from Webfonts API to Fonts API to Font Face.
* [53282] / #55567 Added the stopgap code `_wp_theme_json_webfonts_handler()` in 6.0.
* [https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face @font-face on mdn web docs]
* #59166 Font Library: Font manager for WordPress

Follow-up to [53282].

Props aristath, jonoaldersonwp, hellofromTonya, andraganescu, annezazu, antonvlasenko, arena, askdesign, azaozz, bph, bradley2083, colorful-tones, costdev, davidbaumwald, desrosj, dingo_d, djcowan, domainsupport, dryanpress, elmastudio, flixos90, francina, garrett-eclipse, gigitux, grantmkin, grapplerulrich, gziolo, ironprogrammer, jb510, jeffpaul, jeremyyip, jffng, joostdevalk, jorgefilipecosta, juanmaguitar, mamaduka, matveb, mburridge, mitogh, ndiego, ntsekouras, oandregal, ocean90, oglekler, paaljoachim, pagelab, peterwilsoncc, poena, priethor, scruffian, SergeyBiryukov, shiloey, simison, skorasaurus, soean, westonruter, wildworks, zaguiini.
Fixes #59165.
Built from https://develop.svn.wordpress.org/trunk@56500


git-svn-id: http://core.svn.wordpress.org/trunk@56012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-31 21:49:20 +00:00
..
admin-filters.php Introduce font-face styles generator and printer. 2023-08-31 21:49:20 +00:00
admin.php General: add nonce for block theme preview activation. 2023-07-11 05:03:23 +00:00
ajax-actions.php Privacy: Improve docblocks for hooks and functions related to personal data export and erasure. 2023-08-28 21:53:21 +00:00
bookmark.php Docs: Various improvements in Bookmark Administration API function descriptions, as per docblocks standards. 2023-05-03 10:03:21 +00:00
class-automatic-upgrader-skin.php Code Modernization: Replace usage of strpos() with str_contains(). 2023-06-22 14:36:26 +00:00
class-bulk-plugin-upgrader-skin.php Code Modernization: Explicitly declare all properties in WP_Ajax_Upgrader_Skin. 2022-08-29 12:46:10 +00:00
class-bulk-theme-upgrader-skin.php Code Modernization: Explicitly declare all properties in WP_Ajax_Upgrader_Skin. 2022-08-29 12:46:10 +00:00
class-bulk-upgrader-skin.php Upgrade/Install: Update 'show details' button change. 2023-06-25 22:57:26 +00:00
class-core-upgrader.php Docs: Replace multiple single line comments with multi-line comments. 2023-07-09 19:52:24 +00:00
class-custom-background.php I18N: Provide gettext context to disambiguate various translation strings. 2023-06-05 21:05:22 +00:00
class-custom-image-header.php Code Modernization: Replace usage of strpos() with str_contains(). 2023-06-22 14:36:26 +00:00
class-file-upload-upgrader.php Docs: Use third-person singular verbs in various function descriptions, as per docblocks standards. 2023-06-14 06:34:27 +00:00
class-ftp-pure.php
class-ftp-sockets.php Administration: Replace contracted verb forms for better consistency. 2022-03-22 16:25:03 +00:00
class-ftp.php Code Modernization: Replace usage of strpos() with str_contains(). 2023-06-22 14:36:26 +00:00
class-language-pack-upgrader-skin.php Code Modernization: Fix parameter name mismatches for parent/child classes in WP_Upgrader_Skin::error(). 2021-09-09 13:59:56 +00:00
class-language-pack-upgrader.php Docs: Wrap inline @see tags in curly braces. 2023-08-24 09:01:16 +00:00
class-pclzip.php Docs: Fix a few more typos in DocBlocks and inline comments. 2023-05-19 13:27:20 +00:00
class-plugin-installer-skin.php Docs: Use third-person singular verbs in various function descriptions, as per docblocks standards. 2023-06-14 06:34:27 +00:00
class-plugin-upgrader-skin.php Docs: Use third-person singular verbs in various function descriptions, as per docblocks standards. 2023-06-14 06:34:27 +00:00
class-plugin-upgrader.php Docs: Replace multiple single line comments with multi-line comments. 2023-07-09 19:52:24 +00:00
class-theme-installer-skin.php Docs: Use third-person singular verbs in various function descriptions, as per docblocks standards. 2023-06-14 06:34:27 +00:00
class-theme-upgrader-skin.php Docs: Use third-person singular verbs in various function descriptions, as per docblocks standards. 2023-06-14 06:34:27 +00:00
class-theme-upgrader.php Docs: Replace multiple single line comments with multi-line comments. 2023-07-09 19:52:24 +00:00
class-walker-category-checklist.php Docs: Wrap inline @see tags in curly braces. 2023-08-24 09:01:16 +00:00
class-walker-nav-menu-checklist.php Code Modernization: Fix last parameter name mismatches for parent/child classes in Walker::start_el(). 2021-09-09 12:39:59 +00:00
class-walker-nav-menu-edit.php I18N: Mark screen reader strings as such with translator comments. 2023-02-07 17:10:21 +00:00
class-wp-ajax-upgrader-skin.php Code Modernization: Replace usage of strpos() with str_contains(). 2023-06-22 14:36:26 +00:00
class-wp-application-passwords-list-table.php Docs: A host of corrections and improvements to inline documentation. 2023-05-08 22:37:24 +00:00
class-wp-automatic-updater.php Docs: Replace multiple single line comments with multi-line comments. 2023-07-09 19:52:24 +00:00
class-wp-comments-list-table.php Menus: Revert unintentional changes in [56449]. 2023-08-24 16:14:18 +00:00
class-wp-community-events.php Administration: Guard against false transient key in get_cached_events(). 2022-09-27 18:57:13 +00:00
class-wp-debug-data.php Database: Remove support for the mysql extension. 2023-08-26 13:03:24 +00:00
class-wp-filesystem-base.php Docs: Replace multiple single line comments with multi-line comments. 2023-07-09 19:52:24 +00:00
class-wp-filesystem-direct.php Filesystem API: Correct and improve the return type documentation for the dirlist() method in WP_Filesystem_Base and its extending classes. 2023-05-03 21:30:19 +00:00
class-wp-filesystem-ftpext.php Filesystem API: Correct and improve the return type documentation for the dirlist() method in WP_Filesystem_Base and its extending classes. 2023-05-03 21:30:19 +00:00
class-wp-filesystem-ftpsockets.php Filesystem API: Correct and improve the return type documentation for the dirlist() method in WP_Filesystem_Base and its extending classes. 2023-05-03 21:30:19 +00:00
class-wp-filesystem-ssh2.php Filesystem API: Define password as null if not set when using SSH2 with public/private keys. 2023-06-29 17:05:30 +00:00
class-wp-importer.php Coding Standards: Use strict comparison in wp-admin/includes/class-wp-importer.php. 2023-08-14 09:59:20 +00:00
class-wp-internal-pointers.php Docs: Use third-person singular verbs in various function descriptions, as per docblocks standards. 2023-06-14 12:57:20 +00:00
class-wp-links-list-table.php Menus: Revert unintentional changes in [56449]. 2023-08-24 16:14:18 +00:00
class-wp-list-table-compat.php
class-wp-list-table.php Menus: Revert unintentional changes in [56449]. 2023-08-24 16:14:18 +00:00
class-wp-media-list-table.php Menus: Revert unintentional changes in [56449]. 2023-08-24 16:14:18 +00:00
class-wp-ms-sites-list-table.php Menus: Revert unintentional changes in [56449]. 2023-08-24 16:14:18 +00:00
class-wp-ms-themes-list-table.php Menus: Revert unintentional changes in [56449]. 2023-08-24 16:14:18 +00:00
class-wp-ms-users-list-table.php Menus: Revert unintentional changes in [56449]. 2023-08-24 16:14:18 +00:00
class-wp-plugin-install-list-table.php Docs: Fix typo in duplicate hook references for views_{$this->screen->id}. 2023-08-15 10:09:24 +00:00
class-wp-plugins-list-table.php Menus: Revert unintentional changes in [56449]. 2023-08-24 16:14:18 +00:00
class-wp-post-comments-list-table.php Administration: Remove private delegation from list tables. 2022-10-04 03:47:15 +00:00
class-wp-posts-list-table.php Menus: Revert unintentional changes in [56449]. 2023-08-24 16:14:18 +00:00
class-wp-privacy-data-export-requests-list-table.php Privacy: Fix "Retry" action after a personal data export failure. 2022-03-10 19:22:01 +00:00
class-wp-privacy-data-removal-requests-list-table.php Docs: Use third-person singular verbs in various function descriptions, as per docblocks standards. 2023-06-14 06:34:27 +00:00
class-wp-privacy-policy-content.php Coding Standards: Remove unused global variables in various /wp-admin/includes/ files. 2023-08-31 14:45:20 +00:00
class-wp-privacy-requests-table.php Menus: Revert unintentional changes in [56449]. 2023-08-24 16:14:18 +00:00
class-wp-screen.php Code Modernization: Replace usage of substr() with str_starts_with() and str_ends_with(). 2023-06-22 14:57:24 +00:00
class-wp-site-health-auto-updates.php Code Modernization: Replace usage of substr() with str_starts_with() and str_ends_with(). 2023-06-22 14:57:24 +00:00
class-wp-site-health.php Database: Remove support for the mysql extension. 2023-08-26 13:03:24 +00:00
class-wp-site-icon.php Coding Standards: Use strict comparison in wp-admin/includes/class-wp-site-icon.php. 2023-04-23 04:02:18 +00:00
class-wp-terms-list-table.php Menus: Revert unintentional changes in [56449]. 2023-08-24 16:14:18 +00:00
class-wp-theme-install-list-table.php Docs: Use third-person singular verbs in various function descriptions, as per docblocks standards. 2023-06-14 06:34:27 +00:00
class-wp-themes-list-table.php Docs: A host of corrections and improvements to inline documentation. 2023-05-08 22:37:24 +00:00
class-wp-upgrader-skin.php Code Modernization: Replace usage of strpos() with str_contains(). 2023-06-22 14:36:26 +00:00
class-wp-upgrader-skins.php
class-wp-upgrader.php I18N: Add missing translator comment in WP_Upgrader::generic_strings(). 2023-07-21 13:33:27 +00:00
class-wp-users-list-table.php Menus: Revert unintentional changes in [56449]. 2023-08-24 16:14:18 +00:00
comment.php Docs: Use third-person singular verbs for function descriptions in wp-admin/includes/comment.php, as per docblocks standards. 2022-07-20 22:15:10 +00:00
continents-cities.php I18N: Update list of continents and cities for the timezone selection. 2022-09-19 23:24:11 +00:00
credits.php Code Modernization: Replace usage of strpos() with str_contains(). 2023-06-22 14:36:26 +00:00
dashboard.php Administration: Update dashboard welcome panel for 6.3. 2023-07-24 23:15:23 +00:00
deprecated.php Properly deprecate both constructors in WP_User_Search. 2023-08-25 03:37:12 +00:00
edit-tag-messages.php Docs: Various inline documentation corrections and improvements. 2021-12-07 12:20:02 +00:00
export.php General: Replace some instances of "blog" with "site" in documentation, translator comments, and user-facing text strings. 2023-06-19 18:27:27 +00:00
file.php Docs: Wrap inline @see tags in curly braces. 2023-08-24 09:01:16 +00:00
image-edit.php Coding Standards: Improve variable names in wp_save_image(). 2023-08-18 10:09:23 +00:00
image.php Docs: Replace multiple single line comments with multi-line comments. 2023-07-09 19:52:24 +00:00
import.php Docs: Various docblock improvements in Importer Administration API, as per docs standards. 2022-07-29 09:22:10 +00:00
list-table.php Administration: Remove private delegation from list tables. 2022-10-04 03:47:15 +00:00
media.php Docs: Replace multiple single line comments with multi-line comments. 2023-07-09 19:52:24 +00:00
menu.php Coding Standards: Use strict comparison in wp-admin/includes/menu.php. 2023-05-31 14:53:26 +00:00
meta-boxes.php Coding Standards: Use strict comparison in wp-admin/includes/meta-boxes.php. 2023-08-20 00:10:22 +00:00
misc.php Administration: Add function to standardize admin notices. 2023-08-17 20:29:21 +00:00
ms-admin-filters.php Networks and Sites: Officially remove global terms. 2022-09-20 02:51:09 +00:00
ms-deprecated.php Networks and Sites: Officially remove global terms. 2022-09-20 02:51:09 +00:00
ms.php Coding Standards: Remove unused global variables in various /wp-admin/includes/ files. 2023-08-31 14:45:20 +00:00
nav-menu.php Menus: Fix critical errors when the page_on_front and/or page_for_posts options contain references to non-existing posts. 2023-07-14 21:47:22 +00:00
network.php Administration: Invalid argument passed in additional_classes. 2023-08-17 21:36:21 +00:00
noop.php Coding Standards: Fix brace indentation in wp-align/includes/noop.php. 2022-11-26 09:12:17 +00:00
options.php Docs: Replace multiple single line comments with multi-line comments. 2023-07-09 20:07:22 +00:00
plugin-install.php Plugins: Correctly display spaces in new plugins search results. 2023-08-24 15:27:16 +00:00
plugin.php Docs: Miscellaneous docblock corrections and improvements. 2023-08-18 17:29:20 +00:00
post.php Docs: Replace multiple single line comments with multi-line comments. 2023-07-09 20:07:22 +00:00
privacy-tools.php Code Modernization: Replace usage of strpos() with str_contains(). 2023-06-22 14:36:26 +00:00
revision.php Docs: Replace multiple single line comments with multi-line comments. 2023-07-09 20:07:22 +00:00
schema.php Docs: Miscellaneous docblock corrections and improvements. 2023-08-18 17:29:20 +00:00
screen.php
taxonomy.php Coding Standards: Use strict comparison in wp-admin/includes/taxonomy.php. 2023-03-10 07:04:20 +00:00
template.php Docs: Correct default post type in page_template_dropdown() docblock. 2023-08-24 13:41:23 +00:00
theme-install.php I18N: Mark screen reader strings as such with translator comments. 2023-02-07 17:10:21 +00:00
theme.php Code Modernization: Use str_contains() in a few more places. 2023-07-17 13:18:27 +00:00
translation-install.php Coding Standards: Always use parentheses when instantiating an object. 2022-11-29 15:51:14 +00:00
update-core.php Revert the last use of str_starts_with() in update-core.php. 2023-08-18 23:25:24 +00:00
update.php Coding Standards: Use strict comparison in wp-admin/includes/update.php. 2023-06-01 15:14:27 +00:00
upgrade.php Coding Standards: Remove unused global variables in various /wp-admin/includes/ files. 2023-08-31 14:45:20 +00:00
user.php Code Modernization: Replace usage of strpos() with str_contains(). 2023-06-22 14:36:26 +00:00
widgets.php Docs: Various corrections and improvements to inline docs and docblocks. 2023-05-12 21:35:21 +00:00