googlefonts / ufo2ft

A bridge from UFOs to FontTools objects (and therefore, OTFs and TTFs).
MIT License
152 stars 43 forks source link

disable COLR layer reuse for interpolatable masters when building variable fonts #627

Closed anthrotype closed 2 years ago

anthrotype commented 2 years ago

To successfully merge multiple master COLR tables into a variable COLR with varLib (https://github.com/fonttools/fonttools/pull/2660) the master must have the same structure, number of color glyphs, total number of paints, etc. So we want to disable layer reuse optimization performed by fontTools.colorLib.buildCOLR when building each interpolatable COLR masters (otherwise we might end up with different PaintColrLayers or LayerList count between masters).

I also added a colrLayerReuse parameter to compile methods to force disabling this altogether, in case it might be useful for debugging or speeding up builds. This is set to True by default for all compile methods, except for compileInterpolatable*

Requires https://github.com/fonttools/fonttools/pull/2660

anthrotype commented 2 years ago

the master must have the same structure, number of color glyphs, total number of paints, etc... otherwise we might end up with different PaintColrLayers or LayerList count between masters

well, not any more, my merging algorithm got cleverer, see https://github.com/fonttools/fonttools/pull/2660/commits/e5029801d2c1739b8a51de926b3cb636edf2926e

However, disabling layer reuse when building master COLRs still makes sense from efficiency POW so it's still good to have the option to turn it off