deltas in VarData[0] are directly look up by GID so compacted
if any deltas are referenced by LsbMap / RsbMap but not used for advance widths, they are moved to the end of VarData[0]
updated expected test result expect_HVVAR.ttx accordingly
1. if AdvWidthMap/AdvHeightMap missing, deltas for unused (emptied) glyphs are zeroed
2. If indexMap exists and unused glyph ID <= last used glyph ID, then its major/minor number set to 0/0
3. If indexMap exists and unused glyph ID > last used glyph ID, then its major/minor number set to that of the last used glyph (removed from table)
varStore.py. Commit the correct function references.
psCharstrings.py. Add decompiler class specifically for flattening subroutinized charstrings.
mutator.py. Flatten the subroutinized charstrings, delete the Subrs.
TestCFF2VF.otf, Updated to version with subroutinization. Updated expected ttx output.
varLib.py. restore import of 'fontTools.misc.py23 import *'
varStore.py. Rename 'applyScalar' to 'interpolateFromDeltasAndScalars', and refactor common code with __git__item to a static method.
mutator.py. Update to reflect function name change to interpolateFromDeltasAndScalars. Changed some logic from one line to several lines for readability, and i to avoid flake8 warnings about line too long.
So we now round towards +Infinity in:
- floatToFixed (which fully examplify that quotes from OT spec)
- psCharStrings: when packing floats as fixed 16.16
- t2CharStringPen: when rounding coordinates and advance widths
- subset: when rounding advance widths to compute average
- TupleVariation: rounding gvar deltas
- _g_l_y_f: when rounding coordinates: both in GlyphComponent.{x,y}
and for GlyphCoordinates.toInt()
- _h_m_t_x: for rounding horiz/vert metrics
- varLib: rounding horiz metrics and deltas
The variation merger reuses matrix rows / entries when aligning kerning
matrices. Don't remap same DeviceTable twice. Alternative fix would
have been to not reuse objects but that slows things down.
Fixes https://github.com/fonttools/fonttools/issues/1206
While we optimize VarStore later, just deduping here reduces amount
of data we have to work with later by 8x in NotoSans-VF.ttf test
case. It's a cheap optimization, so do it.
Tests were failing on python 2.7.6 because array module doesn't accept
unicode strings (fixed in later 2.7.x releases).
An alternative fix would have been to cast array(str('h'), [...]) but
that seemed a bit too much, especially since varStore module doesn't
really do heavy text manipulation (there aren't other string literals).
We cannot use unicode_literals unconditionally, because of this and
similar issues in the stdlib. We should use it only when it makes sense
and reduces the frequency of u"".
Ouch! Shrinks NotoSans-VF.ttf GDEF VarStore further down.
Original was 1016278 bytes. Before this change it was optimizing
to 256145 bytes. With this change, it goes down to a mere 57127
bytes!!!
We don't need to cast to int when using the round function from py23,
as this is a backport of python3's built-in round and thus it returns
an int when called with a single argument.
Cleans up GDEF varstore as well.
What's left:
- In none of the varLib.merger Mergers we handle the CaretValueFormat3. That should be done,
even though no one uses this,
- GPOS/GSUB FeatureVariations are not applied. Shouldn't be hard.
- 'rvrn' should be folded into 'ccmp' or some other default feature.