diff --git a/lib/experimental/fonts/font-library/font-library.php b/lib/experimental/fonts/font-library/font-library.php index 701694155c48b..c7c6e60ada879 100644 --- a/lib/experimental/fonts/font-library/font-library.php +++ b/lib/experimental/fonts/font-library/font-library.php @@ -57,12 +57,6 @@ function wp_register_font_collection( $config ) { } } -add_action( - 'enqueue_block_editor_assets', - function () { - wp_add_inline_script( 'wp-block-editor', 'window.__experimentalFontLibrary = true', 'before' ); - } -); $default_font_collection = array( 'id' => 'default-font-collection', diff --git a/lib/load.php b/lib/load.php index 40ab9c129af97..0d442302450ea 100644 --- a/lib/load.php +++ b/lib/load.php @@ -173,6 +173,16 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/experimental/fonts/font-face/bc-layer/class-wp-webfonts.php'; require __DIR__ . '/experimental/fonts/font-face/bc-layer/class-wp-web-fonts.php'; } elseif ( ! class_exists( 'WP_Fonts' ) ) { + + // Disables the Font Library. + // @core-merge: this should not go to core. + add_action( + 'enqueue_block_editor_assets', + function () { + wp_add_inline_script( 'wp-block-editor', 'window.__experimentalDisableFontLibrary = true', 'before' ); + } + ); + // Turns off Font Face hooks in Core. // @since 6.4.0. remove_action( 'wp_head', 'wp_print_font_faces', 50 ); diff --git a/packages/edit-site/src/components/global-styles/screen-typography.js b/packages/edit-site/src/components/global-styles/screen-typography.js index 644e08a6ee137..2a895b68fa717 100644 --- a/packages/edit-site/src/components/global-styles/screen-typography.js +++ b/packages/edit-site/src/components/global-styles/screen-typography.js @@ -22,7 +22,9 @@ function ScreenTypography() { />
- { window.__experimentalFontLibrary && } + { ! window.__experimentalDisableFontLibrary && ( + + ) }