google / fonts

Font files available from Google Fonts, and a public issue tracker for all things Google Fonts
https://fonts.google.com
18.2k stars 2.61k forks source link

[Request] allow "get everything" option on /css2 #2321

Open Kilian opened 4 years ago

Kilian commented 4 years ago

Hi. I'm developing a live CSS browser feature (video) where people can use any Google Font in their CSS and I dynamically load the font for them. I would like to move to the /css2 api and provide support for variable fonts, but I'm encountering issues.

If I request just the font, I don't think I get enough (e.g. https://fonts.googleapis.com/css2?family=Changa&display=swap) so, I want to request the full range of options. Theoretically I should be able to get this with :ital,wght@0,100..900;1,100..900, but for Changa for example that range is invalid (Changa only has 200..800) and this results in an error page.

Rather than getting an error page back, I'd like to get back just everything that's available. Either by default where the API endpoint is more forgiving, or with an additional query param.

davelab6 commented 4 years ago

Since the list of variable fonts in our API is short and doesn't change often, having your own manifest scraped from the table at https://developers.google.com/fonts/docs/css2#list_of_variable_fonts might work for now

ayuhito commented 4 years ago

Since the list of variable fonts in our API is short and doesn't change often, having your own manifest scraped from the table at https://developers.google.com/fonts/docs/css2#list_of_variable_fonts might work for now

@davelab6, unfortunately, this is an unreliable solution considering that table isn't updated. There are only 40 variable fonts listed there whilst there are currently have 53 live in production. Do you have any other solutions or possible things in the works to address a valid endpoint to pull data about variable fonts from?

Reference for fontsource/fontsource#30

Kilian commented 4 years ago

Additionally, the table only shows ital and wght, while many variable fonts have more axis.

davelab6 commented 4 years ago

We are working on an update that will auto populate the information, and I'll request a manual update to that docs page now.

Also, the table will only ever show axes defined in https://github.com/google/fonts/tree/master/axisregistry

Kilian commented 4 years ago

@davelab6 Thanks! Check your Twitter DM for a list of missing fonts in that table :)

ayuhito commented 3 years ago

Loving #2655 as a great page to scrape for all the relevant information. However, since that is the only way for us to pull such information, it can be a tad frustrating for us if they are tinkering with the design of the table and breaking entire build chains dependent on this as a result of their changes. Perhaps it would be encouraged for them to not introduce breaking changes to the design?

(Just recently, instead of adjusting the padding around some of the values like family name and default, min, max, etc, they added spaces " " on each side. That's a little bit weird and unnecessary when they could have quite possibly used CSS padding as an alternative, considering it breaks scrapers built specifically for that table)

Are we expecting an actual API endpoint for variable font data in the near future for the sake of stability?