filterPen¶
-
class
fontTools.pens.filterPen.
FilterPen
(outPen)[source]¶ Base class for pens that apply some transformation to the coordinates they receive and pass them to another pen.
You can override any of its methods. The default implementation does nothing, but passes the commands unmodified to the other pen.
>>> from fontTools.pens.recordingPen import RecordingPen >>> rec = RecordingPen() >>> pen = FilterPen(rec) >>> v = iter(rec.value)
>>> pen.moveTo((0, 0)) >>> next(v) ('moveTo', ((0, 0),))
>>> pen.lineTo((1, 1)) >>> next(v) ('lineTo', ((1, 1),))
>>> pen.curveTo((2, 2), (3, 3), (4, 4)) >>> next(v) ('curveTo', ((2, 2), (3, 3), (4, 4)))
>>> pen.qCurveTo((5, 5), (6, 6), (7, 7), (8, 8)) >>> next(v) ('qCurveTo', ((5, 5), (6, 6), (7, 7), (8, 8)))
>>> pen.closePath() >>> next(v) ('closePath', ())
>>> pen.moveTo((9, 9)) >>> next(v) ('moveTo', ((9, 9),))
>>> pen.endPath() >>> next(v) ('endPath', ())
>>> pen.addComponent('foo', (1, 0, 0, 1, 0, 0)) >>> next(v) ('addComponent', ('foo', (1, 0, 0, 1, 0, 0)))