676 Commits

Author SHA1 Message Date
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
Behdad Esfahbod
b252f0272f [varLib] Add setSupports() and storeDeltas() to OnlineVarStoreBuilder
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 14:05:51 -05:00
Behdad Esfahbod
611e4d4044 [varLib] Allow changing model in OnlineVarStoreBuilder
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 13:56:31 -05:00
Behdad Esfahbod
446ee2a4d0 [varLib] Skip empty glyphs
Untested.

https://github.com/fonttools/fonttools/pull/1368#issuecomment-437082906
2018-11-08 12:58:29 -05:00
Behdad Esfahbod
14e8c06565 [varLib] Fixups
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 12:29:07 -05:00
Behdad Esfahbod
b95967dd07 [varLib] Add models.allSame() and use it
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 11:36:58 -05:00
Behdad Esfahbod
fba530a548 [varLib] Add VariationModel.getDeltasAndSupports()
which automatically fetches submodel.  Needs docstrings...

Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 11:31:44 -05:00
Behdad Esfahbod
6886075a23 [varLib] rename .modelFor() to .getSubModel()
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 11:31:42 -05:00
Behdad Esfahbod
23c58e91d0 [varLib] Allow sparse masters for CVT tables
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 11:31:41 -05:00
Behdad Esfahbod
40a5fb0808 [varLib] Allow sparse masters when merging hinting
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 11:31:39 -05:00
Behdad Esfahbod
1527bb8afc [varLib] Allow sparse masters in gvar
Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 11:31:36 -05:00
Behdad Esfahbod
65bcbf8ac2 [varLib] Implement getting subModels
To be used for sparse masters.

Part of https://github.com/googlei18n/fontmake/issues/88
Part of https://github.com/fonttools/fonttools/issues/1355
2018-11-08 11:31:25 -05:00
justvanrossum
e45117aa02 Fixed bug that tried to get an attr off a LangSysRecord rather than a LangSys. Fixes #1365 2018-11-08 10:04:25 +01:00
Behdad Esfahbod
62003f492f [varLib] If multiple axes have the same range ratio, cut across both
The symmetry is desired.

Before:
$ ./fonttools varLib.models 0,0 .5,0 0,.5 .5,.5 1,1
Sorted locations:
[{}, {'A': 0.5}, {'B': 0.5}, {'A': 0.5, 'B': 0.5}, {'A': 1.0, 'B': 1.0}]
Supports:
[{},
 {'A': (0, 0.5, 1.0)},
 {'B': (0, 0.5, 1.0)},
 {'A': (0, 0.5, 1.0), 'B': (0, 0.5, 1.0)},
 {'A': (0.5, 1.0, 1.0), 'B': (0, 1.0, 1.0)}]

Note the last line assymetry.

After:
$ ./fonttools varLib.models 0,0 .5,0 0,.5 .5,.5 1,1
Sorted locations:
[{}, {'A': 0.5}, {'B': 0.5}, {'A': 0.5, 'B': 0.5}, {'A': 1.0, 'B': 1.0}]
Supports:
[{},
 {'A': (0, 0.5, 1.0)},
 {'B': (0, 0.5, 1.0)},
 {'A': (0, 0.5, 1.0), 'B': (0, 0.5, 1.0)},
 {'A': (0.5, 1.0, 1.0), 'B': (0.5, 1.0, 1.0)}]

7ee81c8821 (commitcomment-31054804)
2018-10-28 09:30:09 -07:00
Cosimo Lupo
6a5a4c7422
varLib.models: fix TypeError comparing float with None 2018-10-26 11:07:12 +01:00
Behdad Esfahbod
7ee81c8821 [varLib] Take total bounding box into account when resolving model
Umm. Not sure how useful this is, but helps with cases where there
were not masters on extremes and people expected this to work.
Happens in Higher-Order Interpolation since the axis extremes
are not interesting.

Fixes https://github.com/googlei18n/fontmake/issues/473

Test case (in case someone wants to add it to test suite!):

Before:
$ ./fonttools varLib.models 0,0 .5,0 0,.5 .5,.5 1,1
Sorted locations:
[{}, {'A': 0.5}, {'B': 0.5}, {'A': 0.5, 'B': 0.5}, {'A': 1.0, 'B': 1.0}]
Supports:
[{},
 {'A': (0, 0.5, 0.5)},
 {'B': (0, 0.5, 0.5)},
 {'A': (0, 0.5, 0.5), 'B': (0, 0.5, 0.5)},
 {'A': (0.5, 1.0, 1.0), 'B': (0, 1.0, 1.0)}]

After:
$ ./fonttools varLib.models 0,0 .5,0 0,.5 .5,.5 1,1
Sorted locations:
[{}, {'A': 0.5}, {'B': 0.5}, {'A': 0.5, 'B': 0.5}, {'A': 1.0, 'B': 1.0}]
Supports:
[{},
 {'A': (0, 0.5, 1.0)},
 {'B': (0, 0.5, 1.0)},
 {'A': (0, 0.5, 1.0), 'B': (0, 0.5, 1.0)},
 {'A': (0.5, 1.0, 1.0), 'B': (0, 1.0, 1.0)}]
2018-10-25 19:46:44 -07:00
David Březina
7e33c427db Better test for none-ness 2018-10-24 19:08:11 +02:00
David Březina
28245afe1e Fix normalization error when condition’s minimum/maximum are missing in designspace, update test too
Fixes #1346
2018-10-24 18:46:45 +02:00
Cosimo Lupo
6db88d7cb7
remove deprecated fontTools.varLib.designspace 2018-10-18 18:40:54 +01: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
Behdad Esfahbod
d258333007 [iup] Fix comment 2018-09-27 17:41:09 -04:00
Cosimo Lupo
9f18570aac
implement building GSUB FeatureVariations from DS rules
Fixes https://github.com/fonttools/fonttools/issues/1176
2018-09-14 16:16:33 +02:00
Cosimo Lupo
26ddbcfe46
varLib: return a namedtuple from load_designspace
so we can also return the list of parsed rule elements
2018-09-12 19:16:13 +02:00
Cosimo Lupo
8080690c74
interpolate_layout: use DesignSpaceDocument instead of varLib.designspace 2018-09-11 18:33:07 +02:00
Cosimo Lupo
5457270775
designspaceLib: 'axes' element is required by DesignSpaceDocument, remove fallback code 2018-09-11 18:25:43 +02:00
Cosimo Lupo
0f4bdf65e6
varLib: use designspaceLib instead of varLib.designspace
and replace _DesignspaceAxis with AxisDescriptor
2018-09-11 18:16:52 +02:00
Cosimo Lupo
c960a361a8
mutator: use piecewiseLinearMap instead of _DesignspaceAxis._map 2018-09-11 18:07:15 +02:00
Cosimo Lupo
8900505200
models: add piecewiseLinearMap function
copied from fontTools.varLib._DesignspaceAxis._map static method.
I place it here since it is also used by varLib.mutator, so makes sense
to have a public function
2018-09-11 18:06:06 +02:00
Cosimo Lupo
5f1844165e
varLib.designspace: add a deprecation warning 2018-09-11 18:02:49 +02:00
Cosimo Lupo
8c597b5375
mutator: round to closest width class
this is the mapping between the half of each percentage intervals and
the associated usWidthClass:

{56.25: 1,
 68.75: 2,
 81.25: 3,
 93.75: 4,
 106.25: 5,
 118.75: 6,
 137.5: 7,
 175.0: 8}

Notice how wdth=80 (in the adjusted test case) will fall in width class
3, instead of 4, because it is < 81.25, thus closer to the nominal 75
than to 87.5.
2018-06-19 14:16:17 +01:00
Cosimo Lupo
0234b9dbd5
mutator: also clamp usWeightClass between valid 1...1000 2018-06-18 19:45:20 +01:00
Cosimo Lupo
dbe08a62ad
mutator: set usWeightClass, usWidthClass and italicAngle
https://github.com/fonttools/fonttools/issues/1264
2018-06-18 19:40:30 +01:00