majodev / google-webfonts-helper

A Hassle-Free Way to Self-Host Google Fonts. Get eot, ttf, svg, woff and woff2 files + CSS snippets
https://gwfh.mranftl.com
MIT License
12.03k stars 421 forks source link

Serve full TTFs (available via Fonts Developer API) #7

Closed davelab6 closed 8 years ago

davelab6 commented 8 years ago

The full TTF URLs are available via https://developers.google.com/fonts/docs/developer_api and those TTFs should be used by this service, because those are the ones actually being served to users and offered for download from the GF directory 'download collection' service.

majodev commented 8 years ago

Just to clarify, programmatically downloading complete archives of a specific font already works.

To download a zip archive that includes all supported subsets/charsets of a specific font id, you'd have to:

  1. get the font resource by its id (e.g. GET /api/fonts/arimo),
  2. parse the subsets array of the response JSON body and
  3. append this to the ?subsets query parameter at the download endpoint (e.g. /api/fonts/arimo?download=zip&subsets=cyrillic-ext,cyrillic,latin-ext,...).

However, you are requesting to simplify this workflow by allowing a GET /api/fonts/arimo?download=zip&subsets=all call to return a zipped archive with complete font charsets?

davelab6 commented 8 years ago

Where are you fetching the fonts from? github.com/google/fonts.git? :)

majodev commented 8 years ago

Hi,

Nope, the link to the font in a specific format gets directly parsed from the CSS which gets requested via specific UAs from fonts.googleapis.com/css?family={font-family}&subset={font-subset}. See here.

It's basically the same technique that Clemens Lang introduced with his bash scripts here.