Fix syntax error reported by build system: can't mix string string types when doing literal concatenation
Fix local import reference - doesn't work in Python3.
Addressed issues raised by @msousa for PR 1345 yesterday.
Will change cff2_merge_funcs.py and cff2mergePen.py from tab to space indentations after the current comments are resolved.
Add various improvements from comments:
- do not edit the post table under varLib.build(). Setting post table format 2 or 3 is now expected to be managed by whatever calls varLib.build().
- In the t2CharStringPen module, rename closure _round() nested in makeRoundFunc to an exportable function, and use it in cff2mergePen.
- remove TypeSupply copyright from cff2mergePen.
- use modulo function to convert float to int when it is meant to be 0 in cff2mergePen.
cff2_merge_funcs.py:merge_PrivateDicts() should only be blending the hint related fields in the PrivateDict. This oversight that was surfaced by @madig reporting an error building his Cantrell font. The bug appeared when the font was subroutinized, as the pen draw method then has to interpret the Subr field in order to access T2Charstring subroutines.
Fix expected ttx output file. When I removed the logic to add glyph names to the post table, glyph names in the ttx file changed.
Miguel prefers a simple list for readability in cff2_merge_funs.py:138.
See 0283b1f.
By finishing overlayBox() to cull remainder box when possible, we generate
far fewer spurious boxes, if any.
For the featureVars_test.py test case, this now generates optimal output,
that is, 2*n - 1 boxes.
Running time for n=20 stays at 0.06s, which is probably Python startup
time.
Running time for n=100 is down from 2.5s with unoptimized new algorithm,
to 0.17s for this and number of output boxes from 5050 to the optimal 199.
Fixes#1372 again
Whereas previous algorithm had exponential running time and return
value size, new one has quadratic.
For featureVars_test.py test case, for example, which is a pathological
test case of n sliding intervals, the number of output intervals of
various algorithms are:
- Previous algorithm: 2**n - 1
- New algorithm: n*(n-1)/2
- Optimal algorithm: 2*n - 1
Ie, we go from exponential to quadratic, whereas in this case the optimal
solution is linear.
Running time of said test, for n=20, goes from over 20s, to 0.06s.
The algorithm can be improved. The overlayBox() function currently does
not try to shrink the remainder box. Doing that will probably bring us
to optimal solution for this test case.
Fixes https://github.com/fonttools/fonttools/pull/1372
One test is failing. Needs to be investigated that new output is correct,
and test expectations updated.
Just such that their existing .Format is preserved, as that is written out
to the XML file, and would break the test suite if not there.
Stupid to write Coverage Format to XML. Oh well...
VariationMerger is updated such that it accepts None list members
in .mergeThings, and switches to correct sub-model. This means,
it technically supports more than just a few masters missing GPOS.
This allows for some within-GPOS differences to also be handled,
though that's not well-studied or complete.
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355