725 Commits

Author SHA1 Message Date
Cosimo Lupo
8853d56567
Merge pull request #1930 from simoncozens/python3-inheritance
Use Python3 inheritance style for super.___init__
2020-05-11 11:14:31 +01:00
Cosimo Lupo
07e3cf7ef6
Merge pull request #1928 from simoncozens/unused-loop-variable
Use _ to denoted unused loop variable
2020-05-11 11:10:57 +01:00
Just van Rossum
d6bb38c7e6
[otlLib.builder] Add function to build STAT table from high-level description (#1926)
* added a function to build a STAT table: `fontTools.otlLib.builder.buildStatTable()`
* make `varLib._add_stat()` a client of `buildStatTable()`
2020-05-09 16:08:11 +02:00
Simon Cozens
eda4a2717e Use Python3 inheritance style for super.___init__
Avoids cases where super() argument is not enclosing class: https://help.semmle.com/wiki/display/PYTHON/First+argument+to+super%28%29+is+not+enclosing+class
2020-05-07 21:09:20 +01:00
Simon Cozens
46c8f90da8 Use _ to denoted unused loop variable 2020-05-07 21:00:28 +01:00
Chris Simpkins
f47a9cf204
fix instancer documentation 2020-05-02 11:00:29 -04:00
punchcutter
aeb5149f15 Add variable support for BASE table 1.1 2020-03-20 13:34:02 -07:00
Cosimo Lupo
2516a42a88
[varLib] revert to always build gvar, even if empty
turns out gvar is required by OT spec for VF with TrueType outlines:
see https://github.com/fonttools/fonttools/issues/1855#issuecomment-598769956
2020-03-13 15:29:38 +00:00
Nikolaus Waxweiler
4320392eb5 merger: Convert input checking asserts into proper exceptions 2020-02-13 15:02:31 +00:00
Nikolaus Waxweiler
af0567f847 featureVars: Use new exceptions 2020-02-13 15:02:31 +00:00
Nikolaus Waxweiler
5b5c964b0f cff: Use new exceptions
Aliases for the old errors will stay because the AFDKO and maybe others
use them.
2020-02-13 15:01:52 +00:00
Nikolaus Waxweiler
5a53d1d4ad models: Use new exceptions where input is checked 2020-02-13 15:01:52 +00:00
Nikolaus Waxweiler
c5c30588b5 init: Convert input checking asserts into proper exceptions
Also fix the avar output mapping check to allow values greater than OR
EQUAL to the preceeding values.
2020-02-13 15:01:07 +00:00
Nikolaus Waxweiler
8f7a796bd3 init: Convert existing raised exceptions to new appropriate ones 2020-02-13 14:58:10 +00:00
Nikolaus Waxweiler
55bfa4e076 Introduce errors submodule 2020-02-13 14:58:10 +00:00
Nikolaus Waxweiler
eb77a3be22 [varLib] Fill in the forward-mapped location 2020-02-11 15:45:49 +00:00
Cosimo Lupo
1c2fb0e3ef
Merge pull request #1809 from justvanrossum/demo-issue1808
[varLib] demonstrate and fix #1808
2020-02-03 15:39:32 +00:00
Khaled Hosny
366c08a9d6 [varLib, fontBuilder] Set Private.vstore as well
Otherwise T2OutlineExtractor.op_blend() would raise and exception unless
the font is saved and loaded again.
2020-01-31 23:39:47 +02:00
Khaled Hosny
38981b6dae [varLib] Allow using CFF2 table as source
Nothing clever, if the source font has a CFF2 table use it as if it were
a CFF table (i.e. non-variable, not sure what would happen in the source
CFF2 was variable already).
2020-01-31 23:39:47 +02:00
justvanrossum
950314a5a5 undo the more invasive changes, and only keep the change for #1808; maybe we'll add a test later 2020-01-29 12:24:03 +01:00
justvanrossum
49507a9de8 undo DesignSpaceDocument context manager changes, and explicitly (but opt-out) close master_fonts within varLib.build() 2020-01-29 11:55:39 +01:00
justvanrossum
51ff4a5d69 Move ensureDecompiled() calls to mergeObjects(). This makes more sense, but still needs the hasattr checks. 2020-01-29 11:05:01 +01:00
justvanrossum
033145adf6 this fixes #1808, but I'm not sure this is the most elegant solution 2020-01-29 10:10:55 +01:00
justvanrossum
874e74b834 demonstrate #1808 2020-01-24 10:47:48 +01:00
Nikolaus Waxweiler
2d33117c95 Legible error message for axis mapping duplicate check 2019-12-12 11:39:38 +00:00
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