2008-01-07 17:40:34 +00:00
|
|
|
from fontTools.pens.basePen import BasePen
|
|
|
|
|
|
|
|
class QuartzPen(BasePen):
|
|
|
|
|
2011-10-20 16:27:06 +00:00
|
|
|
"""Pen to draw onto a Quartz drawing context (Carbon.CG).
|
|
|
|
|
|
|
|
- OSX specific.
|
|
|
|
|
|
|
|
"""
|
2008-01-07 17:40:34 +00:00
|
|
|
|
|
|
|
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()
|