Fonts: Quote axis tags when compiling an array font-variation-settings - #13514
Jiwoon-Kim wants to merge 1 commit into
Conversation
…y font-variation-settings. WP_Font_Face::compile_variations() joined each axis as "$key $value" with no separator and no quotes, so an array such as array( 'wght' => 400, 'GRAD' => 0 ) produced the invalid declaration font-variation-settings:wght 400GRAD 0;. It now produces "wght" 400, "GRAD" 0. Adds data provider cases for the string and array forms. See #66103.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Test reportTested against a fresh Method: applied only the new dataset-case hunk to unpatched trunk first (source untouched) to confirm the array-form case reproduces the bug, then applied the source fix on top and re-ran, then ran Results:
The diff also applied cleanly ( Visual check: also rendered the real compiled CSS through a live variable font (Inter, No regressions found in |
WP_Font_Face::compile_variations()turned an arrayfont-variation-settingsintowght 400GRAD 0: no quotes around the axis tags and no commas between the axes, so browsers drop the declaration. It now prints"wght" 400, "GRAD" 0.The string form, which theme.json documents, is passed through unchanged and is not affected.
Tests: two cases in the
WP_Font_Facedataset, one for the string form and one for the array form. Before the fix the array case fails withfont-variation-settings:slnt 0wght 400;; after it,phpunit --group fontspasses (232 tests, 930 assertions), andphpcsreports nothing on the two changed files.Trac ticket: https://core.trac.wordpress.org/ticket/66103
Use of AI Tools
This pull request was prepared with Claude Code (Anthropic). It located the defect, wrote the fix and test cases, and ran the tests and coding standards checks locally in the
wordpress-developDocker environment.