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
Cosimo Lupo
9c7ceadc0e
[glyf] compile empty table as 1 null byte to make OTS and Windows happy
...
Fixes #899
See https://github.com/khaledhosny/ots/issues/52#issuecomment-289369267
2020-02-12 14:25:25 +00:00
Just van Rossum
cf0e43d6e5
[ttLib.glyf] make glyph.draw() skip redundant final lineTo() ( #1775 )
...
* [ttLib.glyf] make glyph.draw() skip redundant final lineTo()
This ensures that g.draw(pen) and g.drawPoints(PointToSegmentPen(pen)) are now 100% equivalent.
2019-12-12 13:44:10 +01:00
Just van Rossum
e2c60e3dcb
[ttLib.glyf] Fix flag bug in glyph.drawPoints() ( #1774 )
...
This was the same problem as glyph.draw() had, as reported in #1771 .
2019-12-08 21:55:30 +01:00
Just van Rossum
46a06cabf2
[ttLib.glyf] Make sure to use the flagOnCurve mask in glyph.draw() ( #1772 )
...
* When drawing glyf outlines to a pen, make sure to use the flagOnCurve mask, so we don't trip over the overlap flag, that is set when instantiating variable fonts to indicate that overlaps are ok.
Fixes #1771 .
2019-12-06 10:27:31 +01:00
Cosimo Lupo
c60512de0e
_g_l_y_f: use floatToFixedToStr and strToFixedToFloat in GlyphComponent toXML/fromXML
2019-10-08 13:40:06 +01:00
Chris Simpkins
791f619029
refactor array.tostring to array.tobytes
...
the array.tostring method is deprecated
2019-08-29 23:21:22 -04:00
Chris Simpkins
12814aa7b1
refactor array.fromstring to array.frombytes
...
fromstring is a deprecated array method
2019-08-29 22:58:42 -04:00
Just van Rossum
0ea19f3bd3
[ttLib] allow the glyf table to be incomplete when dumping to XML ( #1681 )
...
[ttLib] Allow the glyf table to be incomplete (to not contain everything from the glyph order) when writing to XML. This partially addresses #684 in that it will allow the font Ambrosia.otb to be dumped with ttx (but not recompiled). Log a warning when a glyph is not present.
2019-08-15 18:46:14 +02:00