From dc2e1202f069fb9762f919f00a6bcfc47f6c2cb8 Mon Sep 17 00:00:00 2001 From: Tonya Mork Date: Mon, 17 Apr 2023 09:18:24 -0500 Subject: [PATCH] Revert "[Font API] Use registered fonts for Block Editor iframe. (#49646)" (#49863) This reverts commit d39f350044db548c2251095b722063ea8da83ebf. --- lib/compat/wordpress-6.2/script-loader.php | 31 +++++++++------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/lib/compat/wordpress-6.2/script-loader.php b/lib/compat/wordpress-6.2/script-loader.php index bba4d732a78744..149a6a18e14507 100644 --- a/lib/compat/wordpress-6.2/script-loader.php +++ b/lib/compat/wordpress-6.2/script-loader.php @@ -130,33 +130,26 @@ function gutenberg_resolve_assets_override() { $scripts = ob_get_clean(); /* - * Generate font @font-face styles for the iframe. - * - * For the Site Editor, use the registered fonts. - * For the Block Editor, use the enqueued fonts. + * Generate font @font-face styles for the site editor iframe. + * Use the registered font families for printing. */ if ( class_exists( 'WP_Fonts' ) ) { - $wp_fonts = wp_fonts(); - $registered = $wp_fonts->get_registered_font_families(); - $is_site_editor = 'site-editor.php' === $pagenow; - + $wp_fonts = wp_fonts(); + $registered = $wp_fonts->get_registered_font_families(); if ( ! empty( $registered ) ) { - $done = $wp_fonts->done; - $wp_fonts->done = array(); - if ( $is_site_editor ) { - $queue = $wp_fonts->queue; - $wp_fonts->queue = $registered; - } + $queue = $wp_fonts->queue; + $done = $wp_fonts->done; + + $wp_fonts->done = array(); + $wp_fonts->queue = $registered; ob_start(); $wp_fonts->do_items(); $styles .= ob_get_clean(); - // Reset the Fonts API. - $wp_fonts->done = $done; - if ( $is_site_editor ) { - $wp_fonts->queue = $queue; - } + // Reset the Web Fonts API. + $wp_fonts->done = $done; + $wp_fonts->queue = $queue; } }