Directory

GitHub - WordPress/google-fonts-to-wordpress-collection: Gets the Google fonts collection and transform it to a WordPress font library collection, including SVG previews
Skip to content

Gets the Google fonts collection and transform it to a WordPress font library collection, including SVG previews

Notifications You must be signed in to change notification settings

WordPress/google-fonts-to-wordpress-collection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Fonts collection to WordPress Font Library collection

This is a prototype repo to test some ideas for font preview generation for the new WordPress Font Library.

What?

The code on this repo:

  • Gets a copy of the list of fonts provided by Google Fonts API.
  • Transform the list provided by Google Fonts API in a WordPress theme.json like format to be compatible with the new WordPress Font Library collections.
  • Downloads each one of the font assets for the 1500+ families available.
  • Uses the font face downloaded assets to generate SVG format images with the font previews.
  • Generates a new JSON file, including the preview images link.

Instructions

Install the NPM dependencies:

npm install

  • Gets a copy of the list of fonts provided by Google Fonts API.
  • Transform the list provided by Google Fonts API in a WordPress theme.json like format to be compatible with the new WordPress Font Library collections.
GOOGLE_FONTS_API_KEY=abc123 npm run api

  • Iterates over the list of font families and for each one:
  • Downloads the font family assets.
  • Uses the font face downloaded assets to generate SVG format images with the font previews.
  • Generates a new JSON file, including the preview images link.
npm run previews

Extra utilities:

Download all the font files

  • Downloads each one of the font assets for the 1500+ families available.
npm run files

Requierements

  • NodeJS 18+
  • A Google Fonts API key

About

Gets the Google fonts collection and transform it to a WordPress font library collection, including SVG previews

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published