If we modify the default instance coordinates, then the inferred deltas that
are left in gvar are no longer valid, so we need to calculate them using the
original default coordinates.
They are then re-optimized using the modified default coordinates.
Also, the default deltas returned from instantiateTupleVariationStore are now
already rounded to integer.
The instantiateTupleVariationStore function now groups TupleVariation
tables that have the same axes 'tents', then merges them into a single
TupleVariation by summing their deltas. The rounding to integer happens
after summing the scaled deltas as floats, to reduce off-by-one errors.
To be able to sum gvar TupleVariation, it needs to calculate the inferred
deltas so it now takes two optional lists (origCoords and endPts) that
are passed on to iup_delta function. These only make sense for gvar
type of TupleVariation, of course, and are unused for cvar tuples.
It also run iup_delta_optimize on the gvar deltas that are left after
partial instancing and whose inferred deltas had to be interpolated.
This can be disabled with --no-optimize CLI option.
Also added calcInferredDeltas and optimize methods to TupleVariation
class, which use functions from varLib.iup module, plus tests
that exercise them.
The function now takes a VarStore instance, the fvar axes and a partial
location, and returns an array of delta-sets to be applied to the
default instance.
The algorithm is now more similar to the one used for instantiating the
tuple variation store.
Tests are coming soon.
re-named variables from snake-case to camel-case throughout functions, except for 'master_ttfs' (which is ugly when camel-cased, and is the lone snake-cased in other functions) and the function names (which follows the precedent set in almost all of the rest of the module).
update VarData.VarRegionCount
also set StartCoord and EndCoord to 0 (same end result as only setting PeakCoord
to 0, but this produces less noise when inspeciting the generated XML dump)
removed unused dicts
Remove print statement
Rename v_orig_mapping_i to v_orig_mapping. The suffix was left over from an earlier pass, when there was a mapping for the direct store and another one for the indirect store.
we can reuse the prune_regions method defined in varStore.py to update
the VarRegionList.
also update the counts at the end (will be done automatically on compile anyway).
refactored code, hopefully simplifying things a bit.
for cvar/cvt we do the rounding only at the end after we have summed the scaled deltas
to avoid introducing unnecessary rounding errors.
this way instanceVariableFont function can be used as drop-in replacement for
mutator.instaceVariableFont (which only accepts single-point locations, not ranges)
when 'vmtx' is present in a font, use that to compute the third and fourth 'phantom points'.
When not present, we use the glyph bbox yMax and yMin coords.
NOTE that previously the bottomSideY was incorrectly set to -glyph.yMin (with a minus sign).
However, the minus is not needed when we use the bbox.
Positive vertical advance grows towards negative Y axis.