82 Commits

Author SHA1 Message Date
Behdad Esfahbod
2ce45c2861 [bezierTools] Fix infinite-recursion in calcCubicArcLength
Fixes https://github.com/fonttools/fonttools/issues/3502
2024-05-07 08:54:42 -07:00
Simon Cozens
b5ddc99fb9
linelike intersections (#3353)
* Replace linelike intersections with line-curve/line-line tests, fixes #3352

* Tests for #3352
2023-11-27 17:27:28 +00:00
Cosimo Lupo
21dea1e18d fix incorrectly typed cython local variable
Fixes https://github.com/fonttools/fonttools/issues/3287
2023-10-06 10:10:46 +01:00
Behdad Esfahbod
7fd3f7632e [bezierTools] Remove division hack 2023-04-22 12:50:25 -06:00
Behdad Esfahbod
dc60198f78 [bezierTools] Micro-optimize cython 2023-04-22 12:49:22 -06:00
Behdad Esfahbod
14a767719b [bezierTools] Add link to algorithm
https://github.com/fonttools/fonttools/issues/3055
2023-03-21 13:30:30 -06:00
Cosimo Lupo
0df4997661
prevent cython.compiled raise AttributeError if cython not properly installed
It's possible sometimes that 'import cython' does not fail but then 'cython.compiled' raises AttributeError.
It actually happened in our internal production environment...

Similar issue to https://github.com/pydantic/pydantic/pull/573 and https://github.com/ipython/ipython/issues/13294
2023-03-02 17:43:38 +00:00
Behdad Esfahbod
c1d1386e2c Add a few more cython annotations 2023-02-20 13:54:35 -07:00
Behdad Esfahbod
822f7a01da [bezier] Make splitCubicAtTC into a generator 2023-02-18 09:46:56 -07:00
Behdad Esfahbod
c4e3322b20 [bezier] Add a few more complex versions of functions 2023-02-18 09:46:56 -07:00
Behdad Esfahbod
fd46f25ffb [bezier] Add splitCubicIntoTwoAtTC 2023-02-18 09:46:56 -07:00
Behdad Esfahbod
cce99f00f7 [bezier] Internal variable rename 2023-02-18 09:46:56 -07:00
Behdad Esfahbod
86c67a17b2 [bezier] Add Cython annotations 2023-02-18 09:46:56 -07:00
Behdad Esfahbod
39b6f7a752 [bezier] Speed up cubicPointAtT 2023-02-18 09:46:56 -07:00
Behdad Esfahbod
8dde7fef90 [bezier] Add cubicPointAtTC 2023-02-18 09:46:56 -07:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Simon Cozens
54e307ea6c Fix docTests 2021-09-23 08:20:51 +01:00
Simon Cozens
ed0cf2fa92 Typo 2021-09-23 08:10:00 +01:00
Simon Cozens
13f6cbdaba Fix doctests 2021-09-22 16:41:02 +01:00
Simon Cozens
1cc8bf0827 Fix two problems when handling orthogonal lines 2021-09-22 16:28:10 +01: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
6a8821d91c
Revert "Use Vector in some places where it improves the clarity of the code" (#2215)
* Revert most of "Use Vector in some places where it improves the clarity of the code (#2206)"

This reverts most of commit 0d3ce2cafc6f604fc46d4d3bfbab34a5bc59e27b.
2021-03-04 20:15:24 +01:00
Just van Rossum
0d3ce2cafc
Use Vector in some places where it improves the clarity of the code (#2206)
* Use Vector in some places where it improves the clarity of the code

* add __all__ to vector.py

* turned some list comprehensions into generator expressions: there's no need for an intermediate list in these cases

* Add empty __slots__ to Vector, so we don't waste space on a __dict__.

* add some tests for segmentPointAtT
2021-03-04 15:32:45 +01:00
Simon Cozens
a775b6e19c Fix _aligment_transformation as suggested 2021-02-26 13:13:59 +00:00
Simon Cozens
60c1ee0107 Black whole module 2021-02-26 10:03:37 +00:00
Simon Cozens
1a3478da0e Fixes from review 2021-02-26 10:03:32 +00:00
Simon Cozens
2ef7964e90 If we swapped the segments, we must swap them back when returning results 2021-02-18 22:12:20 +00:00
Simon Cozens
1795ee98b2 Address various feedback 2021-02-18 14:54:27 +00:00
Simon Cozens
fdceeee0c6 Unnecessary parens 2021-02-18 11:39:46 +00:00
Simon Cozens
c082616c6f Make hacky uniquifying thing more explicit 2021-02-18 11:39:36 +00:00
Simon Cozens
80a3227f44 Raise error in unknown curve degrees 2021-02-18 11:39:01 +00:00
Simon Cozens
6a223e5f93 Rename parameters 2021-02-18 11:38:40 +00:00
Simon Cozens
2e211194c8 No harm in handling all segment types here 2021-02-18 11:23:24 +00:00
Simon Cozens
c17b1c9e9f Oops, this has a different interface to the curve-based ones 2021-02-18 11:20:45 +00:00
Simon Cozens
01957a9b94 Intersection and point-at-time functions from beziers.py 2021-02-18 10:49:52 +00:00
justvanrossum
186032cb10 fixed formatting 2020-11-09 15:39:21 +01:00
Simon Cozens
76902b7129
[docs] fontTools.misc.* part 1 (#1956)
* Document misc.arrayTools
* Document misc.bezierTools
* Document cliTools
* Document eexec
2020-05-19 09:51:17 +01:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Behdad Esfahbod
2d4e76ff0b [bezierTools] Add calcCubicArcLength() and calcCubicArcLengthC()
Fixes https://github.com/fonttools/fonttools/issues/1142
2018-01-09 11:33:57 +01:00
Behdad Esfahbod
f7312fc9d0 [misc.bezierTools] Slightly improve previous commit
Part of https://github.com/fonttools/fonttools/issues/1142
2018-01-08 13:43:45 +00:00
Behdad Esfahbod
5dd888da1d [misc.bezierTools] Implement cusp loop for calcQuadraticArcLength()
Part of https://github.com/fonttools/fonttools/issues/1142
2018-01-08 13:41:27 +00:00
Behdad Esfahbod
fe5a2ea870 [misc.bezierTools] Remove approximate_fallback arg from calcQuadraticArcLength()
Part of https://github.com/fonttools/fonttools/issues/1142
2018-01-08 13:41:27 +00:00
Jens Kutilek
dd558f5df8 Move arc length calculations from pens.perimeterPen to misc.bezierTools 2017-11-14 13:03:58 +01:00
Cosimo Lupo
25aad9041d minor: fix doctest failing on latest pypy
Expected:
    [-0.0, -0.0, -0.0]
Got:
    [0.0, 0.0, 0.0]
2017-07-24 16:47:07 +01:00
Behdad Esfahbod
8701fedcfe More solveCubic() hardening
It really should be quite solid this time. :-)
2016-08-13 16:29:49 -07:00
Behdad Esfahbod
5bea5f4fd6 Remove unused line 2016-08-13 16:25:09 -07:00
Behdad Esfahbod
ca7f8d8808 Harden solveCubic() some more
Fixes https://github.com/behdad/fonttools/issues/617#issuecomment-239146815
2016-08-12 22:43:20 -07:00
Behdad Esfahbod
02b415c237 [bezierTools] Speed up a bit 2016-07-29 14:40:10 -07:00
Behdad Esfahbod
d96e246532 Make solveCubic() more robust
Fixes https://github.com/behdad/fonttools/issues/621#issuecomment-226671968
2016-07-19 22:50:09 -07:00
Behdad Esfahbod
10aaac53f2 Fix test 2016-07-16 21:58:41 -07:00