12 Commits

Author SHA1 Message Date
Behdad Esfahbod
b14a29c353 [varLib.merger] Support sparse CursivePos
Part of https://github.com/fonttools/fonttools/issues/3168
2023-07-18 07:14:25 -06:00
Behdad Esfahbod
4c24a3e328 [varLib/merger] Fix merging of SinglePos with pos=0
Fixes https://github.com/fonttools/fonttools/issues/3111
2023-05-19 18:37:15 +02:00
Cosimo Lupo
1dffbae240 support proposed PaintSweepGradient's angles with +1.0 (180°) bias
In the upcoming draft of COLR spec, PaintSweepGradient's startAngle/endAngle are encoded with a +1.0 bias to allow for representation of a full +360° positive angle. Normal F2Dot14-fraction-of-half-circle angles can only represent angles between -360 <= angle < +360

This is a breaking change and will need to be coordinated with rendering implementations (at least FreeType/Skia).
2022-08-15 12:52:28 +02:00
Cosimo Lupo
ef3775a084 merger_test: add test for expandPaintColrLayers method 2022-07-06 09:59:16 +01:00
Cosimo Lupo
fd397bac32 merger_test: test with masters' layer reuse off and on to confirm output is the same 2022-07-06 09:14:17 +01:00
Cosimo Lupo
8a9f16d129 COLRVariationMerger: copy destination layers to ensure they are unique and can be modified in place 2022-07-05 17:53:39 +01:00
Cosimo Lupo
e5029801d2 support merging COLR masters with 'sparse' glyphsets or different layer count
There is no longer a requirement that all the masters have exactly the same base color glyphs as the default masters. Similarly, it's no longer required that all masters' LayerLists have the same total count of layers. It is sufficient that, for a base color glyph in the default master, a non-default master may (or may not) contain one with the same name and same effective number of layers (which in turn can be laid out differently in the respective LayerLists).
This provides greater flexibility when working with variable font project with sparse glyph sets.
2022-07-05 00:11:12 +01:00
Cosimo Lupo
c2887caf95 varLib/merger_test: test merging ClipBoxes 2022-06-28 18:23:06 +01:00
Cosimo Lupo
d85aa2d119 COLRVariationMerger: further optimize DeltaSetIndexMap
previously we only reused the VarIndexBase of a previously seen variable table when the current's varIdxes were _fully_ equal to one of the previous; now we also try to find a match anywhere in the accummulated list of self.varIdxes, including a partial match at the tail of the list.
2022-06-28 14:11:28 +01:00
Cosimo Lupo
c397764720 COLRVariationMerger: implement reuse of VarIndexBase between tables with same varIdxes
When multiple variable tables refer to the same delta-sets they can now share the same VarIndexBase so the resulting DeltaSetIndexMap is a bit smaller.
For simplicity, we only reuse VarIndexBase when variable tables fully share (ie. same, and same number of) varIdxes; potentially we could reuse subsets of varIdxes (e.g. a VarColoStop.Alpha has a +0.5 delta, and later on elsewhere a PaintVarSolid.Alpha has a similar +0.5 delta; the latter could have a VarIndexBase that reuses an existing DeltaSetIndexMap entry for the former), but for now this I think is good enough.
2022-06-27 17:17:32 +01:00
Cosimo Lupo
2b6e813b98 varLib/merger_test: minor reorder sub-tests to follow incremental PaintFormat 2022-06-27 15:38:55 +01:00
Cosimo Lupo
f98c860ff2 Start adding Tests/varLib/merger_test.py for COLRVariationMerger 2022-06-24 18:16:28 +01:00