446 Commits

Author SHA1 Message Date
Behdad Esfahbod
e554ec1dc6 [instancer] Small fix for featureVariations instancing 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
1ff1a537e8 [instancer] Implement L4 featureVariations 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
3f7b250803 [instancer] Add test for FeatureVariations limiting range 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
5cbfe2a956 [instancer] Add test for parseLimits with default value 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
aabced171e [instancer.solver] Fix case3 with gain
Ouch!
2022-10-13 10:35:02 -06:00
Behdad Esfahbod
7ee8414cab [instancer.solver] Better handling of peak==axisDef 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
e08553011a [instancer.solver] Handle when peak falls on new axis default 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
e2a875b26c [instancer] Implement featureVariations L4 instancing
I *think* this is all.
2022-10-13 10:35:02 -06:00
Behdad Esfahbod
d3e0a39362 [instancer] Fix more tests 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
11aa044515 [instancer] Fix another couple of tests 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
08c896f534 [instancer.solver] Cleanup tests of pytest.approx 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
eddc53c267 [instancer.solver] More test 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
743033d755 [instancer.solver] Use pytest.approx() in tests 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
e7d4416c27 [instancer.solver] Add more tests 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
52c791ad1d [instancer.solver] Add a special case 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
b6a3ef37e1 [instancer.solver] Second try at sending everything through WithGain 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
c3fa1b59ac [instancer.solver] Return None as gain tent 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
a87ba55a90 [instancer.solver] More test 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
340fb5866c [instancer.solver] More test 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
dd5452527e [instancer.solver] More fixes 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
264ac96288 [instancer.solver] Improve test 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
4637daf191 [instancer.solver] Fix 3a 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
bb94fe0df2 [instancer.solver] One more test 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
8a49fdc4ec [instancer.solver] Fix up algorithm again 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
6210e7d331 [instancer.solver] Test more 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
f2ebccd468 [instancer.solver] Add tests 2022-10-13 10:35:02 -06:00
Behdad Esfahbod
89dffd51ca [instancer] Make some tests pass
The rest of the test suite needs drastic updates :(.
2022-10-13 10:35:02 -06:00
Just van Rossum
8b8fbf390e formatting 2022-10-13 12:56:04 +02:00
Just van Rossum
2afac999ef Add test for VariationModel with extrapolate=True, and test a two-dimensional designspace for expected interpolation values 2022-10-13 12:50:21 +02:00
Just van Rossum
b073fb8f6f Demand axisRanges is given when extrapolate is True 2022-10-13 12:27:46 +02:00
Just van Rossum
16183b9436 Adjust extrapolate test cases, and added some for extrapolating below the minimum 2022-10-13 09:03:42 +02:00
Behdad Esfahbod
4742960f7f [varLib.cff] Don't round deltas
Fixes https://github.com/fonttools/fonttools/issues/2838
2022-10-04 14:12:01 -06:00
Cosimo Lupo
87bbb64061
[instancer] downgrade GSUB/GPOS version if there are no FeatureVariations after instancing
same as https://github.com/fonttools/fonttools/pull/2811 but moved the logic to _instantiateFeatureVariations directly, instead of after it
2022-09-13 10:44:26 +01:00
Cosimo Lupo
964df076e1 varLib_test: test we don't add no-op DeltaSetIndexMap when not needed
https://github.com/fonttools/fonttools/issues/2800
2022-09-05 17:15:51 +01:00
Behdad Esfahbod
f0f7b93f11 [varLib.models_test] Add test
from https://github.com/fonttools/fonttools/issues/2764
2022-08-23 10:32:57 -06:00
Cosimo Lupo
f5933c1cfa Revert "[varLib.models] Generate narrower tents"
This reverts commit 688939394b8cae3b2a0d5747e435cbd828a14531.
2022-08-23 17:20:57 +01:00
Behdad Esfahbod
bad70c68ef [varLib] Support extrapolation
Fixes https://github.com/fonttools/fonttools/issues/1252
2022-08-23 09:56:33 -06:00
Behdad Esfahbod
32904d43bb [models_test] Add tests from Just 2022-08-16 12:46:44 -06:00
Behdad Esfahbod
3325b47606
Merge pull request #2717 from fonttools/varLib-narrow
[varLib.models] Generate narrower tents
2022-08-16 12:46:22 -06:00
Behdad Esfahbod
03d264756b
Test var model error (#2217)
* [varLib.models] Add test for modeling rounding error

Tests https://github.com/fonttools/fonttools/pull/2214

If you flip demo to True, it does a slower test and demos the new error as well
as the error the old code was producing (ie. rounding deltas post-modeling).

Indeed, the new error is always capped by 0.5 as expected, whereas the old one
was unbounded. Here's the worst-case error of the bad code:

...
240     0.42    4.8
...

240 is just the line number. 0.42 is new error. 4.8 is old error.

* turn test_modeling_error into a parametrized pytest test

Like the other test methods in the same module, all those whose name starts with 'test_' are automatically discovered and run by pytest which is our default test runner. So there is no need to call the test method itself in the top-level module scope. One simply runs the test via pytest. To execute this specific test method one can do 'pytest Tests/varLib/models_test.py::test_modeling_error'.

* use pytest markers to mark specific test as 'slow'

So that one can optionally deselect tests marked with specific marker by passing -m option (e.g. to deselect 'slow' tests, pytest -m 'not slow' ...).

https://docs.pytest.org/en/stable/mark.html#registering-marks
https://docs.pytest.org/en/stable/example/parametrize.html#set-marks-or-test-id-for-individual-parametrized-test

* [varLib/models_test] Comment out non-test code

Co-authored-by: Cosimo Lupo <clupo@google.com>
2022-08-15 10:30:45 -06:00
Cosimo Lupo
1dffbae240 support proposed PaintSweepGradient's angles with +1.0 (180°) bias
In the upcoming draft of COLR spec, PaintSweepGradient's startAngle/endAngle are encoded with a +1.0 bias to allow for representation of a full +360° positive angle. Normal F2Dot14-fraction-of-half-circle angles can only represent angles between -360 <= angle < +360

This is a breaking change and will need to be coordinated with rendering implementations (at least FreeType/Skia).
2022-08-15 12:52:28 +02:00
Behdad Esfahbod
688939394b [varLib.models] Generate narrower tents
Based on https://github.com/fonttools/fonttools/pull/2218
but modify the general solver instead.
2022-08-14 14:00:09 -06:00
Cosimo Lupo
b8333d9ade instancer_test: revert expected result to before, to match eab9aa5 2022-07-06 16:50:22 +01:00
Nikolaus Waxweiler
ce38db6562
Merge pull request #2673 from daltonmaag/instancer-set-bits
Set RIBBI bits when cutting instances
2022-07-06 11:01:08 +01:00
Cosimo Lupo
f1d715dbb1 Add integration test for variable COLR in varLib_test.py 2022-07-06 10:24:16 +01:00
Cosimo Lupo
ef3775a084 merger_test: add test for expandPaintColrLayers method 2022-07-06 09:59:16 +01:00
Cosimo Lupo
fd397bac32 merger_test: test with masters' layer reuse off and on to confirm output is the same 2022-07-06 09:14:17 +01:00
Cosimo Lupo
8a9f16d129 COLRVariationMerger: copy destination layers to ensure they are unique and can be modified in place 2022-07-05 17:53:39 +01:00
Nikolaus Waxweiler
16d899a2be Apply RIBBI bits to all kinds of fonts 2022-07-05 15:45:44 +01:00
Cosimo Lupo
e5029801d2 support merging COLR masters with 'sparse' glyphsets or different layer count
There is no longer a requirement that all the masters have exactly the same base color glyphs as the default masters. Similarly, it's no longer required that all masters' LayerLists have the same total count of layers. It is sufficient that, for a base color glyph in the default master, a non-default master may (or may not) contain one with the same name and same effective number of layers (which in turn can be laid out differently in the respective LayerLists).
This provides greater flexibility when working with variable font project with sparse glyph sets.
2022-07-05 00:11:12 +01:00