From 97921e21125f865684cbb05e72e357ad6efb5345 Mon Sep 17 00:00:00 2001 From: Matias Benedetto Date: Fri, 22 Sep 2023 18:50:10 -0300 Subject: [PATCH 1/2] Refactor logic and naming of the frontend variable used to disable the font library. This change is needed in core because there, we will not be using the PHP constant FONT_LIBRARY_DISABLED. The previous code depended on this constant to render the library in the frontend. With this change the library will render as default. --- .../fonts/font-library/disable-font-library.php | 9 +++++++++ lib/experimental/fonts/font-library/font-library.php | 6 ------ lib/load.php | 3 +++ .../src/components/global-styles/screen-typography.js | 4 +++- 4 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 lib/experimental/fonts/font-library/disable-font-library.php diff --git a/lib/experimental/fonts/font-library/disable-font-library.php b/lib/experimental/fonts/font-library/disable-font-library.php new file mode 100644 index 00000000000000..3ea34ec66f7a45 --- /dev/null +++ b/lib/experimental/fonts/font-library/disable-font-library.php @@ -0,0 +1,9 @@ + 'default-font-collection', diff --git a/lib/load.php b/lib/load.php index 40ab9c129af973..2ab7038a28a3e0 100644 --- a/lib/load.php +++ b/lib/load.php @@ -173,6 +173,9 @@ 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. + require __DIR__ . '/experimental/fonts/font-library/disable-font-library.php'; + // 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 644e08a6ee137a..2a895b68fa717f 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 && ( + + ) }
From 05f87c932c4a6869e3f3fe8c5c7c76e16774ff8b Mon Sep 17 00:00:00 2001 From: Matias Benedetto Date: Fri, 22 Sep 2023 21:25:44 -0300 Subject: [PATCH 2/2] avoid using a new file just for one call. move the call to load.php --- .../fonts/font-library/disable-font-library.php | 9 --------- lib/load.php | 9 ++++++++- 2 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 lib/experimental/fonts/font-library/disable-font-library.php diff --git a/lib/experimental/fonts/font-library/disable-font-library.php b/lib/experimental/fonts/font-library/disable-font-library.php deleted file mode 100644 index 3ea34ec66f7a45..00000000000000 --- a/lib/experimental/fonts/font-library/disable-font-library.php +++ /dev/null @@ -1,9 +0,0 @@ -