1705 Commits

Author SHA1 Message Date
Behdad Esfahbod
24140e154e [glyf] Add default=None to glyf.get() 2021-04-14 13:36:07 -06:00
Behdad Esfahbod
d12d7fbb75 [glyf] Remove unused code
Also simplify bounds check.
2021-04-13 15:13:00 -06:00
Behdad Esfahbod
15c34e9ba9 [glyf] Add .get() which is like __getitem__() but returning None if not found
And use it in a couple places.
2021-04-13 15:06:25 -06:00
Behdad Esfahbod
75ef521fd0 [gvar] Reduce TTFont.__getitem__() calls 2021-04-13 14:45:40 -06:00
Behdad Esfahbod
3cbbc25d29 [glyf] Remove useless assert in setCoordinates() 2021-04-13 13:50:01 -06:00
Behdad Esfahbod
34b5ff623c [varLib] Optimize getPhantomPoints()
To reduce calling TTFont.__getitem__ many times per glyph!
2021-04-13 13:49:12 -06:00
Behdad Esfahbod
ddf2f0369b [glyf] Remove useless assert in getPhantomPoints() 2021-04-13 13:27:03 -06:00
Behdad Esfahbod
ee5ecd19d7 [varLib/glyf] Remove fallback vertical phantom-points code
I suggested Cosimo add that code in
https://github.com/fonttools/fonttools/pull/1528

Upon further inspection now, that code is unnecessary and even wrong in
cases where different masters have different ascent, because that would
result in encoding variations for vertical phantom points, which will
be then either be unused or double-apply on top of ascent etc.
2021-04-12 18:28:01 -06:00
Behdad Esfahbod
dc0600c764 [TupleVariation] Fold call to hasImpact() into getUsedPoints()
Related:
https://github.com/fonttools/fonttools/issues/2263

Part of:
https://github.com/fonttools/fonttools/pull/2261
2021-04-09 13:36:29 -06:00
Behdad Esfahbod
bcd4a62f10 [TupleVariation] Use b'' instead of NotImplemented for "use shared points" 2021-04-09 12:16:15 -06:00
Behdad Esfahbod
ef0d695de9 [TupleVariation] Remove unused usesSharedPoints return from tv.compile() 2021-04-09 12:13:49 -06:00
Behdad Esfahbod
b3a9ef551a [GlyphCoordinates] Use double, not float, again
https://github.com/fonttools/fonttools/pull/2261#discussion_r609928776
2021-04-09 11:43:44 -06:00
Behdad Esfahbod
85c9102d47 [TupleVariation] Use Counter() instead of defaultdict() for sharedCoords 2021-04-09 09:23:34 -06:00
Behdad Esfahbod
f3f1628571 [TupleVariation] Comment 2021-04-08 19:47:28 -06:00
Behdad Esfahbod
1650c15b55 [TupleVariation] Minor shift more code into getUsedPoints() 2021-04-08 19:32:54 -06:00
Behdad Esfahbod
050b07d336 [TupleVariation] Optimize compileDeltas() 2021-04-08 18:24:13 -06:00
Behdad Esfahbod
78e9bc7b49 [TupleVariation] Optimize compilePoints()
Special-case "all points used" representation in the internal API.
2021-04-08 18:24:13 -06:00
Behdad Esfahbod
e0513cfee3 [TupleVariation] Avoid recompiling pointData
Pass them down to tv.compile().

Tests need to be updated for changed new internal tv.compile() API.
2021-04-08 18:22:00 -06:00
Behdad Esfahbod
7051829f75 [TupleVariation] Compile point set counts outside of key() 2021-04-08 17:42:10 -06:00
Behdad Esfahbod
683e898768 [TupleVariation] Optimize point-sharing 2021-04-08 17:36:58 -06:00
Behdad Esfahbod
f40e522ce9 [TupleVariation] Speed up case of useSharedPoints=False 2021-04-08 15:57:53 -06:00
Behdad Esfahbod
92bf782ef3 [TupleVariatin] Minor optimization of sharedPoints 2021-04-08 15:53:48 -06:00
Behdad Esfahbod
8dae627d3f [TupleVariation] Rewrite getUsedPoints() as list comprehension 2021-04-08 15:50:52 -06:00
Behdad Esfahbod
12c88cc3a4 [TupleVariation] Remove use of byteord() 2021-04-08 15:50:52 -06:00
Behdad Esfahbod
c88aab1544 [TupleVariation] Minor optimization in compileDeltaValues_() 2021-04-08 15:50:52 -06:00
Behdad Esfahbod
ea505154df [gvar] Avoid a copy in compileGlyph_() 2021-04-08 15:50:52 -06:00
Behdad Esfahbod
997b976e9a [TupleVariation] Rewrite assertion faster 2021-04-08 15:50:52 -06:00
Behdad Esfahbod
b811c3f3f3 [gvar] Remove use of bytesjoin() 2021-04-08 12:18:58 -06:00
Behdad Esfahbod
67794827ff [TupleVariation] Use defaultdict in compileSharedTuples 2021-04-08 11:56:36 -06:00
Behdad Esfahbod
9b379bbb87 [TupleVariation] Further optimize compileCoord() 2021-04-08 11:51:15 -06:00
Behdad Esfahbod
48e827aa21 [TupleVariation] Minor optimization in compileCoord() 2021-04-08 11:46:32 -06:00
Behdad Esfahbod
416ff89171 [TupleVariation] Minor optimize in using sharedCoordinates 2021-04-08 11:40:44 -06:00
Behdad Esfahbod
f40ca25726 [GlyphCoordinates] Remove isFloat() again
Based on subsequent review feedback.
2021-04-08 11:22:08 -06:00
Behdad Esfahbod
ec80f24315 [TupleVariation] Remove use of bytesjoin() 2021-04-08 11:11:50 -06:00
Behdad Esfahbod
f8d54b1ebb [TupleVariation] Minor rewrite bound checks 2021-04-08 11:01:20 -06:00
Behdad Esfahbod
faaac34acf [GlyphCoordinates] Add back isFloat() and deprecate it 2021-04-08 10:58:58 -06:00
Behdad Esfahbod
c206341bb0 [GlyphCoordinates] Inline _i() 2021-04-08 10:52:40 -06:00
Behdad Esfahbod
645a3eb104 [GlyphCoordinates] Use float.is_integer() 2021-04-08 10:43:20 -06:00
Behdad Esfahbod
c5e3fca636 [GlyphCoordinates] Format 2021-04-08 09:48:35 -06:00
Behdad Esfahbod
5c815a6def [TupleVariation] Do away with another bytesjoin() 2021-04-08 09:41:45 -06:00
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