GZIP-compressing SVG table?

I’m creating a hybrid COLR/SVG font, and write now most of the file size is the SVG table (50K of the 64K font). Using fontTools to compress the document inside the table shrinks its side to 34K, which is not bad. I’m wondering if Glyphs can provide an option to do this.

Can you send me both fonts (compressed and uncompressed) and the fontTools command you use to compress them?

The forum does not allow attching .otf files, but here is Anti.glyphs and Glyphs-generated Anti-Regular.otf. The fontTools script is rather simple (the gzipping is done internally by fontTools SVG table module):

from fontTools.ttLib import TTFont

font = TTFont("Anti-Regular.otf")
font["SVG "].compressed = True
font.save("Anti-Regular#1.otf")

Thanks.

Have you tried how big a .woff2 of each file is?

Good point, the uncompressed SVG compresses much much bettter with WOFF2:

$ du -h --apparent-size *.otf *.woff2
61K  Anti-Regular#1.otf
80K  Anti-Regular.otf
32K  Anti-Regular#1.woff2
8.7K Anti-Regular.woff2

I’m not distributing WOFF2 files though, but may be I shouldn’t worry much about file size for desktop fonts.

I think I know why that is. The WOFF compression can look at all svg snippets at once where compressing each glyph individually can’t be compress the recurring parts. Maybe putting all glyphs into one big svg and compress it can produce better results.

But for desktop fonts it is not really relevant and the WOFF is already pretty good.

Makes sense.