From e88758878ea45ccd663eb3a6c8ba70326b7edb76 Mon Sep 17 00:00:00 2001 From: youknowriad Date: Tue, 27 Feb 2024 12:06:10 +0000 Subject: [PATCH] Font face resolver: print font faces from font families defined in all theme.json origins. This commit updates the theme.json style generation to allow a font family name to be repeated across theme.json origins (default, theme, custom). Props mmaattiiaass, hellofromtonya, arthur791004, ironprogrammer. Fixes #60605. Built from https://develop.svn.wordpress.org/trunk@57720 git-svn-id: http://core.svn.wordpress.org/trunk@57221 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/fonts.php | 10 +++++----- wp-includes/fonts/class-wp-font-face-resolver.php | 7 +------ wp-includes/version.php | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/wp-includes/fonts.php b/wp-includes/fonts.php index 9940761e73..9538981363 100644 --- a/wp-includes/fonts.php +++ b/wp-includes/fonts.php @@ -13,13 +13,13 @@ * @since 6.4.0 * * @param array[][] $fonts { - * Optional. The font-families and their font variations. Default empty array. + * Optional. The font-families and their font faces. Default empty array. * - * @type string $font-family => array[] $variations { - * Optional. An associated array of font variations for this font-family. - * Each variation has the following structure. + * @type array { + * An indexed or associative (keyed by font-family) array of font variations for this font-family. + * Each font face has the following structure. * - * @type array $font_variation { + * @type array { * @type string $font-family The font-family property. * @type string|string[] $src The URL(s) to each resource containing the font data. * @type string $font-style Optional. The font-style property. Default 'normal'. diff --git a/wp-includes/fonts/class-wp-font-face-resolver.php b/wp-includes/fonts/class-wp-font-face-resolver.php index 125ff6a227..12245af556 100644 --- a/wp-includes/fonts/class-wp-font-face-resolver.php +++ b/wp-includes/fonts/class-wp-font-face-resolver.php @@ -67,12 +67,7 @@ class WP_Font_Face_Resolver { continue; } - // Prepare the fonts array structure for this font-family. - if ( ! array_key_exists( $font_family_name, $fonts ) ) { - $fonts[ $font_family_name ] = array(); - } - - $fonts[ $font_family_name ] = static::convert_font_face_properties( $definition['fontFace'], $font_family_name ); + $fonts[] = static::convert_font_face_properties( $definition['fontFace'], $font_family_name ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 2b3b9d15e4..4b3d80782f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-beta2-57719'; +$wp_version = '6.5-beta2-57720'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.