robotools / extractor

Tools for extracting data from font binaries into UFO objects.
MIT License
51 stars 16 forks source link

Add support for .ufoz (UFO compressed ZIP format) #50

Closed NightFurySL2001 closed 2 years ago

NightFurySL2001 commented 2 years ago

According to UFO 3 Specification, a UFO folder may be compressed into a ZIP format file with the extension .ufoz. Files bigger than ~4GB should use the ZIP64 format.

This will be a very good addition as CJK fonts that need to go up on Google Fonts has tens of thousands of glyphs that uploading the UFO folder is painstakeningly slow (without resorting to using Mac and Glyphs).

benkiel commented 2 years ago

Extractor extracts into a given UFO object. So, the library that provides the object handles the save.

You can see how Defcon handles it here: https://defcon.robotools.dev/en/latest/objects/font.html#defcon.Font.save

So, you'd do something like:

>>> import extractor
>>> import defcon
>>> ufo = defcon.Font()
>>> extractor.extractUFO("/path/to/MyCJKFont.ttf", ufo)
>>> ufo.save("/path/to/MyFont.ufo", structure='zip')
NightFurySL2001 commented 2 years ago

Thank you! Didn't notice it was in a separate package.