36 Commits

Author SHA1 Message Date
Behdad Esfahbod
4ae0a93692 black
I'm sorry.
2023-06-27 08:49:31 -06:00
Behdad Esfahbod
9983ffe27a [cubic-glyf] Fix tests
Ouch.
2023-06-27 08:47:56 -06:00
Cosimo Lupo
4298c28e3c
add 2nd test contour to expose bug in dropImpliedOnCurvePoints
there's a bug whereby we don't correctly drop impliable oncurve if it occurs on the first point of the second contour.. because we forgot to update the contour start = last + 1...
2023-06-06 17:00:16 +01:00
Cosimo Lupo
5b93100616
also check endPtsOfContours in dropImpliedOnCurvePoints
as per review https://github.com/fonttools/fonttools/pull/3147#discussion_r1214708207

Also, don't do same work multiple times when dropping points from flags/endPtsOfContours arrays since these are supposed to be the same for all interpolatable glyphs
2023-06-05 12:11:17 +01:00
Cosimo Lupo
6a276d9f6a
dropImpliedOnCurvePoints: raise if incompatible, skip empty/composites 2023-06-02 13:51:28 +01:00
Cosimo Lupo
a039e1dda8
_g_l_y_f_test: add tests for dropImpliedOnCurvePoints 2023-06-01 19:27:32 +01:00
Behdad Esfahbod
a99e130b26 [Tests] Silence a few deprecation warnings 2023-05-24 14:38:41 -06:00
Jens Kutilek
85c80be6b6
Fix missing composite instructions in ttx (#3092)
* Fix calculation of haveInstructions
* Add test
2023-04-25 16:21:24 +02:00
Behdad Esfahbod
568dd0c5d4 [glyf] Support and test cubic spline 2023-02-21 13:01:49 -07:00
Behdad Esfahbod
0a0b152c33 [glyf] Support, and add test for, all-offcurve cubic contour 2023-02-21 13:01:49 -07:00
Behdad Esfahbod
77e96bdcd9 [glyf_test] Add cubic test 2023-02-21 13:01:49 -07:00
Behdad Esfahbod
b7deb93647 Move VarComposite roundtrip tests to glyf_test 2023-02-06 11:09:11 -07:00
Behdad Esfahbod
4c201b9a42 [glyf/VarComposite] Implement padding trimming 2023-02-06 11:00:05 -07:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Eigi
20c4a3ce74 test if issue #2295 is fixed 2021-05-13 09:58:53 +01: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
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
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
183792c747
_g_l_y_f_test: add tests for Glyph.getCoordinates and GlyphComponent.to/fromXML 2020-02-13 18:08:38 +00:00
Cosimo Lupo
92e770ea16
_g_l_y_f_test: add tests for compiling/decompiling empty glyf table 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
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
c6006a7f8c [glyf] remove_hinting should del program from composite glyph
Unlike simple glyphs, which always have 'program' attribute (even when empty, with no instructions)
in composite glyphs, it's the presence of 'program' attribute that determines whether
the optional WE_HAVE_INSTRUCTIONS component flag is set or not.
Thus, the trim method (with remove_hinting=True) should delete the attribute for
composite glyphs.

Fixes https://github.com/fonttools/fonttools/issues/1550
2019-03-21 12:16:54 +00:00
justvanrossum
12ec7f539e improve error message 2019-03-17 15:35:35 +01:00
justvanrossum
ac2413e905 [ttLib/glyf] raise TTLibError with the offending glyph name in the error message when a component (indirectly) references itself 2019-03-17 15:30:20 +01:00
Jens Kutilek
7c8077a63d Add glyf flags bit6 to ttx output (#1316)
* Implement glyf outline flags bit 6 when decompiling/compiling

* Add test data for outline flag bit 6

* Rename flags, use bitwise OR for setting flag bit

* Remove unneeded code
2018-09-14 15:27:32 +02:00
Cosimo Lupo
0337fc92fc
Tests: adjust to use new otRound function 2018-06-14 17:49:37 +01:00
Cosimo Lupo
d9f7a26027
_g_l_y_f_test: test _checkFloat upgrades to double when overflowing short int 2018-06-07 15:40:50 +01:00
Behdad Esfahbod
af041259ee Fix tests for recent changes 2017-05-18 16:06:10 -07:00
Cosimo Lupo
1c9198e3f0
[_g_l_y_f] add test for GlyphCoordinates' float precision loss issue (#964) 2017-05-16 10:34:37 +01:00
Cosimo Lupo
7fe876a803
[minor] remove semicolons 2017-04-10 11:57:13 +01:00
Behdad Esfahbod
fdbf066a8c [glyf] Add __bool__ / __nonzero__ to GlyphCoordintes
I'm really unhappy that doctests do NOT work anymore :(.
2017-04-05 15:43:14 +02:00
Cosimo Lupo
4ef3f1dd42
[Tests] convert GlyphCoordinates doctests into _g_l_y_f_test.py 2017-01-17 13:39:37 +00:00