222 Commits

Author SHA1 Message Date
Behdad Esfahbod
796cfe750a [glyf] Remove __getitem__
This used to iterate over components. Pretty weird choice.
2023-01-30 11:26:20 -07:00
Behdad Esfahbod
f651809ac5 [glyf] endPointsOfContours is unsigned 2023-01-17 09:12:49 -07:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Behdad Esfahbod
3d2fa8a342 [glyf] Return component transform as part of control data
This makes sure that when we are building variable fonts, we
check that all masters have the same component transform in
composite glyphs.  We were not checking for this before.
2022-10-20 11:05:08 -06:00
Behdad Esfahbod
2a8f408b31 Fix signature of ensureDecompiled() 2022-08-17 14:27:47 -06:00
Behdad Esfahbod
9b0d0e7b56 [visitor] ensureDecompiled(recurse=False) 2022-08-15 12:09:26 -06:00
Cosimo Lupo
43d2ee2822 Revert "return self so one can do font=TTFont(file).ensureDecompiled()"
This reverts commit 61e7b294483cbe729b1437804406b4571ae57cfb.
2022-03-17 15:55:20 +00:00
Cosimo Lupo
61e7b29448 return self so one can do font=TTFont(file).ensureDecompiled() 2022-03-17 15:44:02 +00:00
Cosimo Lupo
7f1e5e1fc7 glyf: add ensureDecompiled method
to 'expand' all the lazy glyphs
2022-03-17 12:51:56 +00:00
Simon Cozens
3e0caa881e
[docs] Fully document the glyf table (#2457)
* Fully document the glyf table

* Correct docs for getGlyphName/getGlyphId

* Fix typo

* Grammar nits
2021-12-02 15:32:20 +00: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
616fc065e0 add deprecation warnings for old getPhantomPoints, etc. 2021-05-13 10:13:28 +01:00
Cosimo Lupo
3c98250dbd g_l_y_f: fix undefined name 'topSideBearing'
Fixes #2295
2021-05-13 10:12:46 +01:00
Eigi
1091ff5e05 #2289 fix for typo in typo in ttLib.tables._g_l_y_f.py 2021-05-06 14:33:57 +02:00
Behdad Esfahbod
51a76e319e [glyf] Add old setCoordinates, getCoordinatesAndControls, getPhantomPoints
https://github.com/fonttools/fonttools/pull/2266
2021-04-14 14:36:35 -06:00
Behdad Esfahbod
a756bb01ab [glyf] Prefix setCoordinates, getCoordinatesAndControls, getPhantomPoints
Will add old name with old API next.
2021-04-14 14:09:40 -06:00
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
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
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
f40ca25726 [GlyphCoordinates] Remove isFloat() again
Based on subsequent review feedback.
2021-04-08 11:22:08 -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
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
bbbc877af9 [glyf] Remove several bytes slicings 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
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