Make WordPress Core

Opened 7 months ago

Last modified 16 hours 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: Future Release Priority: normal
Severity: normal Version: 6.5
Component: Editor Keywords: needs-patch
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 (15)

#1 @swissspidy
7 months ago

  • Component changed from Media to Editor

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


7 months ago

#3 @jorbin
6 months 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 months ago

#5 @youknowriad
6 months 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
6 months 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
6 months ago

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

#8 @grantmkin
6 months 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.

#9 @oglekler
4 months ago

  • Keywords needs-patch added

We're about 2 weeks until Beta 1 and it is unlikely this can be dealt with unless a solution already exists. Most likely, this is already a candidate to go to 6.7.

@grantmkin could you please clearly that this issue needs to be addressed in the Core and not in the Gutenberg first. Thank you!

#10 @grantmkin
4 months ago

@grantmkin could you please clearly that this issue needs to be addressed in the Core and not in the Gutenberg first. Thank you!

I think this will require changes to both server and client code:

  • The font-faces REST API endpoint, to enable updating existing font faces (usually changed in Gutenberg plugin first, then backported to wordpress-develop)
  • The font library JS code, to check if a font face already exists before a font file is uploaded and create or update the font face, as needed (all in Gutenberg repo)

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


4 months ago

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


4 months ago

#13 @audrasjb
4 months ago

  • Milestone changed from 6.6 to 6.7

Moving this enhancement to milestone 6.7 as there is still no patch available for review and beta 1 is tomorrow.

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


4 days ago

#15 @chaion07
16 hours ago

  • Milestone changed from 6.7 to Future Release

Thanks @jdy68 for reporting this. We reviewed this Ticket during a recent bug-scrub session. Here's the summary of the feedback received:

  1. There hasn't been much progress for some time
  2. Peter suggested that it will need some JavaScript changes in the Gutenberg repository referring to Grant's most recent comment.
  3. Since there isn't any plans for Font Library changes in this release, we are opting to update the milestone to Future Release to which Robert agreed.

Props to @peterwilsoncc, @grantmkin and @noisysocks

Cheers!

Note: See TracTickets for help on using tickets.