Behdad Esfahbod
2295e27dca
[varLib.featureVars] Remove unused intersectBoxes()
2018-11-10 15:19:10 -05:00
Behdad Esfahbod
f1a9c6c036
Move popCount() into new fontTools.misc.intTools
2018-11-10 15:16:52 -05:00
Behdad Esfahbod
7111b253b1
Move hashdict into new fontTools.misc.dictTools
2018-11-10 15:14:36 -05:00
Behdad Esfahbod
0adc304c7b
[varLib.featureVars] Add TODO for moving things to fontTools.misc
2018-11-10 15:09:35 -05:00
justvanrossum
49b7333cf5
According to the spec, this number should be 0x00010000.
2018-11-10 15:07:18 -05:00
Behdad Esfahbod
5c1ca73123
[varLib] Rename allSame() to allEqual()
...
Being same ("is") is not the same as being equal ("=="), even though
the two are equal most of the time.
2018-11-10 15:06:07 -05:00
Behdad Esfahbod
e85a9755ef
[varLib.featureVars] Merge same-subsitutions rules as well
2018-11-09 23:59:33 -05:00
Behdad Esfahbod
34241a819b
[varLib.featureVars] Drop fully-occluded remainder boxes
...
Re-land the correct version.
2018-11-09 16:13:21 -05:00
Behdad Esfahbod
95e13008e1
Revert "[varLib.featureVars] Drop fully-occluded remainder boxes"
...
This reverts commit edecdce0a576b2e15e21711bcc73ae9beba0c527.
Was wrong. Will figure out the correct version.
2018-11-09 16:08:01 -05:00
Behdad Esfahbod
edecdce0a5
[varLib.featureVars] Drop fully-occluded remainder boxes
2018-11-09 15:52:18 -05:00
Behdad Esfahbod
7d5fbe1605
[varLib.featureVars] Improve new algorithm to its full potential
...
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
2018-11-09 15:35:58 -05:00
Behdad Esfahbod
f2b26304ff
[varLib.featureVars] Py3
2018-11-09 14:54:13 -05:00
Behdad Esfahbod
0be1636176
[varLib.featureVars] Optimize popCount()
...
While might look like unjustified micro-optimizing, for featureVars_test.py with
n=100, speeds up 10%. From 2.5s to 2.2s.
2018-11-09 14:34:15 -05:00
Behdad Esfahbod
0283b1fd1d
[varLib.featureVars] Rewrite algorithm
...
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.
2018-11-09 14:30:46 -05:00
Behdad Esfahbod
de2179caee
[varLib.featureVars] Update comment to match actual function output format
2018-11-09 12:15:37 -05:00
Behdad Esfahbod
c7e5a35515
[varLib.featureVars] Space
2018-11-09 12:11:48 -05:00
Behdad Esfahbod
60db91646c
[varLib.featureVars] Add overlayFeatureVariations()
2018-11-09 11:17:17 -05:00
Behdad Esfahbod
a37dab4b74
[varLib.featureVars] Return exploded space from main entry point
...
Also, make font optional
2018-11-09 10:56:47 -05:00
Behdad Esfahbod
5560b26a5d
[varLib] Avoid combinatorial explosion in featureVars
...
By merging duplicate regions.
Fixes https://github.com/fonttools/fonttools/issues/1370
2018-11-09 10:39:19 -05:00
Behdad Esfahbod
fa303ea07a
[varLib] Comment
2018-11-09 09:57:09 -05:00
Behdad Esfahbod
0a0fc2a09e
[varLib] Minor
2018-11-09 09:53:56 -05:00
Behdad Esfahbod
7711755b2c
[varLib] Add mapper to allSameAs() and use it
2018-11-09 09:51:53 -05:00
Behdad Esfahbod
bff73edcfd
[varLib] Add models.allNone
2018-11-09 09:48:02 -05:00
Behdad Esfahbod
7326cb59f3
[varLib] Limit ClassDef merger to GDEF.GlyphClassDef
...
Would be wrong to change a glyph from class0 to non-zero in a ClassDef2
kind of situation. Contain this code to where it was written for.
2018-11-09 09:41:08 -05:00
Behdad Esfahbod
41d07bd8f1
[varLib] Minor
2018-11-09 09:40:06 -05:00
Behdad Esfahbod
ec509540f2
[varLib] Fixup MarkMark merging
2018-11-09 01:46:15 -05:00
Behdad Esfahbod
48e918ab7e
[varLib] Minor
2018-11-09 01:35:20 -05:00
Behdad Esfahbod
b21a39861b
[varLib] Add sparse masters to MarkMarkPos
...
Untested.
2018-11-09 01:17:51 -05:00
Behdad Esfahbod
dfff5134e5
[varLib] Towards sharing merge logic of MarkBasePos for MarkMarkPos
2018-11-09 01:02:45 -05:00
Behdad Esfahbod
babc6d878a
[varLib] More XML redundancy test failure fixes
2018-11-09 00:56:20 -05:00
Behdad Esfahbod
479b52e13d
[varLib] When merging MarkBasePos, retain original coverage objects
...
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...
2018-11-09 00:51:53 -05:00
Behdad Esfahbod
11a679df21
[varLib] Allow sparse masters in GPOS MarkBasePos lookups
...
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-09 00:41:25 -05:00
Behdad Esfahbod
0d85fc57d0
[varLib] Fix recursing object tree in varStore
...
Was barfing on Coverage objects if they didn't have .Format. Ouch!
2018-11-09 00:00:33 -05:00
Behdad Esfahbod
7cda1c1a97
[varLib] Add models.allSameAs()
2018-11-08 23:41:09 -05:00
Behdad Esfahbod
8816262982
[varLib] Move ClassDef merger from VariationMerger to AligningMerger
2018-11-08 23:36:12 -05:00
Behdad Esfahbod
bba0dfc769
[varLib] TODO
2018-11-08 23:35:21 -05:00
Behdad Esfahbod
37dd59120b
[varLib] Allow merging sparse ClassDefs
...
This is mainly meant for GDEF.GlyphClassDefs, but implementation is on the
ClassDefs type. What can possibly go wrong... Seriously though, this is
pretty much always what is desired. To be embraced by more type mergers
down the road.
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 23:27:12 -05:00
Behdad Esfahbod
6bb8a1268a
[varLib.merger] Minor
2018-11-08 23:20:08 -05:00
Behdad Esfahbod
83ea9f0f7c
[varLib] Merge GSUB as well
...
Again, currently this just checks that all masters have the same GSUB.
2018-11-08 23:04:49 -05:00
Behdad Esfahbod
96aa09203f
[varLib] Merge GDEF table
...
Currently, it just makes sure that all masters have the same GDEF.
2018-11-08 23:02:01 -05:00
Behdad Esfahbod
c50b1b9ef6
[varLib] Allow sparse masters in GPOS merging / others
...
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
2018-11-08 18:18:34 -05:00
Behdad Esfahbod
5cfb2fbb24
[varLib] Support sparse masters in MVAR
...
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 18:02:28 -05:00
Behdad Esfahbod
881023c700
[varLib] Minor
2018-11-08 17:58:30 -05:00
Behdad Esfahbod
c2f0cdc31b
[varLib] Fixups
...
Sorry that this is a mixed bag.
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 16:39:11 -05:00
Behdad Esfahbod
70d5429c92
[varLib] Fixup
...
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 15:02:04 -05:00
Behdad Esfahbod
6fb55304fc
[varLib] Remove stale comment
2018-11-08 15:01:16 -05:00
Behdad Esfahbod
4865f48c95
[varLib] Allow sparse masters in HVAR
...
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 14:48:24 -05:00
Behdad Esfahbod
f52661da77
[varLib] Fixup
2018-11-08 14:39:15 -05:00
Behdad Esfahbod
bc7f5ee73f
[varLib] Minor
...
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 14:36:40 -05:00
Behdad Esfahbod
84580fee64
[varLib] Add VarData_add_item()
...
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 14:24:24 -05:00