Moving from Google Fonts v1 to v2

Viewed 124

I'm trying to update code from google fonts V1 to V2: https://developers.google.com/fonts/docs/css2 most of the implementation has been done and altering of the previous V1 URLs have taken place so they reflect the V2 changes.

Users in the application are given a dropdown where they can choose the font they'd like to use for display on their website. The names of the google fonts available for use are pulled from the google fonts api: https://www.googleapis.com/webfonts/v1/webfonts?key=<api_key>, so when users select the font they'd like to use, we enqueue that font on the frontend.

My questions are:

  1. How do we know that a font pulled from https://www.googleapis.com/webfonts/v1/webfonts is compatible with Google fonts V2? https://fonts.googleapis.com/css2

I took another look at the JSON returned and there doesn't seem to be any obvious key that says that the font will work.

  1. If all fonts returned from the API will work when loaded with https://fonts.googleapis.com/css2 then what should I look out for? How would I know if a font is a variable font or not if I'm pulling all available google fonts from https://www.googleapis.com/webfonts/v1/webfonts ?

Am I misunderstanding something about variable fonts and the Google fonts v2?

0 Answers
Related