Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 17 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
2 years 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
2 years 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
2 years 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 2 years ago by dilip2615 (previous) (diff)

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


2 years 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
2 years ago

  • Component General → Editor
  • Milestone Awaiting Review → 6.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
2 years ago

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

Last edited 2 years ago by mmaattiiaass (previous) (diff)

#7 @peterwilsoncc
2 years ago

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

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
2 years ago

  • Resolution → fixed
  • Status assigned → closed

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
2 years ago

  • Keywords dev-feedback added
  • Resolution fixed
  • Status closed → reopened

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.


2 years ago

#12 @swissspidy
2 years ago

  • Keywords dev-reviewed added; dev-feedback removed

#13 @peterwilsoncc
2 years ago

  • Resolution → fixed
  • Status reopened → closed

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:


23 months ago
#14

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

#15 @wordpressdotorg
17 months ago

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