Skip to content

Fonts: Normalize CSS font face font-family name on font upload.#11193

Draft
sirreal wants to merge 6 commits intoWordPress:trunkfrom
sirreal:trac-63568/font-face-font-family-upload-nmae
Draft

Fonts: Normalize CSS font face font-family name on font upload.#11193
sirreal wants to merge 6 commits intoWordPress:trunkfrom
sirreal:trac-63568/font-face-font-family-upload-nmae

Conversation

@sirreal
Copy link
Member

@sirreal sirreal commented Mar 6, 2026

I attempted to use a CSS font family on upload, but that results in broken display: WordPress/gutenberg#76253

Trac ticket: https://core.trac.wordpress.org/ticket/63568

Use of AI Tools

None.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

'context' => array( 'view', 'edit', 'embed' ),
'properties' => array(
'fontFamily' => array(
'description' => __( 'CSS font-family value.' ),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description is wrong, or at least is isn't what the Gutenberg client is sending.

In WordPress/gutenberg#76253 I sent over a real CSS value, and that resulted in the readable font name including CSS escapes.

Either way, it seems best to do this on the server.

The actual data that should be sent here is a plain string, not CSS. For example:

  • My Font Name is an appropriate string to send
  • 🚫 "My Font\20 Name" is a CSS string - do not send this!

@sirreal
Copy link
Member Author

sirreal commented Mar 6, 2026

Alternative to #9951

@@ -344,7 +344,7 @@ public function get_item_schema() {
'description' => __( 'CSS font-family value.' ),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant