Include Axes data in API response #777
herrstrietzel
started this conversation in
General
Replies: 1 comment
-
This is an open issue which I'd love to see implemented one day once I finish cleaning up our current API implementation. For the time being though, we do actually have all our metadata used for these projects in public. The variable dataset could be imported into your own projects directly if you need it at this time! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Responding to issue entry "Variable Fonts Support for Custom Packager".
Sure, the open API usage is not the main focus of this project.
I actually came across fontsource by this question on stackoverflow How do I add all the font-faces available for a specific Google Font?(in JS).
In short:
the OP wanted to generate a font selection by dynamically generating google font CSS URLs based on the retrieved API data.
So converting something like this:
https://api.fontsource.org/v1/fonts?family=Open+Sans&variable=true
to a URL like this:
https://fonts.googleapis.com/css2?family=Open+Sans:ital,wdth,wght@0,75..100,300..800;1,75..100,300..800
Obviously, the main purpose of fontsource is to get copies for local usage and you could use the official google developer API ...
But google's API has quite a lot of quirks (not really filtering variable fonts, a pretty stupid structure for listing font weights ... imho rather underwhelming documentation etc.)
So I just think the fontsource API also has the potential to be a more developer friendly alternative to google's API.
Although a full variable font support will certainly require a lot of effort – adding variable font axes data to the API response might be a more simple but yet helpful enhancement for many developers.
Especially, if they need to create something like axis sliders or font selections.
Ideas for variable font support
I've actually tried to build something like a custom google variable font helper. mainly due to the fact the current google fonts UI is pretty useless for retrieving e.g. a complete Roboto Flex including all axes – not to speak about an axes subset.
This approach is admittedly pretty primitive and based on simple JS run on host:
Pretty buggy, the main concept is to "re purpose" the official google output to retrieve customized variable fonts.
Obviously, this approach doesn't care about fixed versions but maybe some concepts might be interesting.
Beta Was this translation helpful? Give feedback.
All reactions