85 Commits

Author SHA1 Message Date
Behdad Esfahbod
8e080f2a82 [varLib] Fix merging of multiple PairPosFormat2 subtables
We should invert each ClassDef1 against its own sublookup Coverage,
not the combined one.  Oops!

Fixes https://github.com/fonttools/fonttools/issues/1411
2018-12-19 06:34:40 -05:00
Behdad Esfahbod
335c98512e [varLib] Variate GDEF LigCarets
Untested.
2018-11-19 16:46:22 -05:00
Behdad Esfahbod
a766d8d91e [varLib.mutator] Mutate GDEF itself 2018-11-19 16:45:30 -05:00
Behdad Esfahbod
0218e07f76 [varLib.mutator] Move some code out of merger 2018-11-19 16:38:27 -05:00
Behdad Esfahbod
38663559b0 [varLib.mutator] Fix Anchor instantiation after recent change
Fixes https://github.com/fonttools/fonttools/issues/1380
2018-11-18 20:39:13 -05:00
Behdad Esfahbod
d4da819ce6 Space 2018-11-18 20:28:25 -05:00
Behdad Esfahbod
e30b830403
Merge pull request #1368 from fonttools/varLib-sparse-masters
[varLib] Support sparse masters
2018-11-15 15:00:00 -08:00
Behdad Esfahbod
49772b136f [varLib] Comment 2018-11-14 10:07:51 -05:00
Behdad Esfahbod
8d441779e5 [varLib] Fix PairPosFormat2 merging
See comments.

Fixes https://github.com/googlei18n/fontmake/issues/470
2018-11-13 22:30:42 -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
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
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
8816262982 [varLib] Move ClassDef merger from VariationMerger to AligningMerger 2018-11-08 23:36:12 -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
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
881023c700 [varLib] Minor 2018-11-08 17:58:30 -05:00
Behdad Esfahbod
c4b475852d [varLib.merger] Implement FeatureVariations instantiation
Fixes https://github.com/fonttools/fonttools/issues/1244
2018-10-14 23:25:56 -07:00
Cosimo Lupo
d570fc038a
use otRound when rounding visual coordinates or deltas
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
2018-06-14 17:40:11 +01:00
Behdad Esfahbod
633f44da39 [varLib.merger] Fix merging of PairPos Format2 with missing subtables 2018-01-08 10:49:25 +00:00
Behdad Esfahbod
e58499cc06 [varLib.merger] Minor 2018-01-08 10:31:50 +00:00
Behdad Esfahbod
b624e0c08e [varLib.merger] Handle missing PairPos format1/2 subtables in AligningMerger
Fixes https://github.com/fonttools/fonttools/issues/1125

The Format2 is still failing in my test case. Investigating.
2018-01-08 10:27:33 +00:00
Behdad Esfahbod
3fbc4688eb [varLib.mutator] Drop GDEF is nothing left in it
Part of fixing https://github.com/fonttools/fonttools/pull/1079#issuecomment-338710803
2017-10-25 11:58:44 -04:00
Behdad Esfahbod
0b5a923ef8 [varLib.mutator] Fix mutating of ValueRecord objects
Part of fixing https://github.com/fonttools/fonttools/pull/1079#issuecomment-338710803
2017-10-25 11:58:32 -04:00
Behdad Esfahbod
69bbddea92 [varLib.mutator] Correctly unset Device entries that are None
Part of fixing https://github.com/fonttools/fonttools/pull/1079#issuecomment-338710803
2017-10-25 11:58:32 -04:00
Cosimo Lupo
28bb992c1f replace int(round(...)) with round(...)
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.
2017-10-22 12:03:52 +01:00
Behdad Esfahbod
5eb3cbe2b0 [varLib.mutator] Mutate GPOS
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.
2017-10-20 20:13:14 -04:00
Behdad Esfahbod
8db7a65d39 [varLib.varStore] New module 2017-10-20 20:13:14 -04:00
Behdad Esfahbod
b9151ffacb [varLib] Add assertions to make sure we merge similar ValueFormat2-zeroedness 2017-08-04 09:22:43 +01:00
Behdad Esfahbod
f3031ce797 [varLib] Add comment 2017-08-04 08:55:34 +01:00
Behdad Esfahbod
010ea47de1 [varLib] Minor rename 2017-08-04 08:41:29 +01:00
Behdad Esfahbod
c55ef5257d [varLib] Flatten multiple tail PairPosFormat2 subtables before merging
Reuses the aligner.  Neat.
2017-08-01 19:06:40 +01:00
Behdad Esfahbod
eca0c441d1 [varLib] Factor out PairPosFormat2 matrix alignment code 2017-08-01 19:06:40 +01:00
Behdad Esfahbod
3d1f5ae7d4 [varLib.merger] Fixup on previous commit
Also drop Extension from self.
2017-07-28 18:33:01 +01:00
Behdad Esfahbod
f7c20cf895 [varLib.merger] Remove Extensions subtables before merging 2017-07-28 18:17:21 +01:00
Behdad Esfahbod
8dc5340b1d [varLib] Minor; Remove nonexistent attribute name from ignore list 2017-07-14 09:12:04 +01:00
Jens Kutilek
ebbbccae4c For SinglePos format 2, calculate ValueFormat from a list of value records 2017-07-06 10:38:36 +02:00
Jens Kutilek
68e9fcec59 Recalculate ValueFormat when merging SInglePos 2017-07-05 19:06:41 +02:00
Behdad Esfahbod
7ee1d2e2d5 [varLib.merger] In InstancerMerger, compute scalars once
Using new VariationModel API to separate scalar calculation from
interpolation.
2017-05-23 00:54:11 -07:00
Behdad Esfahbod
0ed2df3f22 [varLib.interpolate_layout] Import designspace-loading logic from varLib
When varLib was updated for avar table, this was not.  Share code such
that they don't get out of sync again.  All of this to be made into
proper API some time...
2017-05-22 19:40:20 -07:00