boundsPen

class fontTools.pens.boundsPen.ControlBoundsPen(glyphSet)

Bases: fontTools.pens.basePen.BasePen

Pen to calculate the “control bounds” of a shape. This is the bounding box of all control points, so may be larger than the actual bounding box if there are curves that don’t have points on their extremes.

When the shape has been drawn, the bounds are available as the ‘bounds’ attribute of the pen object. It’s a 4-tuple:

(xMin, yMin, xMax, yMax)
_moveTo(pt)
_lineTo(pt)
_curveToOne(bcp1, bcp2, pt)
_qCurveToOne(bcp, pt)
class fontTools.pens.boundsPen.BoundsPen(glyphSet)

Bases: fontTools.pens.boundsPen.ControlBoundsPen

Pen to calculate the bounds of a shape. It calculates the correct bounds even when the shape contains curves that don’t have points on their extremes. This is somewhat slower to compute than the “control bounds”.

When the shape has been drawn, the bounds are available as the ‘bounds’ attribute of the pen object. It’s a 4-tuple:

(xMin, yMin, xMax, yMax)
_curveToOne(bcp1, bcp2, pt)
_qCurveToOne(bcp, pt)