Closes#3634
To produce inferred deltas that will be correct given OpenType's gvar
semantics, fontTool's IUP optimisation module checks the equality of
some points. However, this happens before the points are rounded,
whereas the point comparison that happens at runtime will occur after
the points are rounded (as is necessary to serialise glyf), which leads
to diverging semantics and so diverging and incorrect implied deltas.
This leads to significant visual artefacts, e.g. where large deltas that
should be inferred based on previous values are instead interpreted as 0
at runtime.
I suspect this has gone undetected as the subsetter normally works with
rounded points; in the rarer case that partial VF instancing is
occurring with a different default position, however, varLib.instancer
will calculate and apply the relevant deltas to the font's original
coordinates to effect the new default position, which leads to unrounded
points in memory. This commit ensures that we round directly before
optimising (but still after calculating `glyf` metrics, for backward
compatibility).
All limits are tuples now when not None. The old logic was
broken and for the following command:
$ fonttools varLib.instancer AdobeVFPrototype.otf CNTR=50:80 wght=900
it was saving the output with the name suffix `-instance`, whereas
it's clearly a partial instantiation. This fixes that.
In favor of separate VARC table.
ttGlyphSet does NOT yet know how to draw VARC table though.
The 9 failing tests are all VarComposite-related and need
to be updated with VARC equivalents eventually when we
add VARC support to subsetter and instancer.
The CFF2ToCFF module is rather solid, at least IMO.
This takes convertCFFToCFF2 from cffLib. Apparently there's a more
complete one in varLib.cff:
https://github.com/fonttools/fonttools/issues/1835
Should merge the two and finish them.
vsindex 0 is implied.
Also, add Unimplemented code for private-dict variable
values. I couldn't find any fonts using them, so for
now they remain unimplemented.