wordpress-develop/tests/phpunit/data/themedir1
Tonya Mork c29b095e76 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@56500 602fd350-edb4-49c9-b593-d223f7449a82
2023-08-31 21:47:40 +00:00
..
block_theme-[0.4.0] REST API: Support . in theme directory names in WP_REST_Global_Styles_Controller, WP_REST_Templates_Controller, and WP_REST_Themes_Controller. 2021-12-21 04:12:06 +00:00
block-theme Editor: Fix bug where it was not possible to style custom block elements in theme.json. 2023-07-18 00:00:49 +00:00
block-theme-child Block editor: Update WP_Theme_JSON_Resolver and improve its performance. 2023-02-06 15:31:50 +00:00
block-theme-child-no-theme-json Themes: Introduce wp_theme_has_theme_json() for public consumption. 2023-01-18 11:38:16 +00:00
block-theme-child-with-fluid-typography Editor: Add test data for Fluid Typography. 2022-10-11 19:50:46 +00:00
block-theme-child-with-fluid-typography-config Editor: use layout.wideSize as max viewport width. 2023-06-20 05:26:47 +00:00
block-theme-deprecated-path Themes: Accept valid block themes. 2022-05-20 00:47:45 +00:00
block-theme-non-latin REST API: Only use Latin characters in test filenames. 2023-02-17 18:37:24 +00:00
broken-theme Tests: Add a placeholder file to the broken-theme directory so it isn't removed when synced to git. 2014-01-06 18:26:07 +00:00
camelCase Code Modernization: Replace dirname( __FILE__ ) calls with __DIR__ magic constant. 2020-02-06 06:31:22 +00:00
child-parent-itself Themes: Report theme as broken that sets itself as its parent. 2017-09-26 08:53:20 +00:00
custom-internationalized-theme I18N: Introduce WP_Textdomain_Registry to store text domains and their language directory paths. 2022-08-11 12:37:05 +00:00
default Themes: Allow template loading functions to pass additional arguments to the template via the $args parameter. 2020-07-07 11:00:21 +00:00
default-child-no-theme-json Themes: Introduce wp_theme_has_theme_json() for public consumption. 2023-01-18 11:38:16 +00:00
empty-fontface-theme Themes: Add internal-only theme.json's webfonts handler (stopgap). 2022-04-26 14:46:37 +00:00
fonts-block-theme Introduce font-face styles generator and printer. 2023-08-31 21:47:40 +00:00
internationalized-theme I18N: Remove the requirement to call load_plugin_textdomain() / load_theme_textdomain(). 2016-05-10 20:04:52 +00:00
page-templates Docs: Improve inline comments per the documentation standards. 2020-01-29 00:43:23 +00:00
page-templates-child Themes: Add files missed in [41975]. 2017-10-23 20:22:44 +00:00
rest-api REST API: Add additional fields to the themes controller. 2020-06-07 06:44:08 +00:00
sandbox Code Modernization: Replace dirname( __FILE__ ) calls with __DIR__ magic constant. 2020-02-06 06:31:22 +00:00
stylesheetonly General: Ensure svn:eol-style is consistently set for all recently added files. 2021-06-27 12:44:45 +00:00
subdir REST API: Support . in theme directory names in WP_REST_Global_Styles_Controller, WP_REST_Templates_Controller, and WP_REST_Themes_Controller. 2021-12-21 04:12:06 +00:00
theme1 Code Modernization: Replace dirname( __FILE__ ) calls with __DIR__ magic constant. 2020-02-06 06:31:22 +00:00
theme1-dupe Code Modernization: Replace dirname( __FILE__ ) calls with __DIR__ magic constant. 2020-02-06 06:31:22 +00:00
update-uri-theme Themes: Add support for Update URI header. 2022-08-23 17:46:46 +00:00