Make WordPress Core

Opened 8 weeks ago

Last modified 4 weeks ago

#60654 new enhancement

Install several formats of the same font one by one is not possible

Reported by: jdy68's profile jdy68 Owned by:
Milestone: 6.6 Priority: normal
Severity: normal Version: 6.5
Component: Editor Keywords:
Focuses: Cc:

Description

Bug Report

Description

It's not possible to install multiple formats of the same font by installing one format at a time, but it works if you select different formats for the same upload.

Environment

  • WordPress: 6.5-beta3
  • PHP: 8.1.15
  • Server: Apache/2.4.54 (Win64) OpenSSL/1.1.1q mod_fcgid/2.3.10-dev
  • Database: mysqli (Server: 8.0.30 / Client: mysqlnd 8.1.15)
  • Browser: Chrome 122.0.0.0 (Windows 10/11)
  • Theme: Twenty Twenty-Four 1.0
  • MU-Plugins: None activated
  • Plugins:
    • WordPress Beta Tester 3.5.5
    • Debug Log Manager 2.3.1

Steps to Reproduce

  1. Go to Apparence > Editor > Styles.
  2. Click on Edit styles button then Typography (in settings sidebar).
  3. Click on Manage fonts button then Upload.
  4. Click on Upload font and select the font on your computer. Choose a font for which several formats are available (ttf, woff, woff2) and select only one format, e.g. ttf.
  5. The font is uploaded and installed.
  6. Then click again on Upload font and select another format for the same font, e.g. woff.
  7. 🐞 The following error message is displayed: "No font faces were installed. Fetch error: A font face matching those settings already exists." But if you upload several formats (ttf, woff and woff2) of the same font at once, then all 3 files are imported and the font is installed 3 times.

Expected Results

  1. ✅ It should be possible to install different formats of the same font, at once or in several times.

Actual Results

  1. ❌ When uploading different formats of the same font at once, all files are uploaded and installed, with no error message. But if you've already uploaded a format for a font (e.g. ttf), you can't upload the font in another format (such as woff or woff2), and an error message is displayed.

Change History (8)

#1 @swissspidy
8 weeks ago

  • Component changed from Media to Editor

This ticket was mentioned in Slack in #core by jdy68. View the logs.


7 weeks ago

#3 @jorbin
6 weeks ago

  • Milestone changed from Awaiting Review to 6.5

Moving to 6.5 for visibility

This ticket was mentioned in Slack in #core-editor by swissspidy. View the logs.


6 weeks ago

#5 @youknowriad
6 weeks ago

Agree this would be a great addition. That said, depending on the complexity of the task, I think this can be moved to 6.6 (since we're a bit late in the release cycle).

cc @mmaattiiaass for more insights

#6 @mikachan
5 weeks ago

To address this, font faces need to be editable and there is currently no API to handle that. I believe this isn't simple or quick to fix, so I agree that this should be moved to 6.6.

#7 @swissspidy
5 weeks ago

  • Milestone changed from 6.5 to 6.6
  • Type changed from defect (bug) to enhancement

#8 @grantmkin
4 weeks ago

To address this, font faces need to be editable and there is currently no API to handle that.

There's some nuance (and potential complexity) to adding an update endpoint for font-faces, which is why this hasn't been implemented yet.

For an update endpoint, my assumption would be that whatever is provided in the src property as the urls to the font files would replace the existing values, and any previous font files not present in the updated src array would be deleted.

This means that to upload an additional format for an existing font face, we'd need to parse the font file for the family, check to see if a font face with the same values already exists for the family, and if so, fetch the current src values. Then we could append the new format to the src and upload it.

Note: See TracTickets for help on using tickets.