Make WordPress Core

Opened 22 months ago

Closed 22 months ago

Last modified 15 months ago

#62258 closed task (blessed) (fixed)

Update Google Fonts collection

Reported by: mmaattiiaass Owned by: peterwilsoncc
Priority: normal Milestone: 6.7
Component: Editor Version:
Severity: normal Keywords: has-patch has-test-info commit dev-reviewed
Cc: Focuses: css

Description

The current Google fonts collection data is not up-to-date with the latest additions to the list of available fonts and the latest version of the existing ones.

It should be updated for 6.7

A related issue reported in Gutenberg: https://github.com/WordPress/gutenberg/issues/64685

Change History (15)

#1 @dilip2615
22 months ago

  • Focuses css added
  • Keywords needs-testing needs-testing-info 2nd-opinion added

To update the Google Fonts collection for WordPress 6.7, fetch the latest fonts data from the Google Fonts API. Replace the existing JSON file or fonts data in your project with the new version. For example, if you're updating Gutenberg, modify the font-loading mechanism to use the new data, then test to ensure new fonts are available. Finally, clear cache and verify functionality.

Fetch Latest Google Fonts: Use the API to get the updated fonts list:

$api_key = 'YOUR_API_KEY';
$url = "https://www.googleapis.com/webfonts/v1/webfonts?key=$api_key";
$response = wp_remote_get($url);
$body = wp_remote_retrieve_body($response);
$fonts_data = json_decode($body, true);

Replace Existing Fonts: Update your local JSON file or replace the existing font array in your project:

file_put_contents('path/to/fonts.json', json_encode($fonts_data));

Update Frontend: Update the font loading in your theme or plugin, e.g., enqueue the latest fonts:

Update Frontend: Update the font loading in your theme or plugin, e.g., enqueue the latest fonts:

#2 follow-up: @mmaattiiaass
22 months ago

@dilip2615 those instructions doesn't seem to be correct.

To try the updated version of the Google Fonts collection you can follow the steps outline in the "How to test?" section of this PR: https://github.com/WordPress/google-fonts-to-wordpress-collection/pull/38

#3 in reply to: ↑ 2 @dilip2615
22 months ago

Replying to mmaattiiaass:

Extremely Sorry for that Yes I know it's a old version example just I am sharing with you a example here.

Last edited 22 months ago by dilip2615 (previous) (diff)

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


22 months ago
#4

  • Keywords has-patch added

## What?
The current Google font collection data is not up-to-date, with the latest additions to the list of available fonts and the latest versions of the existing ones. This PR updates the URL of the new file hosted on the WordPress.org CDN https://meta.trac.wordpress.org/ticket/7808 (pending).

## Why?
To update the Google fonts collection data with the latest fonts and versions of those fonts.

## Trac
Trac ticket: https://core.trac.wordpress.org/ticket/62258

---
These are some links for reference only.

Issues:
https://github.com/WordPress/gutenberg/issues/64685
https://github.com/WordPress/google-fonts-to-wordpress-collection/issues/34
https://core.trac.wordpress.org/ticket/62258
https://meta.trac.wordpress.org/ticket/7808

Data updates:
https://github.com/WordPress/google-fonts-to-wordpress-collection/pull/38
https://github.com/WordPress/google-fonts-to-wordpress-collection/pull/40

#5 @peterwilsoncc
22 months ago

  • Component GeneralEditor
  • Milestone Awaiting Review6.7
  • Type defect (bug)task (blessed)
  • Version trunk

Blocked pending the completion of #meta7808.

I've converted this to a task for inclusion during the RC phase of the release.

#6 @mmaattiiaass
22 months ago

https://meta.trac.wordpress.org/ticket/7808 has been completed, so this task is unblocked now.

Last edited 22 months ago by mmaattiiaass (previous) (diff)

#7 @peterwilsoncc
22 months ago

  • Keywords has-testing-info commit added; needs-testing needs-testing-info 2nd-opinion removed
  • Owner set to peterwilsoncc
  • Status newassigned

Test Report

This report validates that the indicated patch addresses the issue.

Patch tested: https://github.com/WordPress/wordpress-develop/pull/7603

Environment

  • OS: macOS 14.7
  • Web Server: Nginx
  • PHP: 8.1.30
  • WordPress: 6.8-alpha-59274-src
  • Browser: Firefox
  • Theme: Twenty Twenty-Five

Actual Results

  • ✅ Issue resolved with patch.

Additional Notes

#8 @peterwilsoncc
22 months ago

  • Resolutionfixed
  • Status assignedclosed

In 59286:

Editor: Update Google Fonts API endpoint for WordPress 6.7.

Updates the Google Fonts API to use the URL https://s.w.org/images/fonts/wp-6.7/collections/google-fonts-with-preview.json with an updated collection of fonts available for install.

Props dilip2615, mmaattiiaass, wildworks, dd32.
Fixes #62258.

#10 @peterwilsoncc
22 months ago

  • Keywords dev-feedback added
  • Resolution fixed
  • Status closedreopened

Reopening for backport consideration to the 6.7 branch, pending approval from another core committer.

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


22 months ago

#12 @swissspidy
22 months ago

  • Keywords dev-reviewed added; dev-feedback removed

#13 @peterwilsoncc
22 months ago

  • Resolutionfixed
  • Status reopenedclosed

In 59295:

Editor: Update Google Fonts API endpoint for WordPress 6.7.

Updates the Google Fonts API to use the URL https://s.w.org/images/fonts/wp-6.7/collections/google-fonts-with-preview.json with an updated collection of fonts available for install.

Reviewed by swissspidy.
Merges [59286] to the 6.7 branch.

Props dilip2615, mmaattiiaass, wildworks, dd32.
Fixes #62258.

@Bernhard Reiter commented on PR #7603:


21 months ago
#14

Thanks a lot for taking care of this, @matiasbenedetto and @peterwilsoncc!

#15 @wordpressdotorg
15 months ago

  • Keywords has-test-info added; has-testing-info removed
Note: See TracTickets for help on using tickets.