cu2quPen
- class fontTools.pens.cu2quPen.Cu2QuPen(other_pen, max_err, reverse_direction=False, stats=None, all_quadratic=True)[source]
Bases:
FilterPen
A filter pen to convert cubic bezier curves to quadratic b-splines using the FontTools SegmentPen protocol.
- Parameters:
other_pen – another SegmentPen used to draw the transformed outline.
max_err – maximum approximation error in font units. For optimal results, if you know the UPEM of the font, we recommend setting this to a value equal, or close to UPEM / 1000.
reverse_direction – flip the contours’ direction but keep starting point.
stats – a dictionary counting the point numbers of quadratic segments.
all_quadratic – if True (default), only quadratic b-splines are generated. if False, quadratic curves or cubic curves are generated depending on which one is more economical.
- class fontTools.pens.cu2quPen.Cu2QuPointPen(other_point_pen, max_err, reverse_direction=False, stats=None, all_quadratic=True)[source]
Bases:
BasePointToSegmentPen
A filter pen to convert cubic bezier curves to quadratic b-splines using the FontTools PointPen protocol.
- Parameters:
other_point_pen – another PointPen used to draw the transformed outline.
max_err – maximum approximation error in font units. For optimal results, if you know the UPEM of the font, we recommend setting this to a value equal, or close to UPEM / 1000.
reverse_direction – reverse the winding direction of all contours.
stats – a dictionary counting the point numbers of quadratic segments.
all_quadratic – if True (default), only quadratic b-splines are generated. if False, quadratic curves or cubic curves are generated depending on which one is more economical.
- class fontTools.pens.cu2quPen.Cu2QuMultiPen(other_pens, max_err, reverse_direction=False)[source]
Bases:
object
A filter multi-pen to convert cubic bezier curves to quadratic b-splines in a interpolation-compatible manner, using the FontTools SegmentPen protocol.
- Parameters:
other_pens – list of SegmentPens used to draw the transformed outlines.
max_err – maximum approximation error in font units. For optimal results, if you know the UPEM of the font, we recommend setting this to a value equal, or close to UPEM / 1000.
reverse_direction – flip the contours’ direction but keep starting point.
This pen does not follow the normal SegmentPen protocol. Instead, its moveTo/lineTo/qCurveTo/curveTo methods take a list of tuples that are arguments that would normally be passed to a SegmentPen, one item for each of the pens in other_pens.