4 Commits

Author SHA1 Message Date
rsheeter
cf4a4087be Generic build fns 2021-02-10 09:40:37 -08:00
Cosimo Lupo
df672a7ae4
move PaintFormat enum outside of Paint class nested scope
When a TTFont is loaded with lazy=True, the otTables are only loaded upon BaseTable.__getattr__
when the requested attribute is not found in the instance __dict__.
Since the Paint.Format enum was defined at class level, every Paint instance, even when loaded
lazily, will have a 'Format' attribute and the magic decompile-on-missing-attribute will not
trigger, since the class attribute will be returned when the instance is missing one.

For this reason, and to not add further special cases, it's better to simply move this Paint.Format
enum class outside to the module level scope, and rename it PaintFormat.
2021-02-05 12:11:43 +00:00
Cosimo Lupo
e20ccfcf9f
add unbuildPaintSweepGradient 2021-02-04 12:16:29 +00:00
Cosimo Lupo
8f66a1e813
COLRv1: add functions to un-build COLR otTables to raw dicts
This adds an unbuildColrV1 which does the inverse of colorLib.builder.buildColrV1.
Takes a LayerV1List and BaseGlypV1List and returns a map of base glyphs to raw data structures (list, dict, float, str, etc.).
Useful not only for debugging purpose, but also for implementing COLRv1 subsetting (where we need to drop whole chunks of paints which may be reused by multiple glyphs).
2021-02-03 16:47:59 +00:00