Google WebFont Downloader
goog-webfont-dl is a Google WebFont utility to download webfont files to your local machine. It attempts to retreieve WOFF, TTF, EOT, and SVG file formats using custom user-agent strings. It will then output a CSS3 snippet that you can use directly in your project.
Usage
Usage: goog-webfont-dl [options] <fontname>
Options:
-h, --help output usage information
-V, --version output the version number
-t, --ttf Download TTF format
-e, --eot Download EOT format
-w, --woff Download WOFF format
-W, --woff2 Download WOFF2 format
-s, --svg Download SVG format
-a, --all Download all formats
-f, --font [fontname] Name of font
-d, --destination [directory] Save font in directory [default: <fontname>/]
-o, --out [csspath] CSS output file [use - for stdout. default: <fontname>.css]
-p, --prefix [prefix] Prefix to use in CSS output [default: ../fonts/<fontname>/]
-u, --subset [string] Subset string [e.g. latin,cyrillic]
-y, --styles [string] Style string [e.g. 300,400,300italic,400italic]
-P, --proxy [string] Proxy url [e.g. http://www.myproxy.com/]
Install as global command line utility
npm install -g goog-webfont-dl
Library
This package is compatible with Node 0.12 and above.
const downloader = // or const css = // orconst css =
Since Array.prototype.toString
works by joining array elements with commas, subset
or styles
can be specified as array as well.
Example
goog-webfont-dl -a Lato
Output:
Downloading webfont formats: “ttf,eot,woff,woff2,svg” to folder “Lato”http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italicCSS output was successfully written to “Lato.css” $ ls -1 ./LatoLato-Black-Italic.ttfLato-Black-Italic.woffLato-Black-Italic.woff2Lato-Black.ttfLato-Black.woffLato-Black.woff2Lato-Bold-Italic.ttfLato-Bold-Italic.woffLato-Bold-Italic.woff2Lato-Bold.ttfLato-Bold.woffLato-Bold.woff2Lato-Hairline-Italic.ttfLato-Hairline-Italic.woffLato-Hairline-Italic.woff2Lato-Hairline.ttfLato-Hairline.woffLato-Hairline.woff2Lato-Italic.ttfLato-Italic.woffLato-Italic.woff2Lato-Light-Italic.ttfLato-Light-Italic.woffLato-Light-Italic.woff2Lato-Light.ttfLato-Light.woffLato-Light.woff2Lato-Regular.eotLato-Regular.svgLato-Regular.ttfLato-Regular.woffLato-Regular.woff2
Lato.css
Font Name:
If the fontname uses spaces, surround the argument with quotes (or use + instead of spaces)
goog-webfont-dl -a -f "Source Sans Pro" -y 300,400,600,700,300italic,400italic,600italic