1from fontTools.pens.basePen import BasePen 2 3 4__all__ = ["CocoaPen"] 5 6 7class CocoaPen(BasePen): 8 9 def __init__(self, glyphSet, path=None): 10 BasePen.__init__(self, glyphSet) 11 if path is None: 12 from AppKit import NSBezierPath 13 path = NSBezierPath.bezierPath() 14 self.path = path 15 16 def _moveTo(self, p): 17 self.path.moveToPoint_(p) 18 19 def _lineTo(self, p): 20 self.path.lineToPoint_(p) 21 22 def _curveToOne(self, p1, p2, p3): 23 self.path.curveToPoint_controlPoint1_controlPoint2_(p3, p1, p2) 24 25 def _closePath(self): 26 self.path.closePath() 27