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