Skip to content

Commit 95a9d84

Browse files
committed
Document unusual escapes in font family name
1 parent 96a3293 commit 95a9d84

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/wp-includes/fonts/class-wp-font-face.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,17 @@ protected function normalize_css_font_family( string $font_family ): string {
421421
/*
422422
* CSS Unicode escaping for problematic characters.
423423
* https://www.w3.org/TR/css-syntax-3/#escaping
424+
*
425+
* These characters are not required by CSS but may be problematic in WordPress:
426+
*
427+
* - "<" is replaced to prevent issues with KSES and other sanitization when
428+
* printing CSS later.
429+
* - "," is replaced to prevent issues where multiple font family names may be
430+
* split, sanitized, and joined on the `,` character (regardless of quoting
431+
* or escaping).
432+
*
433+
* Note that the Unicode escape sequences are used rather than backslash-escaping.
434+
* This also helps to prevent issues with problematic characters.
424435
*/
425436
"\n" => '\\A ',
426437
'\\' => '\\5C ',

0 commit comments

Comments
 (0)