googlefonts / gftools

Misc tools for working with the Google Fonts library
Apache License 2.0
242 stars 70 forks source link

builder: Include font build dependencies in meta table #776

Open m4rc1e opened 11 months ago

m4rc1e commented 11 months ago

I'm contemplating storing the build dependencies in every font's "meta" table. We have a situation where many designers haven't pinned the dependencies so we don't truly know what was used. By genning this table at build time, we can be certain of the dependencies.

I've just checked pyftsubset and it'll drop this table by default, which seems like something we'd want to do for this use case. I'd love the fonts in the google/fonts repo to have this table. I don't mind if the fonts on fonts.google.com don't have it.

I've talked about this idea with Cosimo but I'm interested in hearing from everyone else.

This idea has already been discussed in 2017, https://github.com/googlefonts/fontmake/issues/251.

In the next post, I'll workout how big this table will be using Cosimo's dependency lister, https://gist.github.com/anthrotype/531a425c8a0ba5ee975bc2ec8add7b82

m4rc1e commented 11 months ago

Using Cosimo's script, we get the following sizes:

gftools: 2kb, 1kb (zipped) fontmake: 369b, 438b (zipped)

I'll see what size I can get for the gftools if I remove the dependencies which are not used for generating fonts.

m4rc1e commented 11 months ago

Actually, Idk if it's worth bothering trying to compress gftools more than just zipping it since the fonts we serve won't have this data. Are we able to spare 1kb?

anthrotype commented 11 months ago

of course you want either gftools or fontmake, not both, since fontmake is a dependency of gftools, you probably only want gftools' deps.

the dependencies which are not used for generating fonts.

you could place things in extras.. maybe the gftools builder should be in its own distribution..

Idk if it's worth bothering trying to compress

only if you care about retaining the data for shipping fonts, which I think we do not want

m4rc1e commented 11 months ago

of course you want either gftools or fontmake, not both, since fontmake is a dependency of gftools, you probably only want gftools' deps.

The size results I've posted were done by running your gist on gftools and fontmake separately. the gftools dependencies will list fontmake. Personally, I'd prefer if we use the gftools deps since it includes vttLib, ttfautohinter etc so it'll make remaking the fonts much easier,

Idk if it's worth bothering trying to compress

only if you care about retaining the data for shipping fonts, which I think we do not want

Exactly so I'm tempted to leave it as is. Shall I go ahead and open a draft pr with a sketch?

m4rc1e commented 11 months ago

I see no issue if we eventually move the builder to its own repo one day. We'll just get a more compact dependency list ;-)