-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Downloads TTF files instead of WOFF/WOFF2 #1
Comments
An alternative approach would be using the |
Yes this really should use the |
Even better 👍 |
This option seems to be new in the Google Fonts API. It didn't exist (or at least I didn't notice it) a few months ago while creating this repo. Good to know that now we have this option available. I think switching from ttf to woff2 should be simple now. |
Oh it's definitely new... that's why I initially suggested using the user-agent, we've been using that method for years 'cause until recently there was no other way to do it 😅 |
This was brought up in the Gutenberg repo (see WordPress/gutenberg#55049 and WordPress/gutenberg#57706), as well as WP's Slack.
Currently we're downloading
.ttf
files which are quite large and don't support all features that modern font-families have.We should instead download
.woff
files, or - ideally -.woff2
.We should be able to do that by passing a user-agent in the
fetch
call ongoogle-fonts-to-wordpress-collection/src/get_google_fonts.js
Line 80 in abe0da8
User-agents we can use:
If we want to get
woff
files, then the one below is the recommended user-agent since it's the only one that also supports unicode-rangesIf we want to get
woff2
files, then this one will do:cc @matiasbenedetto
The text was updated successfully, but these errors were encountered: