6994 Commits

Author SHA1 Message Date
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
754c3c2381
Merge remote-tracking branch 'origin/master' into partial-instancer 2019-06-14 11:50:20 +01:00
Cosimo Lupo
160a9cb238
fix doctest calling configLogger causing flakiness of other tests
since we use pytest-randomly to randomize the test execution, depending on when
this specific test is executed, it may have the side effect of configuring
the global logging configuration, causing other tests that capture logging
messages to fail.

E.g. see https://travis-ci.org/fonttools/fonttools/jobs/545680550
2019-06-14 11:50:07 +01:00
Cosimo Lupo
11bfc6856d
Merge remote-tracking branch 'origin/master' into partial-instancer 2019-06-14 11:31:30 +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
Cosimo Lupo
18efee2c7b
TupleVariation: rename get{DeltaType,CoordWidth}; do not special-case scalar=0
we still need to branch between the case where coordinates are wrapped in (x, y) tuples or naked floats.
2019-06-14 11:03:38 +01:00
Cosimo Lupo
1fc1d2f529
[loggingTools] remove unused backport of LastResortLogger
we are not in the business of logging.
2019-06-11 13:39:59 +01:00
Cosimo Lupo
ab9472d3ab
tox.ini: use pytest-randomly to randomize test execution
https://github.com/pytest-dev/pytest-randomly
2019-06-11 13:25:27 +01:00
Cosimo Lupo
9af92fdb41
woff2_test: fix up flaky tests
some tests were failing when shuffling the order of the tests with
pytest-randomly. That's because calling TTFont.getTableData method
on 'loca' table before having compiled 'glyf' returns an empty b""
string.
2019-06-11 13:22:38 +01:00
Cosimo Lupo
6ea99e4569
feaLib/builder_test: use CapturingLogHandler instead of assertLogs 2019-06-11 13:14:47 +01:00
Khaled Hosny
a56b1af2f6 [subset] Gracefully handle partial MATH table (#1635)
Both MathGlyphInfo and MathVariants can be None, so check for that first
before trying to access their methods.
2019-06-08 17:59:53 -07:00
Cosimo Lupo
97405ddb35
instancer: also update sidebearings+bbox of glyphs with no variations
Previously we were calling glyf.setCoordinates method only when a glyph had some
variation deltas to be applied to the default glyf coordinates.
However, some composite glyph may contain no variation delta but their base glyphs
may change, thus we still need to update the sidebearings and bounding box of the
composite glyphs.
2019-06-06 13:38:11 +01:00
Cosimo Lupo
9d895be4d5
instancer_test: add test for composite glyph without variations
We assert that the composite glyph's sidebearings and bbox are updated when its parent glyph
has changed.
The tests will fail, but a fix will follow shortly.
2019-06-06 13:33:57 +01:00
Cosimo Lupo
1722f99182
PartialInstancer-VF.ttx: add composite glyph and vhea table
the glyph 'minus' references 'hyphen' as component, but doesn't have any deltas in gvar.

vhea table is required when vmtx is present.
2019-06-06 13:30:21 +01:00
Cosimo Lupo
ff473515a2
g_l_y_f: use '==' instead of 'is' for comparing equality with int literals 2019-06-04 16:16:31 +01:00
Cosimo Lupo
0abf6a8295
instancer_test: always dump test ttx files with '\n' 2019-05-31 20:08:50 +01:00
Cosimo Lupo
11b73034d7
instancer_test: read expected test file with unix newlines '\n'
or windows isn't happy..
2019-05-31 20:03:52 +01:00
Cosimo Lupo
8c3bfe5475
ttx: use caplog fixture instead of capsys
this capture logging messages whereas capsys captures stdout/stderr
2019-05-31 19:58:02 +01:00
Cosimo Lupo
499d97464d
instancer_test: use caplog fixture 2019-05-31 19:57:53 +01:00
Cosimo Lupo
3d5f5c0a36
Tests/conftest.py: disable fontTools.configLogger globally during tests
otherwise it causes sides effects since logging state is global and should only
be done when __name__ == '__main__'.

We can capture logging messages via the caplog pytest fixture
2019-05-31 19:57:52 +01:00
Cosimo Lupo
1febf7f5a2
minor formatting 2019-05-31 12:37:31 +01:00
Cosimo Lupo
06ad903ef1
instancer: rename locals from snake_case to camelCase for consistency
the rest of the instancer module uses camelCase, no point in having both styles within the same module
2019-05-31 12:26:03 +01:00
Cosimo Lupo
de2d5382ba
instancer: add more info to module-level docstring 2019-05-31 12:26:03 +01:00
Cosimo Lupo
333ec85985
Merge pull request #1626 from anthrotype/instancer-feature-vars
instancer: bugfixes and tests for instantiateFeatureVariations
2019-05-31 10:50:41 +01:00
Cosimo Lupo
b0ede1a3c6
instancer_test: add tests for normalizeAxisLimits function
coverage is now 97%, good enough
2019-05-30 14:10:26 +01:00
Cosimo Lupo
68bbc74a78
instancer_test: add tests for main() function 2019-05-30 13:56:58 +01:00
Cosimo Lupo
b528ff67f0
instancer_test: add unit tests for parseLimits 2019-05-30 13:35:56 +01:00
Cosimo Lupo
b878b867c0
instancer: don't break on unsupported condition formats
continue checking subsequent condition tables in case the other may
be format=1 and may reference a pinned axis; in which case, these
conditions need to be dropped from the condition set, or the whole
record needs to be dropped if the instance coordinate is outside the
condition range.
Condition tables within a condition set are associated with a AND
boolean operator, so if any one doesn't match, the whole set doesn't
apply. Even if we don't recognize one condition format, if we do
ascertain that another condition table does not match the current
partial instance location, we can drop the FeatureVariation record
since it doesn't apply.
2019-05-30 13:13:06 +01:00
Cosimo Lupo
874947c00b
instancer_test: make new test font with FeatureVariations
instead of reading off existing FeatureVars.ttx test file.
This gives us more flexibility to add more tests, and keeps the input
values closer to the expected results
2019-05-30 13:13:06 +01:00
Cosimo Lupo
afc194db19
featureVars: populate counts on OT tables
this is done automatically upon compiling; however it's good to do it here
as well, in case one wants to pass the updated font directly to other modules
like 'subset' which requires these fields to be present -- without having
to first compile and decompile.
2019-05-30 12:29:23 +01:00
Cosimo Lupo
36f2775d6c
instancer: always keep FeatureVariationRecords with unknown condition format
there was a logic issue in the function that checks whether a FeatureVariationRecord
has a unique set of condition (was returning False instead of True for unsupported condition).
It's safer to always keep such records with unknown condition formats as new formats
may be added in the future. A warning is already issued in these cases.
2019-05-30 11:22:01 +01:00
Cosimo Lupo
823f0fc021
instancer: fix invalid operand '-'; dict.keys() returns list in py27 2019-05-29 19:33:36 +01:00
Cosimo Lupo
3560267a0b
instancer_test: add tests for instantiateFeatureVariations
using the same test file FeatureVars.ttx used by varLib_test.py
2019-05-29 19:24:02 +01:00
Cosimo Lupo
5a3c3334fe
instancer: fix typo in logger name 2019-05-29 19:22:02 +01:00
Cosimo Lupo
11c662ee4d
instancer: only keep unique FeatureVariationRecords
After partial instancing, multiple FeatureVariationRecords may end up with
the same set of conditions (e.g. if one references two axes, one of which
is dropped, and a subsequent one also references the same axis that was
kept in the preceding record's condition set, and the min/max values are
the same for both records).
Therefore, we make sure only the first unique record with a given
configuration of conditions is kept. Any additional records with identical
conditions will never match the current context so they can be dropped.
2019-05-29 18:33:36 +01:00
Cosimo Lupo
60754aab8e
instancer: prune unreferenced lookups in instantiateFeatureVariations
the 'prune_lookups' method is dynamically set on the table_G_S_U_B class
only after importing the fontTools.subset module
2019-05-29 18:33:35 +01:00
Cosimo Lupo
7867c582da
instancer: remap axis indices in instantiateFeatureVariations
ConditionTable.AxisIndex needs to change when dropping axes, to
refer to the same axis in the modified fvar.axes array.

There was also another bug when a condition was not met,
and the `applies` flag (initialised to `True`) was not set to
`False`, thus substutions were incorrectly applied.
2019-05-29 18:20:11 +01:00
Cosimo Lupo
e2c0acf1c2
Merge remote-tracking branch 'origin/master' into partial-instancer 2019-05-29 18:04:54 +01:00
Cosimo Lupo
e3fcf3d459
Merge pull request #1618 from anthrotype/instancer-tests
instancer: add tests for instantiateVariableFont main function
2019-05-29 18:03:35 +01:00
Cosimo Lupo
8f88131a78
FeatureVars.ttx: fix up expected test results after aa8a5bc 2019-05-29 13:48:11 +01:00
Cosimo Lupo
aa8a5bc616
featureVars: avoid duplicate refs to 'rvrn' feature in default langsys
the buildGSUB function creates an empty GSUB with no FeatureRecords, so the
FeatureIndex list should be empty initially; the index of the newly created
rvrn feature record will be appended later on by addFeatureVariationsRaw
function.
2019-05-29 13:40:57 +01:00
Cosimo Lupo
bec188c816
Bump version: 3.42.0 → 3.42.1.dev0 2019-05-28 12:07:55 +01:00
Cosimo Lupo
a0b8ff8b35
Release 3.42.0 2019-05-28 12:07:54 +01:00
Cosimo Lupo
ecd96cfdbc
Update changelog [skip ci] 2019-05-28 12:05:41 +01:00
Cosimo Lupo
2275015df6
README: mention latest Unicode 12.0 [skip ci] 2019-05-28 11:32:48 +01:00