Skip to content
Draft
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
201d1cf
fix:build-font-face-css single inverted comma in name issue
iamsandeepdahiya Jun 15, 2025
08ad65b
removed whitespace from the end
iamsandeepdahiya Jun 15, 2025
f09ea75
using WP_Font_Utils::maybe_add_quotes() after exposing it public
iamsandeepdahiya Jun 16, 2025
9f29537
renamed to normalize_quoted_font_family_name and added more edge cases
iamsandeepdahiya Jun 17, 2025
b88e32c
"Reverting to previous minor fix"
iamsandeepdahiya Jun 17, 2025
044e261
removed whitespace and renamed to normalize_css_font_family_name
iamsandeepdahiya Jun 17, 2025
927af12
Merge remote-tracking branch 'iamsandeepdahiya/build-font-face-css' i…
sirreal Sep 11, 2025
58fffca
Revert normalize font face changes
sirreal Sep 18, 2025
98fd99f
Add normalize_css_font_face utility
sirreal Sep 18, 2025
93c7284
Use normalize_css_font_face
sirreal Sep 18, 2025
f99a644
Update tests for quoted font family name
sirreal Sep 18, 2025
a74fd98
Add specific tests for ' character
sirreal Sep 18, 2025
245075f
Use font_family name
sirreal Sep 19, 2025
b4fbd16
Add normalization-specific tests
sirreal Sep 19, 2025
31a0dee
Escape `<` too for good measure
sirreal Sep 19, 2025
d2d2f1c
Remove normalization of quoted strings
sirreal Sep 19, 2025
a61fa4e
Fix typos, language, comment alignment
sirreal Sep 19, 2025
96a3293
Improve doint it wrong message
sirreal Sep 19, 2025
95a9d84
Document unusual escapes in font family name
sirreal Nov 4, 2025
93fbf89
Merge branch 'trunk' into fix/font-face-name-normalization
sirreal Nov 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add specific tests for ' character
  • Loading branch information
sirreal committed Sep 18, 2025
commit a74fd985adbf46c42ebb384e76a32e6cad7cdd08
87 changes: 83 additions & 4 deletions tests/phpunit/tests/fonts/font-face/wp-font-face-tests-dataset.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ trait WP_Font_Face_Tests_Datasets {
*/
public function data_should_print_given_fonts() {
return array(
'single truetype format font' => array(
'single truetype format font' => array(
'fonts' => array(
'Inter' =>
array(
Expand All @@ -38,7 +38,7 @@ public function data_should_print_given_fonts() {
CSS
,
),
'multiple truetype format fonts' => array(
'multiple truetype format fonts' => array(
'fonts' => array(
'Inter' =>
array(
Expand Down Expand Up @@ -70,7 +70,7 @@ public function data_should_print_given_fonts() {
CSS
,
),
'single woff2 format font' => array(
'single woff2 format font' => array(
'fonts' => array(
'DM Sans' =>
array(
Expand All @@ -91,7 +91,7 @@ public function data_should_print_given_fonts() {
CSS
,
),
'multiple woff2 format fonts' => array(
'multiple woff2 format fonts' => array(
'fonts' => array(
'DM Sans' =>
array(
Expand Down Expand Up @@ -235,6 +235,85 @@ public function data_should_print_given_fonts() {
@font-face{font-family:"Piazzolla";font-style:normal;font-weight:400;font-display:fallback;src:url('https://example.org/fonts/piazzolla500.ttf') format('truetype');font-stretch:normal;}
@font-face{font-family:"Lobster";font-style:normal;font-weight:400;font-display:fallback;src:url('https://example.org/fonts/lobster400.ttf') format('truetype');font-stretch:normal;}
@font-face{font-family:"Lobster";font-style:normal;font-weight:500;font-display:fallback;src:url('https://example.org/fonts/lobster500.ttf') format('truetype');font-stretch:normal;}
CSS
,
),
),

"Fonts with `'` character (ticket #63568)" => array(
'fonts' => array(
"O'Reilly Sans" =>
array(
array(
'src' =>
array(
'https://example.org/assets/fonts/oreilly-sans/oreilly-sans.woff2',
),
'font-family' => "O'Reilly Sans",
'font-stretch' => 'normal',
'font-style' => 'normal',
'font-weight' => '400',
),
),
"Suisse BP Int'l" =>
array(
array(
'src' =>
array(
'https://example.org/assets/fonts/suisse-bp-intl/suisse-bp-intl.woff2',
),
'font-family' => "Suisse BP Int'l",
'font-stretch' => 'normal',
'font-style' => 'normal',
'font-weight' => '400',
),
),
),
'expected' => <<<CSS
@font-face{font-family:"O'Reilly Sans";font-style:normal;font-weight:400;font-display:fallback;src:url('https://example.org/assets/fonts/oreilly-sans/oreilly-sans.woff2') format('woff2');font-stretch:normal;}
@font-face{font-family:"Suisse BP Int'l";font-style:normal;font-weight:400;font-display:fallback;src:url('https://example.org/assets/fonts/suisse-bp-intl/suisse-bp-intl.woff2') format('woff2');font-stretch:normal;}
CSS
,
'indexed array as input' => array(
'fonts' => array(
array(
array(
'font-family' => 'Piazzolla',
'src' => array( 'https://example.org/fonts/piazzolla400.ttf' ),
'font-style' => 'normal',
'font-weight' => '400',
'font-stretch' => 'normal',
),
array(
'font-family' => 'Piazzolla',
'src' => array( 'https://example.org/fonts/piazzolla500.ttf' ),
'font-style' => 'normal',
'font-weight' => '400',
'font-stretch' => 'normal',
),
),
array(
array(
'font-family' => 'Lobster',
'src' => array( 'https://example.org/fonts/lobster400.ttf' ),
'font-style' => 'normal',
'font-weight' => '400',
'font-stretch' => 'normal',
),
array(
'font-family' => 'Lobster',
'src' => array( 'https://example.org/fonts/lobster500.ttf' ),
'font-style' => 'normal',
'font-weight' => '500',
'font-stretch' => 'normal',
),
),
),
'expected' => <<<CSS
@font-face{font-family:"Piazzolla";font-style:normal;font-weight:400;font-display:fallback;src:url('https://example.org/fonts/piazzolla400.ttf') format('truetype');font-stretch:normal;}
@font-face{font-family:"Piazzolla";font-style:normal;font-weight:400;font-display:fallback;src:url('https://example.org/fonts/piazzolla500.ttf') format('truetype');font-stretch:normal;}
@font-face{font-family:"Lobster";font-style:normal;font-weight:400;font-display:fallback;src:url('https://example.org/fonts/lobster400.ttf') format('truetype');font-stretch:normal;}
@font-face{font-family:"Lobster";font-style:normal;font-weight:500;font-display:fallback;src:url('https://example.org/fonts/lobster500.ttf') format('truetype');font-stretch:normal;}
CSS
,
),
Expand Down
Loading