Skip to content

Google Fonts: Fix font detection when fallback families are present - #52586

Merged
mreishus merged 2 commits into
trunkfrom
reish20260921/font-corectness
Sep 22, 2026
Merged

mreishus merged 2 commits into
trunkfrom
reish20260921/font-corectness

Conversation

@mreishus

Copy link
Copy Markdown
Contributor

Proposed changes

The google fonts module can leave out a font when its value includes fallbacks. For example:

  • var(--wp--preset--font-family--inter) - Found correctly
  • var(--wp--preset--font-family--inter), sans-serif - Left out because it doesn't end in ).

Fix the regex and add tests. I had Astra do this.

Related product discussion/links

Partially fixes #50180

Does this pull request change what data or activity we track or use?

No

Testing instructions

  1. Enable the Google Fonts module.
  2. Use a theme that registers a bundled font in theme.json.
  3. Set styles.typography.fontFamily to reference that font with a fallback, such as var(--wp--preset--font-family--inter), system-ui, sans-serif.
  4. Load the front end. Check that the page includes an @font-face rule for the selected font.
  5. Remove the fallback families. Check that the font-face rule still appears.
  6. Run the google-font-face PHP test suite.

@mreishus mreishus added the [Status] Needs Review This PR is ready for review. label Sep 21, 2026
@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the reish20260921/font-corectness branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack reish20260921/font-corectness

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [Feature] Google Fonts [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests labels Sep 21, 2026
@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: October 6, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/modules/google-fonts/current/class-jetpack-google-font-face.php 70/83 (84.34%) 84.34% -70 💚

Full summary · PHP report · JS report

@mreishus
mreishus requested a review from a team as a code owner September 21, 2026 22:11
@mreishus

Copy link
Copy Markdown
Contributor Author

Tested on JN site + Beta. Confirmed that @font-face is appearing on 2023 theme with styles:

"typography": {
    "fontFamily": "var(--wp--preset--font-family--inter), system-ui, sans-serif",
    "fontSize": "var(--wp--preset--font-size--medium)",
    "lineHeight": "1.6"
}

set in theme.json

@mreishus
mreishus force-pushed the reish20260921/font-corectness branch from e2090fa to ddec51a Compare September 22, 2026 16:36
@mreishus
mreishus merged commit b1339f3 into trunk Sep 22, 2026
79 checks passed
@mreishus
mreishus deleted the reish20260921/font-corectness branch September 22, 2026 18:17
@github-actions github-actions Bot removed the [Status] Needs Review This PR is ready for review. label Sep 22, 2026
@github-actions github-actions Bot added this to the jetpack/16.3 milestone Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Google Fonts [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Google Fonts (Beta) module disables core wp_print_font_faces() and drops/overrides theme.json fonts on the front end

1 participant