1158 Commits

Author SHA1 Message Date
Khaled Hosny
1fa579f6b8 [merge] Add CFF merging integration test 2021-11-18 22:14:41 +02:00
Khaled Hosny
c20a63a166 [merge] Move test to its own dir 2021-11-18 21:27:01 +02: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
8d6a7617a2 minor: fix 4-space indentation from PR 2441 2021-11-08 12:27:26 +00:00
Rod S
7dd3488732 Traverse when there is no layer list 2021-11-06 14:26:27 -07:00
Rod S
6144202cd9 Don't crash if there is no layer list 2021-11-02 15:59:30 -07:00
Yao Wei (魏銘廷)
390640a357
update to unicode 14.0 2021-10-31 23:24:18 +08:00
Simon Cozens
563730f8ce
Support variable feature syntax (#2432) 2021-10-28 11:58:54 +01:00
Cosimo Lupo
e3bc036c7e Add tests for SVG table 2021-10-13 14:53:00 +02: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
Nikolaus Waxweiler
a7e4d86540 Use a set for file names for clash checking 2021-10-07 12:03:47 +01:00
Cosimo Lupo
64299aa4b1 drop Python 3.6, require >= 3.7
3.10 is out next week, while 3.6 reaches end of life by the end of this year.
It's time to require 3.7 or greater, so we can finally use built-in dataclasses and more.

Fixes https://github.com/fonttools/fonttools/issues/2350
2021-09-27 13:21:08 +02:00
Simon Cozens
d9ce420967 Test for typo case 2021-09-23 08:15:57 +01:00
Simon Cozens
1cc8bf0827 Fix two problems when handling orthogonal lines 2021-09-22 16:28:10 +01:00
Behdad Esfahbod
d867397532 Remove residual allowVID stuff
Part of https://github.com/fonttools/fonttools/pull/2398
2021-08-25 15:55:17 -06:00
Khaled Hosny
89fe3bd3c5 [Tests] Add test for virtual GIDs 2021-08-21 00:16:45 +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
Cosimo Lupo
9c37862087 add Transform.transformVector method
Adds a transformVector and transformVectors methods to the Transform class. Useful for things like https://github.com/googlefonts/ufo2ft/pull/515
2021-08-03 11:49:44 +02:00
Cosimo Lupo
e161bbc980
Merge pull request #2384 from fonttools/newline-2021
Default to "\n" for newlinestr instead of None
2021-08-03 09:21:10 +01:00
Cosimo Lupo
094a40ca2e Revert "Deprecate and ignore newlinestr"
This reverts commit 5af178ac8eb2da79b965be5c6cee693dad602c65.
2021-08-03 10:00:13 +02:00
Cosimo Lupo
01b0180ce1 Revert "Deprecate and ignore ttx’s --newline option"
This reverts commit 3042f129fc6012bd96668831b18d0926c634f7df.
2021-08-03 10:00:01 +02:00
Cosimo Lupo
58ac5a9fd8 have ClipList and ClipBox format start at 1, not 0
b7e81fcbd6
2021-08-02 19:34:30 +02:00
Khaled Hosny
3042f129fc Deprecate and ignore ttx’s --newline option 2021-07-30 04:48:11 +02:00
Khaled Hosny
5af178ac8e Deprecate and ignore newlinestr 2021-07-30 04:31:19 +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
800bf85b2f add ClipList.Format so we can bump when we finally get >16bit GIDs
https://github.com/googlefonts/colr-gradients-spec/issues/346
2021-07-29 15:35:08 +02:00
Cosimo Lupo
bee2c85f61 [colrv1] otData: define ClipList, ClipBox, etc. 2021-07-28 18:04:48 +02:00
Cosimo Lupo
2f1fbd6374
Merge pull request #2372 from fonttools/colrv1-var-idx-map
[COLRv1] add DeltaSetIndexMap, remove ColorIndex
2021-07-26 12:06:15 +01:00
Just van Rossum
b01ea60e9e
[ttLib] when importing XML, only set sfntVersion if the font has no reader and is empty (#2376)
* Only set sfntVersion if the font has no reader and is empty

* test that sfntVersion is only set if the TTFont instance is new/empty
2021-07-24 11:12:37 +02:00
Cosimo Lupo
c96c3ef8fa
Merge pull request #2359 from fonttools/colrv1-transform-reduced-prec
[COLRv1] reduced precision transforms, angles as F2Dot14, centers as FWORD, offsetted Affine2x3
2021-07-23 17:36:41 +01:00
Cosimo Lupo
b74ffb4cda test roundtripping variable COLRv1 with a working VarIndexMap and VarStore 2021-07-23 17:27:57 +01:00
Cosimo Lupo
29a2ebf813 omit default VarIndexBase
4294967295 (0xFFFFFFFF in decimal form) is not very memorable.
Still, using hex notation for all VarIndexBases would make the non-default values less readable (when interpreted as an index into the DeltaSetIndexMap array, decimal makes more sense).
Since 0xFFFFFFFF means 'no variation data', it makes sense to omit it from the ttx dump and write an empty <VarIndexBase/> element with no value.
We also allow to build Var tables without needing to pass "VarIndexBase": 0xFFFFFFFF in the source dict.
2021-07-23 17:27:57 +01:00
Cosimo Lupo
11871673ff [subset] fixed CPAL pruning after removal of ColorIndex 2021-07-23 17:27:57 +01:00
Cosimo Lupo
6ba0163614 fix C_O_L_R_test.py following recent changes 2021-07-23 17:27:57 +01:00
Cosimo Lupo
e5d0c00fab fix colorLib tests after adding VarIndexBase, ColorIndex removed, etc. 2021-07-23 17:27:57 +01:00
Cosimo Lupo
0dc2a2a13f ttGlyphPen: test that open contours work with TTGlyphPen
currently this fails with NotImplementedError. Fix will follow in subsequent commit
2021-07-15 18:19:46 +01:00
Rod S
7225ac22a6 Update to reflect COLR v1 FWORD center and offset to transform 2021-07-06 17:47:56 +01:00
Cosimo Lupo
0e99474985 otData: reduce precision of specialized transforms, use F2Dot14 for all angles
https://github.com/googlefonts/colr-gradients-spec/pull/307 & https://github.com/googlefonts/colr-gradients-spec/pull/310
2021-07-06 17:47:56 +01:00
Jany Belluz
2ff3159a5f Mark the environment variable as experimental 2021-07-05 17:28:44 +01:00
Jany Belluz
7860dd5fe8 Add tests that optimize block matrices 2021-07-05 17:28:44 +01:00
Jany Belluz
ef67839fdb Fix typing error 2021-07-05 17:28:44 +01:00
Jany Belluz
3b34b228dd Fix fonttools otlLib.optimize command line 2021-07-05 17:28:43 +01:00
Jany Belluz
bba5e8b213 Add optional compaction of GPOS PairPos subtables in otlLib.optimize.gpos
See pull request: https://github.com/fonttools/fonttools/pull/2326

The new module `otlLib.optimize.gpos` provides `compact` functions that
can reduce the file size of GPOS PairPos lookups by splitting subtables
in a smart way to avoid storing zero-valued pairs.

The compaction methods are called from `otlLib.builder` and
`varLib.merger` so that static and variable fonts can benefit from the
optimization at compile time.

The new module `otlLib.optimize` is also executable, to allow running
the optimization on existing fonts.

The optimization is a trade-off because on the one hand it can reduce
significantly the byte size of the GPOS table (up to 50% in random
Google Fonts) but on the other hand it adds to the compilation time and
may make fonts very slightly bigger once compressed to WOFF2 (because
WOFF2 doesn't mind about zero values and compresses them very well).

As such, the optimization is off by default, and you can activate it by
providing the environment variable `FONTTOOLS_GPOS_COMPACT_MODE=5` for
example (values from 0 = off to 9 = max file size savings, but many more
subtables).
2021-07-05 17:28:43 +01:00
Khaled Hosny
a7ac2de5cd [tfmLib] New library for reading TFM files
New library for reading TeX Font Metrics files. Does not support writing
them back.

Fixes https://github.com/fonttools/fonttools/issues/2352
2021-07-05 03:24:25 +02:00
Cosimo Lupo
a0bd872f0e TupleVariation: make shared tuples order deterministic
most frequent first (like before https://github.com/fonttools/fonttools/pull/2351), only sort ties alphabetically
2021-07-02 12:52:54 +01:00