'When downloading a font file from Google fonts, how can I get the license file too?

I'm building a desktop application and I'm downloading font ".ttf" files from Google Fonts with the application. I've managed to do that by utilizing the JSON response from the Developer API: https://developers.google.com/fonts/docs/developer_api

The JSON response returns locations for the font files so I'm able to download and use them.

But if I'm reading the licenses correctly, the license files should always be included when distributing font files. So I need a way to download the license ".txt" file so I'm not breaking the terms of the license agreement by downloading ".ttf" files to each PC that the application is on. I can find the license files on the Google/Fonts Github but not anywhere within the API documentation.

The JSON response doesn't include any license information (although I've opened an issue on the Google Font's GitHub that I was hoping would help: https://github.com/google/fonts/issues/2799)

So how could I find Google Font's license ".txt" file for a given font family?



Solution 1:[1]

You can reconstruct the license with the copyright notices in "Google Fonts - Attribution" page (https://fonts.google.com/attribution) and the license text which is associated with the family.

Solution 2:[2]

The Google Fonts API does not provide access to the font's license, but the licensing information is usually included in the font file itself.

A OpenType/TrueType font file should contain a "name" table, which has an array of so-called "Name Records" that provide all kinds of information like font name, version, creator, copyright, license, etc.

Fore example "Open Sans" has (among others) these two Name Records:

nameId: 13 (License Description)
text: "This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is available with a FAQ at: https://scripts.sil.org/OFL"
nameId: 14 (License Info URL)
text: "http://scripts.sil.org/OFL"

You could use font handling libraries like opentype.js to extract the imformation from the name table.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dave Crossland
Solution 2 Waruyama