cocoaPen.py 612 B

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