# qu2cu: Convert quadratic curves to cubic

## Overview

Routines for converting quadratic curves to cubic splines, suitable for use in TrueType to CFF-flavored OpenType outline conversion.

The basic curve conversion routines are implemented in the `fontTools.qu2cu.qu2cu` module.

Note

The redundancy in the module name is a workaround made made necessary by `fontTools.qu2cu`’s usage of Cython. Providing Cython support for the module enables faster execution on systems where Cython is available. However, the module remains fully available on systems without Cython, too.

qu2cu also includes a submodule that implements the `fonttools qu2cu` command for converting a UFO format font with quadratic curves into one with cubic curves:

> - cli: Quadratic-to-cubic converter command-line tool

> ## Package contents

fontTools.qu2cu.qu2cu.quadratic_to_curves(list quads: List[List[Point]], double max_err: float = 0.5, all_cubic: bool = False) → List[Tuple[Point, ...]]

  Converts a connecting list of quadratic splines to a list of quadratic and cubic curves.

  A quadratic spline is specified as a list of points. Either each point is a 2-tuple of X,Y coordinates, or each point is a complex number with real/imaginary components representing X,Y coordinates.

  The first and last points are on-curve points and the rest are off-curve points, with an implied on-curve point in the middle between every two consequtive off-curve points.

  Returns:

    The output is a list of tuples of points. Points are represented in the same format as the input, either as 2-tuples or complex numbers.

    Each tuple is either of length three, for a quadratic curve, or four, for a cubic curve. Each curve’s last point is the same as the next curve’s first point.

  Parameters:

    - quads – quadratic splines

    - max_err – absolute error tolerance; defaults to 0.5

    - all_cubic – if True, only cubic curves are generated; defaults to False