diff options
Diffstat (limited to 'misc/pylib/robofab/pens/quartzPen.py')
-rw-r--r-- | misc/pylib/robofab/pens/quartzPen.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/misc/pylib/robofab/pens/quartzPen.py b/misc/pylib/robofab/pens/quartzPen.py new file mode 100644 index 000000000..dd1947ccf --- /dev/null +++ b/misc/pylib/robofab/pens/quartzPen.py @@ -0,0 +1,21 @@ +from fontTools.pens.basePen import BasePen + +class QuartzPen(BasePen): + + """Pen to draw onto a Quartz drawing context (Carbon.CG).""" + + def __init__(self, glyphSet, quartzContext): + BasePen.__init__(self, glyphSet) + self._context = quartzContext + + def _moveTo(self, (x, y)): + self._context.CGContextMoveToPoint(x, y) + + def _lineTo(self, (x, y)): + self._context.CGContextAddLineToPoint(x, y) + + def _curveToOne(self, (x1, y1), (x2, y2), (x3, y3)): + self._context.CGContextAddCurveToPoint(x1, y1, x2, y2, x3, y3) + + def _closePath(self): + self._context.closePath() |