How can I download WOFF files from Google Fonts?

92,677

Solution 1

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 http://google-webfonts-helper.herokuapp.com to download the font files and host them yourselves.

Solution 2

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.

Solution 3

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

Solution 4

You can use everythingfonts.com to convert the ttf file to a woff file.

Share:
92,677
cantsay
Author by

cantsay

Updated on July 05, 2022

Comments

  • cantsay
    cantsay almost 2 years

    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?

  • vers
    vers over 7 years
    Unfortunately localfont doesn't download all charsets of the font. It includes only the Latin charset. google-webfonts-helper would be better tool for this.
  • halfer
    halfer almost 7 years
    I'm accessing that in Firefox, and the fonts are in woff2 format. Maybe the situation for FF has changed?
  • amwinter
    amwinter almost 7 years
    I tried this in safari just now and got 'woff' vs 'woff2' for chrome -- seems to be working. @halfer my firefox supports woff2.
  • Alan B
    Alan B almost 7 years
    localfont.com appears to be dead as of July 2017.
  • Adam Reis
    Adam Reis over 6 years
    localfont.com is dead, but this alternative works well: google-webfonts-helper.herokuapp.com
  • folktrash
    folktrash over 6 years
    @AlexeyMitev - you should submit google-webfonts-helper.herokuapp.com as an answer.
  • vers
    vers over 6 years
    @folktrash - I should have but it is too late. The question is closed now.
  • Greg Blass
    Greg Blass about 6 years
    I just used Chrome developer tools and set my user agent to an iPhone 5s, and I was served up a woff file.
  • Greg
    Greg about 6 years
    Oh the google-webfonts-helper is sooo good :) Thanks for sharing this. It saved me a lot of work!
  • V. Rubinetti
    V. Rubinetti almost 6 years
    This is a handy shortcut. Wish google would add format options to the downloads. Another work-around, since I don't see it mentioned anywhere else on this question, is to download the .ttf from Google, and upload it to Font Squirrel's webfont generator: fontsquirrel.com/tools/webfont-generator which will convert your font to whichever web format you need.
  • Baldur
    Baldur over 4 years
    Any idea why the fonts served by the Google CDN are so much smaller than if I download them directly using google-webfonts-helper? For example the Latin woff2 version of Open Sans is about 9kb from the CDN but 15kb downloaded. I've tried using a tool to filter the unicode ranges defined in the css file but I only managed to get it down to 14kb.
  • udondan
    udondan over 4 years
    I don't know, maybe it's just gzipped?