pointPen

PointPens

Where SegmentPens have an intuitive approach to drawing (if you’re familiar with postscript anyway), the PointPen is geared towards accessing all the data in the contours of the glyph. A PointsPen has a very simple interface, it just steps through all the points in a call from glyph.drawPoints(). This allows the caller to provide more data for each point. For instance, whether or not a point is smooth, and its name.

class ufoLib.pointPen.AbstractPointPen[source]

Baseclass for all PointPens.

addComponent(baseGlyphName, transformation, identifier=None, **kwargs)[source]

Add a sub glyph.

addPoint(pt, segmentType=None, smooth=False, name=None, identifier=None, **kwargs)[source]

Add a point to the current sub path.

beginPath(identifier=None, **kwargs)[source]

Start a new sub path.

endPath()[source]

End the current sub path.

class ufoLib.pointPen.BasePointToSegmentPen[source]

Base class for retrieving the outline in a segment-oriented way. The PointPen protocol is simple yet also a little tricky, so when you need an outline presented as segments but you have as points, do use this base implementation as it properly takes care of all the edge cases.

addComponent(baseGlyphName, transformation, identifier=None, **kwargs)

Add a sub glyph.

class ufoLib.pointPen.PointToSegmentPen(segmentPen, outputImpliedClosingLine=False)[source]

Adapter class that converts the PointPen protocol to the (Segment)Pen protocol.

class ufoLib.pointPen.SegmentToPointPen(pointPen, guessSmooth=True)[source]

Adapter class that converts the (Segment)Pen protocol to the PointPen protocol.