700 Commits

Author SHA1 Message Date
Nikolaus Waxweiler
a1f4d609e6 [varLib] fix logging typo about setting OS/2.usWeightClass 2019-11-26 16:03:26 +00:00
Cosimo Lupo
dbe20b7217
minor: typos and variable names 2019-11-18 10:51:30 +00:00
Cosimo Lupo
0b9404d7a4
instancer: rename parameters to more generic 'axisLimits'
I use the term 'location' for map of {axis_tag: float} coordinates, 'axisRanges'
for a map of {axis_tag: Tuple[float, float]} ranges, and 'axisLimits' to include
either single-float coordinates or range tuples.
2019-11-15 19:36:57 +00:00
Cosimo Lupo
12e1a6de37
instancer: catch early if input range doesn't include current default 2019-11-15 19:02:12 +00:00
Cosimo Lupo
6142825d7b
instancer: document case when peak is < 1.0 but outer limit exceeds 2.0 2019-11-15 18:35:37 +00:00
Cosimo Lupo
7d136da836
remove stale comment
a featureVars' range(0,0) is perfectly valid.
2019-11-15 18:01:02 +00:00
Cosimo Lupo
599d24a9e1
instancer: add comments to instantiateAvar 2019-11-15 17:43:22 +00:00
Cosimo Lupo
7c695d411f
Merge remote-tracking branch 'origin/master' into l3-instancer 2019-11-15 17:05:47 +00:00
justvanrossum
4de5fb800c improve error when glyph orders don't match; fixes #1758 2019-11-12 10:02:27 +01:00
Cosimo Lupo
8bf82539bb
instancer: update module-level docstring for L3 instancing 2019-10-28 17:39:21 +00:00
Cosimo Lupo
f861c68873
instancer: keep emptied HVAR table
Even if HVAR no longer contains any variations, it's better to keep it because
otherwise one would have to check the glyphs' phantom points to confirm that
the advance widths (or heights for VVAR) don't vary
2019-10-24 17:37:49 +01:00
Cosimo Lupo
3c6ddb0ef8
instancer: never drop STAT DesignAxes; only prune out-of-range AxisValues
The current method for L1 and L2 partial instacing of STAT table --
i.e. drop all pinned axes are respective axis values -- was incorrect.
STAT design axis are a superset of the fvar axes, they describe the relations
between members of a font family in which some aspects may be implemented as
variation axes within a single VF, others as multiple discrete fonts.

When we remove an axis from fvar, we still want to keep the STAT's DesignAxis,
as well as the single AxisValue table along that design axis which describes
the position of the new instance within the family's stylistic attributes.

This means, intantiateAvar will never drop any DesignAxis, but will only drops
AxisValue tables when: 1) we're pinning an axis and the desired instance
coordinate doesn't exactly equal any of the existing AxisValue records;
2) we're restricting an axis range, and the (nominal) AxisValue falls
outside of the desired range.

We never add new AxisValue records, as that's a design decision that
is outside of the scope of the partial instancer.
2019-10-24 17:37:48 +01:00
Cosimo Lupo
0b746bc38d
instancer: implement restricting axis ranges (L3)
Added method to limitTupleVariationAxisRanges which takes a map of
axis tags to (min, max) ranges and drops entire deltasets when outside
of the new limits, or scales the ones that are within range.

Modified _TupleVarStoreAdapter to account for the fact that, when limiting
axes, existing regions can be modifed rathern than simply dropped
(see rebuildRegions).

Implemented limiting axis ranges for fvar, FeatureVariations, and avar.

Note how we pass user-scale coordinates to instantiateAvar, because we need
both the default normalized coordinates and the ones mapped forward (by
the very same avar table that we are instancing).

STAT table support will follow in a separate commit.
2019-10-24 17:10:32 +01:00
Cosimo Lupo
4eee7c071d
varLib: don't add empty gvar or cvar with no variations 2019-10-24 14:05:29 +01:00
justvanrossum
7bfeb1ab97 assume ds is a DesignSpaceDocument instance and therefore is known to have the rulesProcessingLast attribute 2019-10-19 11:17:26 +02:00
justvanrossum
0ee3f01f0c use designspace.rulesProcessingLast flag to determine whether we should use 'rvrn' or 'rclt' 2019-10-18 13:21:06 +02:00
justvanrossum
db04262bed support multiple <featureTag> features 2019-10-17 20:46:59 +02:00
justvanrossum
d2ea72cbec addFeatureVariations(): allow the feature tag to be specified (default to 'rvrn'); allow said feature to already exist, in which case we append new lookup indices to the existing feature 2019-10-17 20:01:05 +02:00
Nikolaus Waxweiler
c1bfc6ad4d cff.py: don't bother cleaning privateDict if it is None 2019-08-16 22:09:52 +01:00
Nikolaus Waxweiler
b8f5d3d705 argparse.ArgumentParser.error takes a str 2019-08-16 22:08:35 +01:00
Cosimo Lupo
38a8eb0e34
varLib.models: fix KeyError when no on-axis points while sorting masters
E.g. when trying to model/plot an unusual designspace like: fonttools varLib.plot 0,0 -1,-1 1,-1 -1,1 1,1
2019-08-12 12:59:45 +02:00
Nikolaus Waxweiler
0f3eaca219 models.py: minor lint fix 2019-08-10 22:20:24 +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
5455517689
Merge remote-tracking branch 'origin/master' into partial-instancer 2019-07-31 15:22:48 +01:00
Cosimo Lupo
b59ac7f13e
Revert "Merge pull request #1671 from anthrotype/varlib-single-master-vf"
This reverts commit f3c99cfef211336a9c6921552462ee1661fbcede, reversing
changes made to 1dcb3c2bde86e9977bb384046e594e35ecd18796.
2019-07-29 10:45:25 +01:00
Cosimo Lupo
a5ed37f262
varLib: don't build empty HVAR or gvar tables
Fixes https://github.com/fonttools/fonttools/issues/1670
2019-07-26 13:21:17 +01:00
Behdad Esfahbod
84b9e9c387 [varLib.featureVars] Fix region-merging code on Py3
We should clean up all the various "convert dict to tuple" duplicated
code, but this fixes it for now.  doctest updated.

Fixes https://github.com/fonttools/fonttools/issues/1659
2019-07-09 16:14:01 -07:00
Miguel Sousa
e1f0d1ae09 varLib CFF fixes (#1653)
* varLib.cff: Apply conv_to_int() to all the values

* varLib: Don't hardcode file extension to 'ttf'

Also remove unused imports

* varLib.cff: Fix merging of sparse PrivateDict items

Fixes #1651
2019-06-24 17:10:36 -07:00
Cosimo Lupo
e6b8897f18
instancer: reuse varLib.set_default_weight_width_slant function 2019-06-20 15:09:17 +01:00
Cosimo Lupo
1726a4a1fc
Merge remote-tracking branch 'origin/master' into partial-instancer 2019-06-20 15:05:34 +01:00
Cosimo Lupo
1122a2612b
varLib: add set_default_weight_width_slant
When building a variable font, varLib.build must make sure that
the OS/2.usWeightClass is equal to the wght axis default location,
that the OS/2.usWidthClass is set to the equivalent value (1-9) of
the wdth axis default location, and finally that post.italicAngle
is set to the same default value as slnt axis.

Sometimes the base master doesn't have these values correctly
set leading to discrepancies between OS/2 and post, on the one
hand, and the fvar axes' default values.
2019-06-20 12:23:33 +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
Cosimo Lupo
eda353c4c1
Merge pull request #1642 from fonttools/CFF2-fixes
Fixes merge bug when VF source have no blends or no marking glyphs in any charstrings.
2019-06-17 16:57:16 +01:00
Cosimo Lupo
c2ec989fcc
Merge pull request #1638 from madig/varLib-merge-kerning-correctly
varLib: Fix merging of class kerning tables
2019-06-14 16:26:07 +01:00
Cosimo Lupo
fc6ea56568
must add comma to make parentheses into a tuple 2019-06-14 16:20:48 +01:00
Cosimo Lupo
c6cf9bbb35
minor typo fix 2019-06-14 16:19:54 +01:00
Cosimo Lupo
3ab7dd143d
minor whitespace 2019-06-14 16:19:29 +01:00
Cosimo Lupo
a45af5d8db
minor: typos in comments [skip ci] 2019-06-14 16:06:04 +01:00
Cosimo Lupo
720b266e89
instancer: minor: skip add cvar delta if None or 0 2019-06-14 15:41:33 +01:00
Cosimo Lupo
952fe9b059
instancer: refactor _instantiateFeatureVariations to avoid too deep nesting
https://github.com/fonttools/fonttools/pull/1628#discussion_r292600019
2019-06-14 14:37:39 +01:00
Cosimo Lupo
29daa994f0
instancer: add docstring for 'instantiateTupleVariationStore' 2019-06-14 12:51:31 +01:00
Cosimo Lupo
1345ae8693
instancer: don't define self in terms of mutator, just say what it is 2019-06-14 11:24:33 +01:00
Cosimo Lupo
65b0609be1
remove redundant table__g_l_y_f.getCoordinates method
just use getCoordinatesAndControls
2019-06-14 11:17:37 +01:00
Cosimo Lupo
751c181f2d
instancer: remove comment about module being 'experimental' 2019-06-14 11:09:48 +01:00
Nikolaus Waxweiler
f48051af23 Fix corrupt class-based pair kerning table merging 2019-06-14 10:05:48 +01:00