boundsPen

class ControlBoundsPen(glyphSet)

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

Single points, or anchors, are ignored.

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)

This replaces fontTools/pens/boundsPen (temporarily?) The fontTools bounds pen takes lose anchor points into account, this one doesn’t.

class BoundsPen(glyphSet)

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)

links