From 3c40573f77240b78a6b77c96a5509173d99b9b3f Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Fri, 31 May 2019 10:10:54 +0000 Subject: [PATCH] Bundled Theme: Load Google fonts with `display=fallback` parameter for better UX in case the font cannot be loaded. Providing this query parameter ensures the stylesheet contains the `font-display: fallback` rule. This changeset also updates the Open Sans font used by core accordingly. Props westonruter. Fixes #47282. Built from https://develop.svn.wordpress.org/trunk@45485 git-svn-id: http://core.svn.wordpress.org/trunk@45296 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-content/themes/twentyfifteen/functions.php | 5 +++-- wp-content/themes/twentyfourteen/functions.php | 5 +++-- wp-content/themes/twentyseventeen/functions.php | 5 +++-- wp-content/themes/twentysixteen/functions.php | 5 +++-- wp-content/themes/twentythirteen/functions.php | 5 +++-- wp-content/themes/twentytwelve/functions.php | 5 +++-- wp-includes/script-loader.php | 2 +- wp-includes/version.php | 2 +- 8 files changed, 20 insertions(+), 14 deletions(-) diff --git a/wp-content/themes/twentyfifteen/functions.php b/wp-content/themes/twentyfifteen/functions.php index db6451f0b9..f312ce9e7c 100644 --- a/wp-content/themes/twentyfifteen/functions.php +++ b/wp-content/themes/twentyfifteen/functions.php @@ -331,8 +331,9 @@ if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) : if ( $fonts ) { $fonts_url = add_query_arg( array( - 'family' => urlencode( implode( '|', $fonts ) ), - 'subset' => urlencode( $subsets ), + 'family' => urlencode( implode( '|', $fonts ) ), + 'subset' => urlencode( $subsets ), + 'display' => urlencode( 'fallback' ), ), 'https://fonts.googleapis.com/css' ); diff --git a/wp-content/themes/twentyfourteen/functions.php b/wp-content/themes/twentyfourteen/functions.php index c017dac644..29b68e4065 100644 --- a/wp-content/themes/twentyfourteen/functions.php +++ b/wp-content/themes/twentyfourteen/functions.php @@ -294,8 +294,9 @@ function twentyfourteen_font_url() { */ if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) { $query_args = array( - 'family' => urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), - 'subset' => urlencode( 'latin,latin-ext' ), + 'family' => urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), + 'subset' => urlencode( 'latin,latin-ext' ), + 'display' => urlencode( 'fallback' ), ); $font_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } diff --git a/wp-content/themes/twentyseventeen/functions.php b/wp-content/themes/twentyseventeen/functions.php index a8f10773f9..4ae518db11 100644 --- a/wp-content/themes/twentyseventeen/functions.php +++ b/wp-content/themes/twentyseventeen/functions.php @@ -294,8 +294,9 @@ function twentyseventeen_fonts_url() { $font_families[] = 'Libre Franklin:300,300i,400,400i,600,600i,800,800i'; $query_args = array( - 'family' => urlencode( implode( '|', $font_families ) ), - 'subset' => urlencode( 'latin,latin-ext' ), + 'family' => urlencode( implode( '|', $font_families ) ), + 'subset' => urlencode( 'latin,latin-ext' ), + 'display' => urlencode( 'fallback' ), ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); diff --git a/wp-content/themes/twentysixteen/functions.php b/wp-content/themes/twentysixteen/functions.php index 68e4a5ef03..4b383b2e12 100644 --- a/wp-content/themes/twentysixteen/functions.php +++ b/wp-content/themes/twentysixteen/functions.php @@ -331,8 +331,9 @@ if ( ! function_exists( 'twentysixteen_fonts_url' ) ) : if ( $fonts ) { $fonts_url = add_query_arg( array( - 'family' => urlencode( implode( '|', $fonts ) ), - 'subset' => urlencode( $subsets ), + 'family' => urlencode( implode( '|', $fonts ) ), + 'subset' => urlencode( $subsets ), + 'display' => urlencode( 'fallback' ), ), 'https://fonts.googleapis.com/css' ); diff --git a/wp-content/themes/twentythirteen/functions.php b/wp-content/themes/twentythirteen/functions.php index 5c021fbe3c..f2823fd50e 100644 --- a/wp-content/themes/twentythirteen/functions.php +++ b/wp-content/themes/twentythirteen/functions.php @@ -243,8 +243,9 @@ function twentythirteen_fonts_url() { } $query_args = array( - 'family' => urlencode( implode( '|', $font_families ) ), - 'subset' => urlencode( 'latin,latin-ext' ), + 'family' => urlencode( implode( '|', $font_families ) ), + 'subset' => urlencode( 'latin,latin-ext' ), + 'display' => urlencode( 'fallback' ), ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } diff --git a/wp-content/themes/twentytwelve/functions.php b/wp-content/themes/twentytwelve/functions.php index ad89b2ac72..2a31155990 100644 --- a/wp-content/themes/twentytwelve/functions.php +++ b/wp-content/themes/twentytwelve/functions.php @@ -165,8 +165,9 @@ function twentytwelve_get_font_url() { } $query_args = array( - 'family' => 'Open+Sans:400italic,700italic,400,700', - 'subset' => $subsets, + 'family' => urlencode( 'Open+Sans:400italic,700italic,400,700' ), + 'subset' => urlencode( $subsets ), + 'display' => urlencode( 'fallback' ), ); $font_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index e405de68ac..a9f78370d9 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -1919,7 +1919,7 @@ function wp_default_styles( &$styles ) { } // Hotlink Open Sans, for now - $open_sans_font_url = "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets"; + $open_sans_font_url = "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets&display=fallback"; } // Register a stylesheet for the selected admin color scheme. diff --git a/wp-includes/version.php b/wp-includes/version.php index dfd43902a9..49b5cd31da 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-45484'; +$wp_version = '5.3-alpha-45485'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.