| 1 |
######################################## |
| 2 |
cu2qu: Convert cubic curves to quadratic |
| 3 |
######################################## |
| 4 |
|
| 5 |
Routines for converting cubic curves to quadratic splines, suitable for use |
| 6 |
in OpenType to TrueType outline conversion. |
| 7 |
|
| 8 |
Conversion is carried out to a degree of tolerance provided by the user. While |
| 9 |
it is relatively easy to find the best *single* quadratic curve to represent a |
| 10 |
given cubic (see for example `this method from CAGD <https://www.sirver.net/blog/2011/08/23/degree-reduction-of-bezier-curves/>`_), |
| 11 |
the best-fit method may not be sufficiently accurate for type design. |
| 12 |
|
| 13 |
Instead, this method chops the cubic curve into multiple segments before |
| 14 |
converting each cubic segment to a quadratic, in order to ensure that the |
| 15 |
resulting spline fits within the given tolerance. |
| 16 |
|
| 17 |
The basic curve conversion routines are implemented in the |
| 18 |
:mod:`fontTools.cu2qu.cu2qu` module; the :mod:`fontTools.cu2qu.ufo` module |
| 19 |
applies these routines to all of the curves in a UFO file or files; while the |
| 20 |
:mod:`fontTools.cu2qu.cli` module implements the ``fonttools cu2qu`` command |
| 21 |
for converting a UFO format font with cubic curves into one with quadratic |
| 22 |
curves. |
| 23 |
|
| 24 |
fontTools.cu2qu.cu2qu |
| 25 |
--------------------- |
| 26 |
|
| 27 |
.. automodule:: fontTools.cu2qu.cu2qu |
| 28 |
:inherited-members: |
| 29 |
:members: |
| 30 |
:undoc-members: |
| 31 |
|
| 32 |
fontTools.cu2qu.ufo |
| 33 |
------------------- |
| 34 |
|
| 35 |
.. automodule:: fontTools.cu2qu.ufo |
| 36 |
:inherited-members: |
| 37 |
:members: |
| 38 |
:undoc-members: |