Reputation: 2046
Google Fonts seems to only offer fonts in WOFF2.
While this works fine with Chrome, WOFF2 doesn't seem to be supported by many other browsers
Is there a way to directly link to Google fonts hosted on their CDN in a format other than WOFF2?
Upvotes: 90
Views: 171833
Reputation: 60059
Unfortunately Google does not offer an easy way to directly download fonts. You can browse the git repository to search for the file you want, though there are only TTF files on GitHub available.
Also, do not directly link to the GitHub hosted fonts in your CSS! GitHub serves the files with the wrong mime type, which causes issues in some browsers.
While there is not a mainstream CDN for all the formats, you can use https://gwfh.mranftl.com/ to download the font files and host them yourselves.
Upvotes: 143
Reputation: 28767
When I open the following URL in Chrome, I get a link to the font in woff2
format. When I use Firefox, it's in woff
format and in an Android device running pre-4.4, it is in ttf
format.
http://fonts.googleapis.com/css?family=Open+Sans
So it appears that Google delivers fonts in a format appropriate to the requesting user-agent.
Upvotes: 36
Reputation: 23592
You can use everythingfonts.com to convert the ttf
file to a woff
file.
Upvotes: 5
Reputation: 6570
Another option is using the following (node) gulp package: gulp-google-webfonts.
Once installed it takes moments to install fonts and create corresponding css.
Note that when installing a Google Font with whitespace in the name, (you don't escape it) reference it with the plus sign as follows:
fonts.list
Cabin+Sketch:400
Upvotes: 8