Make WordPress Core

Opened 2 years ago

Closed 22 months ago

Last modified 22 months ago

#57430 closed defect (bug) (fixed)

Drop "local($font_family)" CSS while registering font-family in webfonts_handler

Reported by: luehrsen's profile luehrsen Owned by: hellofromtonya's profile hellofromTonya
Milestone: 6.2 Priority: normal
Severity: normal Version: 6.0
Component: Themes Keywords: has-patch has-unit-tests commit gutenberg-merge
Focuses: Cc:

Description

As discussed here, loading the local font file can lean to unexpected compatibility issues due to version or locale mismatches of the font.

Vendors like Google have dropped using local in their font delivery.

That is why I would propose dropping the local rule altogether.

Change History (14)

#1 @luehrsen
2 years ago

The PR connection seems to lag a bit, but a patch is ready here:

https://github.com/WordPress/wordpress-develop/pull/3826

This ticket was mentioned in Slack in #themereview by luehrsen. View the logs.


2 years ago

This ticket was mentioned in PR #3826 on WordPress/wordpress-develop by @luehrsen.


2 years ago
#3

  • Keywords has-patch has-unit-tests added

As discussed, loading the local font file can lean to unexpected compatibility issues due to version or locale mismatches of the font.

Vendors like Google have dropped using local in their font delivery.

That is why I would propose dropping the local rule altogether.

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

#4 @luehrsen
2 years ago

This issue seems to be relevant as well:

https://github.com/WordPress/gutenberg/issues/42190

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


2 years ago

#6 @hellofromTonya
23 months ago

  • Milestone changed from Awaiting Review to 6.2
  • Type changed from enhancement to defect (bug)

The new Fonts API being developed in Gutenberg is targeted for inclusion in WP 6.2. If committed, then this Trac ticket can be closed.

Why? The implementation currently in Core is a temporary stopgap. The new API will remove that code.

I'll move this ticket into 6.2 for tracking just in case the API isn't ready by Beta 1.

Last edited 23 months ago by hellofromTonya (previous) (diff)

#7 @hellofromTonya
23 months ago

  • Owner set to hellofromTonya
  • Status changed from new to assigned

The Fonts API being developed and then stabilized in Gutenberg is not ready for 6.2.

@aristath @luehrsen can you take a look at PR 3826 to fix this in the Core's stopgate code? If the patch is ready, Ari please add the commit keyword. Let's get this fixed in 6.2.

Last edited 23 months ago by hellofromTonya (previous) (diff)

#8 @aristath
23 months ago

  • Keywords commit added

#9 @aristath
23 months ago

@aristath @luehrsen can you take a look at PR 3826 to fix this in the Core's stopgate code? If the patch is ready, Ari please add the commit keyword. Let's get this fixed in 6.2.

Patch looks good, commit keyword added 👍

#10 @hellofromTonya
22 months ago

  • Status changed from assigned to reviewing

Preparing commit now.

#11 @hellofromTonya
22 months ago

  • Keywords gutenberg-merge added

Adding the experimental keyword for tracking backports from Gutenberg into Core.

Though the Fonts API has not yet been backported, this same bugfix was done in Gutenberg PR 47254 to resolve the same problem reported in this Trac ticket. Hence, categorizing it as a backport.

#12 @hellofromTonya
22 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 55314:

Themes: Remove local() from @font-face styles in _wp_theme_json_webfonts_handler().

Removes adding local() as a @font-face src within _wp_theme_json_webfonts_handler().

Why?

To fix font incompatibilities when a user has the font-family locally installed on their viewing computer or device. It's unknown if all of the font-face variations specified by theme.json and/or global styles are:

  • installed on the user's computer/device.
  • and in one file or multiple files.

The previous implementation used the src specified when registering the font with the API. That src will likely vary from user computer/device to user computer/device.

To avoid these unknowns which could cause incompatibilities or styling issues, this changeset removes adding local() to the generated font-face CSS styles.

References:

Follow-up to [53282].

Props luehrsen, aristath, ehtmlu, hellofromTonya, wetah.
Fixes #57430.

@hellofromTonya commented on PR #3826:


22 months ago
#13

Committed via https://core.trac.wordpress.org/changeset/55314. Thanks for your contributions!

#14 @hellofromTonya
22 months ago

  • Version changed from trunk to 6.0

[53282] was introduced in 6.0.0.

Note: See TracTickets for help on using tickets.