8975 Commits

Author SHA1 Message Date
Behdad Esfahbod
a715f57130 [TupleVariation] Optimize compilePoints() 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
6abf8680b4 [TupleVariation] More bytes optimization 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
250e59886f [TupleVariation] Micro-optimize away a lambda 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
62a89bc3d5 [TupleVariations] Optimize serialization loops 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
b1b672e17e [TupleVariation] Remove a few hot asserts
We verify the code instead.
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
4cbf6ae1c4 [TupleVariation] Minor 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
d5d771b2bf [TupleVariation] Use array.array to serialize multiple deltas 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
1e6b20cc2c [TupleVariation] Don't round deltas (again!)
Remove tests that passed float in.
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
9405244617 [TupleVariation] Use bytearray() instead of io.Bytes() 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
869f00507b [glyf] Use bytearray() instead of array.array('B') for flags 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
db918e3355 [glyf] Use bytearray() in trim() 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
3a80b56829 [py23] Change tobytes() to accept bytearray 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
33d9e3d6de [subset] Use bytearray() instead of array.array('B') 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
492118c7b5 [subset] Set glyph.data to b'' instead of ''
Fixes tests after 7adbe44154c1bd8a99668512e88facbcb034f05f
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
bbbc877af9 [glyf] Remove several bytes slicings 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
8284af6b61 [TupleVariation] Use list(coordinates) instead of coordinates[:]
The latter is more expensive in GlyphCoordinates().
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
c23a540d07 [GlyphCoordinates] Micro-optimize _i() access 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
b5af979fbd [glyf] Minor 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
1f3c23e62b [glyf] Remove most use of py23 byteord etc 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
693bf0457a [glyf] Remove reprflag()
If compatibility is an issue, we should rewrite it in terms of "bin(flag)".
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
9be029c0cc [glyf] Remove unnecessary use of byteord() 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
fb196fdf7d [glyf] Avoid a copy during decompile of flags 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
e328ee0254 [glyf] Use memoryview() in decompile for larger glyphs 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
4ff6b3390e [glyf] Use bytearray() when compiling 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
3252ed10ee [GlyphCoordinates] Remove unused .isFloat() 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
b63b8ceb8b [GlyphCoordinates] Remove internal dual representation
Always store coordinates as float. Convert to int in __getitem__() if is whole.

This changes observed values. But we never made any guarantees so that's fine.
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
acc56bdf72 [GlyphCoordinates] Faster .zeros()
Using .frombytes() since bytes() constructor can make zeros fast.
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
7ef101ccb1 [GlyphCoordinates] Speed up .zeros()
Such a pain that this is a speedup...
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
f6e8577476 [GlyphCoordinates] Revert back from double to float
We do proper rounding these days, so revert this back.

https://github.com/fonttools/fonttools/pull/964#issuecomment-814511128
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
e9acd9634f [GlyphCoordinates] Store int data as 4byte, not 2byte
The memory increase is negligible, but means that we don't have to
worry about integer overflows anymore.
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
8be2f49b84 [GlyphCoordinates] Speed up __imul__()
Like the recent change to __isub__/__iadd__().

This, as well as the other, change do not handle overflows.
Going to fix that now.
2021-04-08 09:41:45 -06:00
Behdad Esfahbod
96690de9a9 [varLib] Optimize out multiplication by 1 when computing deltas 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
77abdad0f7 [GlyphCoordinates] Move identity check to scale() / translate() 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
45e94ff2bd [GlyphCoordinates] Speed up __isub__() and __iadd__() 2021-04-08 09:41:45 -06:00
Behdad Esfahbod
3892ece50c [GlyphCoordinates] Remove Jython workaround 2021-04-08 09:41:45 -06:00
Khaled Hosny
cbb33d8aa9
Merge pull request #2259 from fonttools/subset-cpal-0xFFFF
subset: fix pruning unused CPAL palettes when 0xFFFF is present
2021-04-06 22:22:46 +02: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
Nikolaus Waxweiler
256018953a Bump version: 4.22.0 → 4.22.1.dev0 2021-04-01 11:18:27 +01:00
Nikolaus Waxweiler
c71275720c Release 4.22.0 2021-04-01 11:18:26 +01:00
Nikolaus Waxweiler
8735c86e00
Merge pull request #2254 from fonttools/update-news
Update NEWS.rst
2021-04-01 11:16:28 +01:00
Nikolaus Waxweiler
fa28e22daf Update NEWS.rst 2021-04-01 11:11:02 +01:00
Cosimo Lupo
59e4e88d2e
Merge pull request #2249 from fonttools/CFF2fix
Add missing CFF2 dict operators
2021-04-01 11:08:24 +01:00
Just van Rossum
bf1b480064
Merge pull request #2251 from justvanrossum/improve-ttfont-getitem
[ttLib] Refactored TTFont.__getitem__ somewhat
2021-04-01 12:04:44 +02:00
Just van Rossum
21826f52dd
Merge pull request #2253 from justvanrossum/fix-536
[ttLib] TTFont.save: create file on disk as late as possible
2021-03-31 20:27:22 +02:00
justvanrossum
c7e736790f TTFont.save: create file on disk only after compilation to tmp stream succeeded. This fixes #536 2021-03-31 15:38:39 +02:00
justvanrossum
6ff4444c41 refactored TTFont.__getitem__ somewhat: don't do major work in an exception handler; factor reading table from file into separate function 2021-03-30 21:26:54 +02:00
Zachary Scheuren
41da60f130 Add missing dict operators to CFF2 2021-03-30 21:24:14 +09:00
Behdad Esfahbod
3ce843e44b
Merge pull request #2221 from fonttools/subset-PairPosFormat2-ClassDef2-klass0
[subset] Improve PairPosFormat2 subsetting
2021-03-29 11:55:38 -06:00
Cosimo Lupo
a4f42d3b18 subset_test: add tests for PairPos2 useClass0 #2221 2021-03-29 16:18:42 +01:00
Behdad Esfahbod
8c59d4be0c [subset] Improve PairPosFormat2 subsetting
This does two things:

1. Intersect subsetter glyphset with the table's Coverage before
   passing to ClassDef1 for subsetting.  Anything that doesn't
   get past Coverage wouldn't ever get to ClassDef1,

2. Never reuse class0 of ClassDef2.  There's unspoken assumption
   that ClassDef2's class0 is never used for actual kerning, since
   that's the unbounded "every other glyph" class.  Previously our
   ClassDef subsetter was reusing class0 if "every other glyph"
   happened to become empty because of the subset glyphset.  Don't
   do that for PairPos's ClassDef2.  As a result of this assumption,
   don't keep a PairPosClass2 subtable if only ClassDef2's class0
   survived subsetting.

Would be good to add tests for both.

Related to https://github.com/harfbuzz/harfbuzz/issues/2703
2021-03-29 16:17:27 +01:00