149 Commits

Author SHA1 Message Date
justvanrossum
4de5fb800c improve error when glyph orders don't match; fixes #1758 2019-11-12 10:02:27 +01:00
Nikolaus Waxweiler
68a5ceac6d varLib: Remove py23 imports 2019-08-10 15:39:02 +01:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
6f1d25497a
Merge remote-tracking branch 'origin/master' into partial-instancer 2019-06-18 18:45:47 +01:00
Cosimo Lupo
4e4f37aa21
varLib.merger: use dict comprehension and zip iterator 2019-06-18 16:30:24 +01:00
Cosimo Lupo
d6c2ea79b6
varLib.merger: simplify if-stmt logic a bit
isPairPos and isSinglePos are mutually exclusive and isSinglePos is only defined if isPairPos is False
so it is safe to use it in 'else' or 'elif' branches (logical expressions short-circuit)
2019-06-18 16:21:33 +01:00
Cosimo Lupo
def6310f4a
varLib.merger: when flattening singlepos, copy valuerecords
to avoid modifying original master fonts' SinglePos tables

https://github.com/fonttools/fonttools/pull/1641/files#r293302141
2019-06-18 16:10:46 +01:00
Cosimo Lupo
8c90878fcf
Merge remote-tracking branch 'origin/master' into fix-singlepos-merge 2019-06-18 15:38:10 +01:00
Nikolaus Waxweiler
f48051af23 Fix corrupt class-based pair kerning table merging 2019-06-14 10:05:48 +01:00
ReadRoberts
b756bcac18 [varLib.merger] Fix merging GPOS SinglePos subtables
When a SinglePost lookup is compiled, pretty much all compilers do some compression by combining similar ValueRecords into a single subtable. This compression produces different lengths of the list of subtables between source fonts. The original code required that all SinglePos lookups have the same subtables, often doesn't work.

I fixed this in varLib.merger.py by first flattening a SinglePos lookup to a single subtable, using the same record format for all records, and then merging the source fonts. After the merge is complete, I call fontTools.otlLib.builder.buildSinglePos() to rebuild the lookup subtables.
2019-06-12 14:30:30 -07:00
Cosimo Lupo
17254fe37a
varLib.merger: Class2Record.Value{1,2} may not be initialised to None
When importing from TTX, these attribute are not there.
2019-05-21 18:42:38 -04:00
Cosimo Lupo
4051976f48
Merge remote-tracking branch 'origin/master' into partial-instancer 2019-05-21 14:54:42 -04:00
Khaled Hosny
7e5644a0a8 [varLib] Fix merging GDEF.GlyphClassDef in mutator
The code was setting GlyphClassDef.classDefs for the base font to an
empty dict then reading it from all fonts. It accidentally works when
creating variable fonts because the GlyphClassDef of the other fonts
will be used, but when mutating there is only one font.

Fix by reading the glyph classes before assigning to an empty dict.
2019-05-18 04:44:34 +02:00
Cosimo Lupo
4db603be96
varLib.merger: have MutatorMerger use pre-computed deltas and optionally keep VarIdx tables 2019-04-18 10:23:37 +01:00
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