← All changes
|
modules/google-fonts/current/class-jetpack-google-font-face.php
+6
-5
16.3-a.5
→
16.3-a.1
View file →
| @@ -73,9 +73,9 @@ | ||
| 73 | 73 | $fonts_in_use = array_map( |
| 74 | 74 | function ( $font_slug ) use ( $font_slug_aliases ) { |
| 75 | 75 | return $font_slug_aliases[ $font_slug ] ?? $font_slug; |
| 76 | 76 | }, |
| 77 | - $fonts_in_use | |
| 77 | + $this->fonts_in_use | |
| 78 | 78 | ); |
| 79 | 79 | |
| 80 | 80 | foreach ( $fonts as $font_faces ) { |
| 81 | 81 | $font_family = $font_faces[0]['font-family'] ?? ''; |
| @@ -222,10 +222,11 @@ | ||
| 222 | 222 | if ( ! is_string( $font_family ) ) { |
| 223 | 223 | return null; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - // A preset reference can include a var() fallback and a trailing font stack. | |
| 227 | - preg_match( '/^\s*var\(\s*--wp--preset--font-family--(?P<slug>[^\s,()]+)\s*[,)]/', $font_family, $matches ); | |
| 226 | + // Full string: var(--wp--preset--font-family--slug). | |
| 227 | + // We do not care about the origin of the font, only its slug. | |
| 228 | + preg_match( '/font-family--(?P<slug>.+)\)$/', $font_family, $matches ); | |
| 228 | 229 | |
| 229 | 230 | if ( isset( $matches['slug'] ) ) { |
| 230 | 231 | return $matches['slug']; |
| 231 | 232 | } |
| @@ -231,15 +232,15 @@ | ||
| 231 | 232 | } |
| 232 | 233 | |
| 233 | 234 | // Full string: var:preset|font-family|slug |
| 234 | 235 | // We do not care about the origin of the font, only its slug. |
| 235 | - preg_match( '/^\s*var:preset\|font-family\|(?P<slug>[^\s,]+)/', $font_family, $matches ); | |
| 236 | + preg_match( '/font-family\|(?P<slug>.+)$/', $font_family, $matches ); | |
| 236 | 237 | |
| 237 | 238 | if ( isset( $matches['slug'] ) ) { |
| 238 | 239 | return $matches['slug']; |
| 239 | 240 | } |
| 240 | 241 | |
| 241 | - return self::get_font_family_name( $setting['typography'] ); | |
| 242 | + return $font_family; | |
| 242 | 243 | } |
| 243 | 244 | |
| 244 | 245 | /** |
| 245 | 246 | * Check if the current screen is the block editor. |