Fixes https://github.com/fonttools/fonttools/issues/797
Although for the XML->binary case, that bug was already fixed
on master because of the XML populate-default changes.
This adds extra protection!
OpenType TupleVariations can be used in two places:
* In the `gvar` table, they modify glyph contour points by shifting
them towards a point in 2D space.
* In the `cvar` table, they modify constant values.
Before this change, we only had code to handle the `gvar` version
which shifts points around by delta values.
After this change, the XML parsing and generation routines of
TupleVariations can handle deltas that modify constant values in the
CVT table, as used in `cvar`.
An upcoming change will add support for the binary encoding of
TupleVariations as needed for `cvar`.
In the OpenType 1.8 specification, this is called TupleVariation
so let's be consistent with the spec. (The initial implementation
in fonttools pre-dates OpenType 1.8).
Now reading XML and immediately writing it back to XML should be fully
supported and generate the same XML.
Code is a bit hacky (we don't have the reader object, so abuse font for
passing state down tree...).
Not really all... Propagated counts are still not populated.
Most of mti_tests pass again. Four failing now.
NB: In the code being removed in this commit, this line:
"setattr(self, conv.repeat, len(seq)+conv.aux)"
had the wrong sign for conv.aux. Should have been a minus.
The following sed command can be used to update TTX sources for the LookupType
change:
$ sed -i'~' 's/<!-- LookupType=\(.\) -->/<LookupType value="\1"\/>/g' *.ttx
A while back I changed code such that Lookup.LookupType is written as a
comment in XML, and ignored when compiling. The LookupType from type
of actual subtables in a lookup were used during compilation instead.
This caused the problem where an empty lookup (one with no subtables)
would lose its lookup types, among other subtle problems.
With this change we revert above behavior, but keep the benefits: if
Lookup.LookupType is different from actual lookup type of the subtables,
compilation raises an exception. Setting LookupType on Lookup object
or in XML is optional now, but written out by default in XML (instead
of as a comment).
This changes XML output for all GSUB/GPOS tables. I'm sorry for the
noise. Please update your sources.
Fixes https://github.com/fonttools/fonttools/issues/789