91 Commits

Author SHA1 Message Date
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
315705a58f [subset] fix subsetting OT-SVG when glyph id attribute is on the root <svg> element
Fixes https://github.com/fonttools/fonttools/issues/2548
2022-03-18 13:18:53 +00: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
247fa84b98 only rename glyph element ids when clash actually occurs 2021-11-16 14:28:14 +00:00
Cosimo Lupo
dbcb9d6cee parametrize test_subset_single_glyph_per_svg, as per review 2021-11-16 14:06:24 +00:00
Cosimo Lupo
07455790b1 simplify ranges() generator 2021-11-16 14:06:24 +00:00
Cosimo Lupo
863c9de57c subset/svg_test: test more complex document with cross-references 2021-11-15 17:08:55 +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
6b2b2f4949 [Tests] Fix most test expectations for ClassDef[12] .Format removal 2021-03-23 11:43:46 -07:00
Behdad Esfahbod
b62170e86d [Tests] Fix most tests expectations for LigatureSubst .Format change 2021-03-23 11:43:15 -07:00
Behdad Esfahbod
61b06a7fe0 [Tests] Fix most tests expectations for SingleSubst .Format change 2021-03-23 11:43:03 -07:00
Behdad Esfahbod
de81aae164 [Tests] Fix more tests expectations for Coverage/ClassDef .Format change 2021-03-23 11:42:54 -07: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
03655e55d3 Change test data to make it pass 2021-01-13 16:30:46 +00:00
Nikolaus Waxweiler
586144442d Add test 2021-01-12 17:21:22 +00:00
Khaled Hosny
d8e546df5f [subset] Allow LangSys tags in --layout-scripts
Allow specifying which LangSys tags to accept for each script, using
script.lang form. For example:

    --layout-scripts=arab.dflt,arab.URD,latn

To keep DefaultLangSys and “URD” language for “arab” script, and all
languages for “latn” script.
2020-11-20 23:38:29 +02:00
Cosimo Lupo
8bbf30d569
subset_test: add subset of Iosekva-Medium.ttf with ContextSubstFormat3 2020-05-11 18:32:32 +01:00
Cosimo Lupo
c8f591ea8a
subset: remove FeatureVariations table and downgrade to version 0x10000 when empty
https://github.com/fonttools/fonttools/issues/1881#issuecomment-620719882
2020-04-28 18:34:15 +01:00
Cosimo Lupo
ec6205199e
subset_test: add test for dropping 'rvrn' feature and all FeatureVariationRecords
Added a TODO for the partial dropping of FeatureVariationRecords
https://github.com/fonttools/fonttools/issues/1881#issuecomment-619415044
2020-04-25 18:40:19 +01:00
Cosimo Lupo
cf0567d8a5
subset_test: test subsetting font to empty glyf table 2020-02-12 14:25:25 +00:00
Cosimo Lupo
a32fd30c2d
subset_test: add test for optimizing SinglePos format when all subsetted values are same 2020-01-16 18:30:07 -08:00
Cosimo Lupo
9c0c3a1375
subset_test: Add (failing) test to repro #1777
the 'rvrn' feature is being incorrectly dropped because the feature indexes
change if some other feature occuring before 'rvrn' is dropped, like
in this test case.
2019-12-12 12:29:08 +00:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Khaled Hosny
4db8cb237f [subset] Support sbix table
Test font is a subset of:
https://github.com/djrrb/Bungee/blob/master/fonts/Bungee_Color_Fonts/BungeeColor-Regular_sbix_MacOS.ttf
2019-08-01 01:52:38 +02:00
Cosimo Lupo
33fa149c31
subset: Add tests for --flavor option 2019-06-19 11:32:34 +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
Khaled Hosny
2861d65e56 [subset] Update font extents in head table
When --recalc-bounds option is used the font extents in the head table
need to be updated, but since tables are lazy-loaded by default the
table will not be recompiled and will keep the old value. Force
recompiling the table by adding it to prune_post_subset tables, though
I’m not 100% sure this is the best approach.
2019-05-17 21:10:11 +02:00
Garret Rieger
dce15980fd Make --retain-gids truncate empty glyphs after the last non-empty glyph. 2019-05-16 10:13:33 -07:00
Cosimo Lupo
96c81ebd8a
Merge pull request #1598 from fonttools/update-OTF-testfonts
Convert OTF font files in test data to ttx files.
2019-05-13 13:09:37 +01:00