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
Just van Rossum
5fc65d7168
Misc py23 cleanups ( #2243 )
...
* Replaced all from ...py23 import * with explicit name imports, or removed completely when possible.
* Replaced tounicode() with tostr()
* Changed all BytesIO ans StringIO imports to from io import ..., replaced all UnicodeIO with StringIO.
* Replaced all unichr() with chr()
* Misc minor tweaks and fixes
2021-03-29 11:45:58 +02:00
Behdad Esfahbod
606b072f40
[glyf] Add round=otRound parameter to GlyphCoordinates.toInt() & __round__()
2021-03-04 09:43:08 -07:00
Behdad Esfahbod
77acdbced3
[glyf] Remove stale comment about Python 2
2021-03-04 09:20:43 -07:00
Just van Rossum
bec19252c5
[ttLib] Fix for #2044 : fix maxp.maxComponentDepth calculation ( #2045 )
...
Fix for #2044 : don't overwrite the initial maxComponentDepth variable, as this will give the wrong value when there are multiple nested components.
2020-08-14 20:13:01 +02:00
Cosimo Lupo
7c023c42af
[glyf] if comp uses anchors compute firstPt-secondPt offset after applying transform
...
Fixes https://github.com/fonttools/fonttools/issues/1556
When a component uses firstPt/secondPt reference anchor points instead of XY offsets,
and the component also has a transform, fonttools is incorrectly computing its bounding box.
This is because we are computing the translation offset between firstPt and secondPt before
applying the 2x2 scale/rotation/shear transform. By the time we do the translation, the
offset is now incorrect.
We need to compute the translation offset after we have applied the 2x2 transform.
2020-02-13 18:07:57 +00:00