This is a small shell script that allows you to download Google's web fonts to your local file system. Additionally, a CSS file that uses your local copy of the fonts is generated. You may want to use this if you want to avoid requesting resources from 3rd party servers (for example for privacy reasons or because you do not have a connection to the public internet).
To run this script, you will need:
- Bash (>= 4.x)
- getopt, preferrably a version that preserves quoted whitespace and supports long options
- sed, in a version that has extended regex support using either
The script is released under the 2-clause BSD license. The SPDX identifier of
this license is BSD-2-Clause. See the
LICENSE file for
google-font-download [OPTION...] [FONT...]
- Download the specified set of webfont formats from Google's servers.
FORMATis a comma-separated list of identifiers for webfont formats. Supported identifiers are
ttf. Additionally, the special value
allexpands to all supported formats. The default is
all. Note that you may not really need all formats. In most cases, WOFF is enough. See http://caniuse.com/#search=woff for a current status.
- Display this message and exit.
- Download the specified subset of languages from Google's webfonts.
LANGSPECis a comma-separated list of idenfitiers for font subsets. Common identifiers are
greek-ext, etc. An undocumented language is
allwhich means the full (non-subset) files are served. The default is
- Write the generated CSS into
OUTPUT. The file will be overwritten and will be created if it doesn't exist. The default is
This script accepts an arbitrary number of font specs. A font spec is any string that Google's servers will accept as famility URL parameter. Note that your font spec should not be URL-encoded and only one font weight is supported per font specification. If you want to download multiple font weights or styles, provide multiple font specs.
For example, to download Open Sans in
- light (300),
- normal (400),
- normal italic (400italic),
- bold (700), and
- bold italic (700italic), run:
google-font-download \ "Open Sans:300" "Open Sans:400" "Open Sans:400italic" \ "Open Sans:700" "Open Sans:700italic"