88 Commits

Author SHA1 Message Date
Behdad Esfahbod
28385ec07e [VARC/test] Adjust test
This subset font is from a different source and has
different glyphs.
2024-05-22 18:46:06 -06:00
Khaled Hosny
dbe1264b34 [subset] Prune unused user name IDs even with --name-IDs='*'
This option should affect only pre-defined name IDs, user name IDs
should be pruned when nit used, as usual.

Fixes https://github.com/fonttools/fonttools/issues/3508
2024-05-17 19:26:19 +03:00
Cosimo Lupo
7ca97d6d7f [subset_test] added NotoSansCJKjp subset to test east-asian-width feature are kept by defailt 2023-10-19 11:20:48 +01:00
Cosimo Lupo
d017d2b173
use pytest importorskip to skip modules that depend on extra requirements
this should allow to run the basic test suite against the dependency-less core of fonttools library
2023-05-24 16:26:48 +01:00
Khaled Hosny
7b0e3643a0 [subset] Add test for pruning GDEF.MarkGlyphSetsDef 2023-05-22 14:30:15 +03:00
Jany Belluz
760c7376fe [subset] Compute xAvgCharWidth even when --no-prune-unicode-ranges is given 2023-03-01 16:28:51 +00:00
Behdad Esfahbod
b657b309e9 [Tests/subset/VarComposite] Add test 2023-01-30 11:26:21 -07:00
Cosimo Lupo
fadb335591
reproducer for bug subsetting COLR.ClipList with shared clips #2965
modify test so that a couple color glyphs share the same clipbox to trigger issue copying lazy objects
https://github.com/fonttools/fonttools/pull/2968
2023-01-26 18:02:14 +00:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Jack McCabe
eeba234ee0 [subset] PR feedback implementation 2022-09-30 15:59:11 +01:00
Jack McCabe
14ce08bd75 [subset] extend CPALv1 test 2022-09-30 15:41:14 +01:00
Jack McCabe
70112b947d [subset] prevent CPAL nameIDs from being dropped 2022-09-30 12:36:28 +01:00
Jack McCabe
4901deab76 [subset] Add test for CPALv1 (failing !) 2022-09-30 12:10:56 +01:00
Cosimo Lupo
0f33634a9e subset_test: fix mock test with uharfbuzz>=0.30 new 'repack_with_tag' method 2022-08-15 12:10:13 +02:00
Cosimo Lupo
d5dd4d297f subset_test: catch ImportError instead of ModuleNotFoundError 2022-07-18 12:17:35 +02:00
Garret Rieger
4acad94b93 Update harfbuzz repack test failure message expectation. 2022-06-27 18:13:52 +00:00
Cosimo Lupo
8309aaf8d8 [subset_test] add failing test to repro SinglePosFormat2 with ValueFormat=0
reproduces #2602
2022-04-27 15:58:29 +01:00
Cosimo Lupo
350f893e17 [otBase] demote repacker ERROR to WARNING, only 1 per loop; don't exit at firstfail
Fixes https://github.com/fonttools/fonttools/issues/2594
2022-04-22 19:05:54 +01:00
Cosimo Lupo
f68ce14d7a [otBase] log the name of uharfbuzz exception 2022-04-22 15:31:34 +01:00
Cosimo Lupo
4217384e81 subset_test: ignore_errors in rmtree when tearing down tempdir
should fix random test failures like
https://github.com/fonttools/fonttools/runs/6127120342?check_suite_focus=true
2022-04-22 11:46:07 +01:00
Cosimo Lupo
af6804bed5 make USE_HARFBUZZ_REPACKER a 3-state option, defaults to auto
if explicitly enabled, it will raise ImportError if uharfbuzz is not found, and will propagate the uharfbuzz error instead of silently falling back to the pure-python serializer
2022-04-21 18:11:20 +01:00
Cosimo Lupo
4160f05242 [subset_test] test disabling hb repacker, and capture logging 2022-04-21 15:46:12 +01:00
Cosimo Lupo
f6e212cc2d subset_test: mock hb.repack raising an error to test pure-python fallback 2022-04-19 15:40:58 +01:00
Cosimo Lupo
822bbb2c69 subset_test: remove unused return value 2022-04-19 15:40:58 +01:00
Cosimo Lupo
60d2727a9b subset_test: convert from unittest to pytest-style tests 2022-04-19 15:40:58 +01:00
Qunxin Liu
fe196bf88e Use Harfbuzz Repacker for packing GSUB/GPOS tables 2022-04-14 10:42:50 -07:00
Cosimo Lupo
7ee2c9d891 testTools: factor our method to strip variable items from ttx dumps
it was scattered here and there, so define it once and reuse everywhere needed
2022-04-05 18:34:30 +01:00
Cosimo Lupo
de3830ba2b clarify comment a bit as per review 2021-12-03 11:16:59 +00:00
Cosimo Lupo
d89f90f46c subset_test: test COLR subset excludes glyphs resulting from glyf closure 2021-12-02 18:18:09 +00:00
Cosimo Lupo
32874cb372 subset/COLR: add reproducer for issue #2461
this currently fails with struct.error. Fix will ensue shortly
2021-12-02 18:01:24 +00:00
Cosimo Lupo
a79106d09a add simple subset/svg_test.py 2021-11-15 17:08:55 +00:00
Cosimo Lupo
6df6db840e test subsetter doesn't fail when (optional) ClipList is empty
Kudos to Qunxin for catching the bug
2021-10-11 16:43:18 +02:00
Khaled Hosny
232b2ccbc4 Move the rest of py23 module to textTools
Change all imports to use textTools module, except the test_py23.py test
which is kept until we decide to remove the module (if ever).
2021-08-20 01:29:45 +02:00
Cosimo Lupo
99743c14df subset: explicitly subset ClipList, avoids warning when lazy-loading
relying on ClipList.compile to drop unused clips based on updated glyphOrder won't work when font is loaded lazily (default for subsetter), because ClipList gets decompiled too late (after glyphOrder has already been modified) and this produces warnings about missing glyphIDs.
Better to make the subsetter explicilty prune unused clips.
2021-08-18 09:42:10 +02:00
Khaled Hosny
000bf81700 Default to "\n" for newlinestr instead of None
If newlinestr is None, os.linesep is used, bu it is the third millennium
and we don’t need or want different line endings per-platform.
2021-07-30 04:12:33 +02:00
Cosimo Lupo
11871673ff [subset] fixed CPAL pruning after removal of ColorIndex 2021-07-23 17:27:57 +01:00
Cosimo Lupo
d0d59d2f2c Add PaintScale* and Paint{Rotate,Skew}* variants
This updates fonttools to match the latest draft COLRv1 spec at https://github.com/googlefonts/colr-gradients-spec/pull/290

Summary of changes:
- Added 8 new PaintScale* tables: with/without centers, uniform vs non-uniform
- Added *AroundCenter variants to PaintRotate and PaintSkew (default versions no longer have centerX/Y defaulting to origin)
- PaintRotate, PaintSkew and PaintComposite formats re-numbered
2021-06-28 18:38:47 +01:00
Cosimo Lupo
1cb7e36bbd COLRv1: rename otData structs to remove 'V1' to match updated draft spec
This is a breaking change (but the COLRv1 API was already marked as unstable and subject to change)

The changes in this PR are meant to match the changes from the COLRv1 draft spec at:
https://github.com/googlefonts/colr-gradients-spec/pull/302
2021-06-28 16:13:47 +01:00
Cosimo Lupo
6a97d4cfdd subset_test: check we keep empty 'size' but drop empty 'ssXX' features
https://github.com/fonttools/fonttools/issues/2324
2021-05-27 09:33:29 -06:00
Cosimo Lupo
447116fdba Add test to reproduce issue 2312 2021-05-19 20:05:36 +01:00
Cosimo Lupo
2981e5f6ca subset: test mixed COLR v0/v1 with subset excluding all v0 glyphs
This currently throws a KeyError: ('uniE004', 'BaseGlyphRecordArray')
2021-05-14 10:43:24 +01:00
Cosimo Lupo
2136aac0f0 subset: fix pruning unused CPAL palettes when 0xFFFF is present
FIxes https://github.com/fonttools/fonttools/issues/2257
2021-04-06 19:43:45 +01:00
Cosimo Lupo
a4f42d3b18 subset_test: add tests for PairPos2 useClass0 #2221 2021-03-29 16:18:42 +01:00
Just van Rossum
5fc65d7168
Misc py23 cleanups (#2243)
* Replaced all from ...py23 import * with explicit name imports, or removed completely when possible.
* Replaced tounicode() with tostr()
* Changed all BytesIO ans StringIO imports to from io import ..., replaced all UnicodeIO with StringIO.
* Replaced all unichr() with chr()
* Misc minor tweaks and fixes
2021-03-29 11:45:58 +02:00
Behdad Esfahbod
975f85ed72 [Tests] Fix most tests expectations for Coverage/ClassDef .Format change 2021-03-23 11:42:38 -07:00
Cosimo Lupo
09af39ab53
subset: donwgrade COLRv1 to v0 if all v1 glyphs are dropped 2021-02-15 11:58:56 +00:00
Cosimo Lupo
55c9a0a1ef
update subset_test.py using new COLRv1 dict format 2021-02-15 11:15:42 +00:00
Cosimo Lupo
056aba8e4a
prune unused CPAL palette entries after subsetting COLR glyphs
Fixes https://github.com/fonttools/fonttools/issues/2174
2021-02-15 11:15:42 +00:00
Cosimo Lupo
dda10e0f00
WIP: add test_subset_COLRv1 2021-02-15 11:12:16 +00:00
Nikolaus Waxweiler
586144442d Add test 2021-01-12 17:21:22 +00:00