Make WordPress Core

Opened 17 months ago

Closed 15 months ago

Last modified 15 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
17 months 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.


17 months ago

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


17 months 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

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


17 months ago

#6 @hellofromTonya
16 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 16 months ago by hellofromTonya (previous) (diff)

#7 @hellofromTonya
16 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 16 months ago by hellofromTonya (previous) (diff)

#8 @aristath
16 months ago

  • Keywords commit added

#9 @aristath
16 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
15 months ago

  • Status changed from assigned to reviewing

Preparing commit now.

#11 @hellofromTonya
15 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
15 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:


15 months ago
#13

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

#14 @hellofromTonya
15 months ago

  • Version changed from trunk to 6.0

[53282] was introduced in 6.0.0.

Note: See TracTickets for help on using tickets.