Google fonts are useful, because they can be embedded in websites, and are free to use.

What makes them less useful is that it is hard to browse through them to see what’s on offer.

So I downloaded all the fonts in a single zip package which I found on Github.com. Thanks to the folks who did that part of the job.

Then I prepared an InDesign file with 1000 lines of “The quick brown fox…”, and I wrote a script to apply a different Google font to each line.

The tricky part was to apply Google fonts only. Now, there’s no simple way that I can see of knowing whether a particular font is a Google font – certainly not via ExtendScript. I have 1000+ other fonts installed on my machine, and obviously this catalogue is meant to be Google fonts only. Also, I didn’t want to delete all the other fonts installed currently on my machine, and I don’t use a font manager.

The answer I came up with was to put all the fonts in a folder called GoogleFonts, and put that folder in InDesign’s font folder (C:\Program Files (x86)\Common Files\Adobe\Fonts on my machine).

Now, in the InDesign scripting DOM, each font has a Location object, which is the path to the font. At this stage it became a simple matter of checking the origins of each font, and using it only if it originated in the GoogleFonts folder.

Here’s the script for those who are interested:

t = app.selection[0].parentStory;
ps = t.paragraphs;
f = app.fonts;
c = 0;
for (i = 0; i < f.length-1; i++){
    aFont = f[i];
    myLoc = aFont.location.toString();
    if (myLoc.indexOf("C:\\Program Files (x86)\\Common Files\\Adobe\\Fonts\\GoogleFonts") < 0) continue;
    $.writeln(i);
    fn = aFont.fullName;
    p = ps[c];
    p.appliedFont = aFont;
    p.insertionPoints[0].contents = fn;
    c++;
}

(This was meant for a one-off, local, personal use, so I didn’t bother with anonymous functions, local variables etc.)

The result was satisfactory: An InDesign document with a complete list of Google fonts.

All that was left was a little manual tweaking* and prettifying, and the resulting PDF is here for you to download. It makes it easy and pleasurable to browse through the Google font collection and pick what you want.

* Actually, what took the most time was sorting out the non-Latin script samples. There are a lot of languages represented in the Google font collection. One font in particular – Noto Sans – has a large number of styles representing some uncommon scripts, including those of dead languages. So those font samples took a while to prepare. (There’s some pretty cool stuff there though – check out Noto Sans Egyptian Hieroglyphs on p. 46 of the PDF catalogue!)