1235 Commits

Author SHA1 Message Date
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
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
dafce3ff46 instancer_test: add test with PairPos ValueRecord with XAdvDevice but no XAdvance
this currently raises AttributeError in MutatorMerger.merge for ValueRecord table, because the latter assumes that whenever one of the Device tables are present the respective non-device values are also present, but they may be omitted (and it should default to 0 when missing)
2021-05-25 12:30:35 +01:00
Cosimo Lupo
adbe4c3de7 otTables_test: mixed tabs and spaces 2021-05-20 19:22:24 +01:00
Cosimo Lupo
d1e2e0e381 otTables: ignore Format attribute in split.*Subst overflow-fixing methods
Fixes https://github.com/fonttools/fonttools/issues/2319
2021-05-20 19:19:37 +01:00
Cosimo Lupo
447116fdba Add test to reproduce issue 2312 2021-05-19 20:05:36 +01:00
Jens Kutilek
0cb2bea386
Add TTGlyphPointPen (#2205)
* Add TTGlyphPointPen
* Format code with black
* Implement TTGlyphPen and TTGlyphPointPen with common base class
* Use PenError instead of assert
* Add note about decomposing mixed composites to the docstring
2021-05-17 14:09:36 +02:00
Cosimo Lupo
f2df149db3 COLR: set {BaseGlyph,Layer}RecordArray to None when no colorGlyphsV0 in populateCOLRv0
Same when LayerV1List is empty. All these fields are optional in v1
2021-05-14 10:47:13 +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
c51d3aa061
Merge pull request #2303 from fonttools/glyphclass-by-null
[feaLib] Allow substituting a glyph class with NULL
2021-05-13 10:41:54 +01:00
Eigi
20c4a3ce74 test if issue #2295 is fixed 2021-05-13 09:58:53 +01:00
Cosimo Lupo
6adbf188e6
Merge pull request #2288 from fonttools/remove-overlaps-print-glyph-error
removeOverlaps: work around pathops.simplify error
2021-05-12 17:06:57 +01:00
Khaled Hosny
f6d2ff8d2a [feaLib] Allow substituting a glyph class with NULL
sub [a b c] by NULL; was producing errors, now it builds as multiple
statements.
2021-05-12 08:53:26 +02:00
Just van Rossum
31ab3aae0b
Merge pull request #2285 from fonttools/varStore-32bit
Improve otBase facilities / towards 32bit VariationStore
2021-05-08 17:10:17 +02:00
Just van Rossum
9825ab0977
Fix for #2293: allow more than one lookahead glyph/class in contextual positioning with "value at end" (#2294)
* add test that fails for #2293

* fixing #2293: rewrite of contextual positioning logic, ensure len(suffix) > 1 yields the correct result; checking more edge cases and raising errors inspired by makeotf

* test error cases

* only check when we actually have a value

* catch one more case that makeotf errors on and we didn't
2021-05-08 09:22:30 +02:00
Just van Rossum
d601951eab
[otTables] Default varIdx should be 0xFFFFFFFF (#2298)
* default value for varIdx should be 0xFFFFFFFF to indicate 'no variations'

* use lc hex notation as per feedback
2021-05-07 22:26:48 +02:00
Cosimo Lupo
b0e24384c2 minor refactorings following review comment
https://github.com/fonttools/fonttools/pull/2288#discussion_r627907922
2021-05-07 09:49:40 +01:00
Cosimo Lupo
80598d3c2c skip removeOveraps_test if pathops can't be imported 2021-05-06 20:23:56 +01:00
Cosimo Lupo
27e8943d3c add test for pathops simplify bug workaround 2021-05-06 20:23:56 +01:00
justvanrossum
2636325844 font placeholder doesn't need an fvar table 2021-05-04 19:29:39 +02:00
justvanrossum
d3fd46e3f3 uncomment failing tests 2021-05-04 18:21:37 +02:00
justvanrossum
ad438931e4 adding compile/decompile step; this currently fails for the 32-bit tests (which are therefore commented out) 2021-05-04 17:08:27 +02:00