marginPen

class robofab.pens.marginPen.MarginPen(glyphSet, value, isHorizontal=True)
Pen to calculate the margins at a given value.
When isHorizontal is True, the margins at <value> are horizontal. When isHorizontal is False, the margins at <value> are vertical.

When a glyphset or font is given, MarginPen will also calculate for glyphs with components.

pen.getMargins() returns the minimum and maximum intersections of the glyph. pen.getContourMargins() returns the minimum and maximum intersections for each contour.

Possible optimisation: Initialise the pen object with a list of points we want to measure, then draw the glyph once, but do the splitLine() math for all measure points.

getMargins()

Get the horizontal margins for all contours combined, i.e. the whole glyph.

getContourMargins()

Get the horizontal margins for each contour.

getAll()

Get all the slices.