← All changes
|
modules/google-fonts/current/class-jetpack-google-font-face.php
+5
-6
16.2
→
16.3-a.7
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 | - $this->fonts_in_use | |
| 77 | + $fonts_in_use | |
| 78 | 78 | ); |
| 79 | 79 | |
| 80 | 80 | foreach ( $fonts as $font_faces ) { |
| 81 | 81 | $font_family = $font_faces[0]['font-family'] ?? ''; |
| @@ -222,11 +222,10 @@ | ||
| 222 | 222 | if ( ! is_string( $font_family ) ) { |
| 223 | 223 | return null; |
| 224 | 224 | } |
| 225 | 225 | |
| 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 ); | |
| 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 ); | |
| 229 | 228 | |
| 230 | 229 | if ( isset( $matches['slug'] ) ) { |
| 231 | 230 | return $matches['slug']; |
| 232 | 231 | } |
| @@ -232,15 +231,15 @@ | ||
| 232 | 231 | } |
| 233 | 232 | |
| 234 | 233 | // Full string: var:preset|font-family|slug |
| 235 | 234 | // We do not care about the origin of the font, only its slug. |
| 236 | - preg_match( '/font-family\|(?P<slug>.+)$/', $font_family, $matches ); | |
| 235 | + preg_match( '/^\s*var:preset\|font-family\|(?P<slug>[^\s,]+)/', $font_family, $matches ); | |
| 237 | 236 | |
| 238 | 237 | if ( isset( $matches['slug'] ) ) { |
| 239 | 238 | return $matches['slug']; |
| 240 | 239 | } |
| 241 | 240 | |
| 242 | - return $font_family; | |
| 241 | + return self::get_font_family_name( $setting['typography'] ); | |
| 243 | 242 | } |
| 244 | 243 | |
| 245 | 244 | /** |
| 246 | 245 | * Check if the current screen is the block editor. |