gfonts - Google Web Fonts from your terminal
gfonts --scan /font/dir1 /font/dir2 or gfonts [options] --popular 15 or gfonts [options] regex1 regex2 ... regexN
This program requires a Google API key for Web Fonts. See this page for more details. Once you have an API key, you must export it into your shell environment.
$ export GOOGLE_FONTS_API_KEY='sekrit'
The program uses the key to get a JSON list of available fonts and font metadata, parses it into a Perl data structure and then caches the data to disk. If the cache on disk is older than 24 hours, it will get new data, overwriting the old files.
This program requires Perl 5.14 or later. It makes use several features and modules added to the perl core as of 5.14.
This implementation focuses fairly exclusively on Mac OS X, but I would welcome patches to generalize this code to Linux and/or Windows.
This option modifies what output is shown. By default, the only thing shown is the font family name. The option may be repeated multiple times. Other available fields are:
Show the download urls by weight/variant.
Show the available weights/variant type faces.
Show the current font version.
Show the last date the font was modified.
Show the available character sets
Show everything above.
Filter downloads or css output by adding variants. By default the only variant is 'regular' which is not always available for every font family. This option may be given multiple times.
Show verbose output when downloading font(s).
Download matching fonts/variants into the current working directory.
Output HTML stylesheet links to STDOUT for matching font families and variants.
Scan (optional given) font folders for web font names and compare the on disk time to the lastModified attribute. If the lastModified attribute is newer, output a message. By default this scans ~/Library/Fonts.
Instead of scanning for a specific regex, display the N (default is 10) most popular fonts.
google_fonts.pl "^Open Sans"
Show all font names that start with the pattern 'Open Sans'
google_fonts.pl --output all "^Open Sans$"
Find the font that exactly matches 'Open Sans' and display all of its metadata.
Show all font names that begin with the letter 'A'
google_fonts.pl --download "^A"
Show all the font names that being with 'A' and download them into the current directory.
Mark Allen <firstname.lastname@example.org>
This software is copyright (c) 2013 by Mark Allen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.