85 Commits

Author SHA1 Message Date
Behdad Esfahbod
81498e5baf [varLib] Fix bug with recombining PairPosClass2 subtables that don't
Ouch.  I have no idea why I made two separate if's to begin with, but the
continue should have also been aligned with the inner block...

Fixes root cause of https://github.com/fonttools/fonttools/issues/914
but now we hit an unimplemented feature there...
2017-05-20 23:03:25 -07:00
Behdad Esfahbod
1b5e1c4b06 [varLib.merger] Fix _ClassDef_invert() to limit classes to allGlyphs
Fixes https://github.com/fonttools/fonttools/issues/939

We should rename this function and expose it publicly somewhere.
2017-04-27 16:41:22 -07:00
Behdad Esfahbod
86549315fd [varLib.merger] Fix recombining of multiple PairPosFormat2 subtables
Gosh!  This is the kind of thinko that doesn't happen with less dynamic languages...

Good one hour of debugging at TYPO Labs. Glad this one is fixed finally!

Fixes https://github.com/fonttools/fonttools/issues/888
2017-04-06 15:29:13 +02:00
Behdad Esfahbod
4c07266971 [varLib] Minor 2017-04-06 15:29:09 +02:00
Behdad Esfahbod
9798c30d57 [varLib.merger] Really recombine multiple PairPosFormat2 subtables...
Fixup for 49d311550c29f7501dd4bc91cb24074e3d607b77

Previous try was completely dropping the ParPosFormat2 subtables. Ouch!

Fixes https://github.com/fonttools/fonttools/issues/888
2017-03-17 20:30:56 -07:00
Behdad Esfahbod
49d311550c [varLib.merger] Recombine multiple PairPosFormat2 subtables...
...if they were split because of offset overflows.

Fixes https://github.com/fonttools/fonttools/issues/888
for most common cases.
2017-03-16 17:51:59 -07:00
Behdad Esfahbod
92cb5d28d6 [varLib.merger] Shuffle _ClassDef_invert for more uses 2017-03-16 17:46:28 -07:00
Behdad Esfahbod
7f83d6d445 [varLib.merger] Add TODO item 2017-03-16 16:18:27 -07:00
Behdad Esfahbod
0f5a46b1f9 [varLib.merger] Only insert PairPosFormat1 if non-empty
This is proper fix for c8b2088162f1542dd29b2d370aa2a2c081452559
2017-03-16 16:15:10 -07:00
Behdad Esfahbod
c8b2088162 Revert "[varLib.merger] only insert merged PairPosFormat1 subtable if at least one font has one"
This reverts commit d83c2fb2090fa58f94fdf32d1aa2d2d8665cec05.

This is wrong. We should insert if and only iff there's at least one of the
fonts with a Format1. Yours doesn't look at all fonts. Since this one is not a
bugfix but improvement, I'll fix it separately.
2017-03-16 16:07:46 -07:00
Cosimo Lupo
23511fd302
[varLib.merger] set ClassDef{1,2}.Format using same logic as otTables.ClassDef.preWrite 2017-03-14 16:14:08 +00:00
Cosimo Lupo
e6125b353e
[varLib.merger] avoid reusing the same Class2Record (mutable) objects
Class2Record is mutable, hence doing `[rec2] * l.Class2Count` produces a list containing multiple references to the same instance. When later on we do the interpolation, modifying one would modify them all.
We need to instantiate distinct objects.

See 6f41c2ab53 (commitcomment-21310803)
2017-03-14 14:46:17 +00:00
Cosimo Lupo
d83c2fb209
[varLib.merger] only insert merged PairPosFormat1 subtable if at least one font has one 2017-03-14 14:29:10 +00:00
Cosimo Lupo
aad0d46069
[varLib.merger] fix IndexError with empty ClassDef1 in PairPosFormat2
https://github.com/fonttools/fonttools/pull/881#issue-213020690
2017-03-14 14:26:55 +00:00
Behdad Esfahbod
fb0c60cd2c [varLib.merge] Fix tests
Set Coverage.Format to 1. This is rather arbitrary, which is exactly
why Coverage.Format doesn't make sense and should not have been
exposed to begin with.
2017-03-08 12:52:56 -08:00
Behdad Esfahbod
d7e8af9510 [varLib] Fix regression where GPOS values were stored as 0
Another fallover from merging of VariationMerger and InstancerMerger.

New code is closer to the selfless merger we want to have.

Fixes https://github.com/fonttools/fonttools/issues/834
2017-02-09 19:35:24 -08:00
Behdad Esfahbod
d801056100 [varLib] Allow merging of class-based kerning when ClassDef1's are different
This should allow building varfonts for a whole class of font sources
that failed so far.
2017-02-08 14:29:02 -08:00
Behdad Esfahbod
9544a538ee [varLib] Minor rename in prep for ClassDef1 merging 2017-02-08 14:14:08 -08:00
Behdad Esfahbod
dc07fe4f8f [varLib] Allow merging of class-based kerning when ClassDef2's are different
With this, we can build varfont for NotoSansThai and a couple more.

This is the first use of fontTools.misc.classifyTools module.
2017-02-07 16:09:14 -08:00
Behdad Esfahbod
ef0eb9dc8f [varLib] Move code around 2017-02-05 18:52:27 -08:00
Behdad Esfahbod
b5c34ceb15 [varLib] Fix building variation of PairPosFormat2
I broke this with a738464f775c190bf70e26d0a32ff2344ec43201
Ouch!
2017-02-05 18:48:15 -08:00
Cosimo Lupo
3717dc6549
[varLib.merger] set initializer for reduce() to handle empty sequences; import reduce from functools for py3
When reduce() receives an empty sequence, it raises TypeError, unless it is given a third 'initializer' argument

ValueFormat values should default to 0, so we shall use that as initializer.

Also, the reduce() built-in is no longer available on Python 3.
It's still accessible for both py2 and py3 from functools.

Fixes https://github.com/googlei18n/fontmake/issues/241
2017-01-30 16:51:41 +00:00
Behdad Esfahbod
a738464f77 [varLib] Let VariationMerger use AligningMerger for PairPos
VariationMerger now has all the intelligence of AligningMerge.
Should be good for a while...
2017-01-25 23:34:28 -08:00
Behdad Esfahbod
dd6fb82d66 [varLib] Move common code into a parent merger 2017-01-25 20:43:00 -08:00
Behdad Esfahbod
fece08bc32 [varLib] Enable subclassing of mergers
Theoretically diamond shapes and mixins should work as well.
2017-01-25 20:39:21 -08:00
Behdad Esfahbod
a34a7c906e [varLib] Towards making subclassed mergers working 2017-01-25 20:30:44 -08:00
Behdad Esfahbod
5e1be9e5e7 [varLib] Move code around 2017-01-25 20:11:35 -08:00
Behdad Esfahbod
2532fac11f [varLib] Improve assert fail breadcrumbs 2017-01-25 19:00:08 -08:00
Behdad Esfahbod
7915a45ddf [varLib] Handle fonts without GPOS
Fixes https://github.com/fonttools/fonttools/issues/699
2016-11-08 15:44:39 -08:00
Behdad Esfahbod
b563e6673c [varLib] Implement GPOS binary interpolation for PairPosFormat1 2016-10-22 22:47:18 +02:00
Behdad Esfahbod
b39772b256 [varLib] Fix interpolate_layout for non-similar SinglePos
Has to be ported to varfont merger as well.
2016-10-12 16:11:20 -07:00
Behdad Esfahbod
12d4f277d7 [varLib.merger] Towards supporting merging individual attributes 2016-10-11 20:39:22 -07:00
Behdad Esfahbod
b5d7eb8fd4 [varLib] Show failure path when merging fails 2016-10-05 17:03:48 -07:00
Behdad Esfahbod
9ea16fc0eb [verLib] Add a proper Merger class in varLib.merger 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
cdc6035fdf Add varLib.merger 2016-09-27 19:49:41 +02:00