fonttools/Lib/fontTools/pens/cocoaPen.py
jvr e028b38340 new Cocoa=specific drawing pen
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@429 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-26 18:20:27 +00:00

27 lines
593 B
Python

from fontTools.pens.basePen import BasePen
__all__ = ["CocoaPen"]
class CocoaPen(BasePen):
def __init__(self, glyphSet, path=None):
BasePen.__init__(self, glyphSet)
if path is None:
from AppKit import NSBezierPath
path = NSBezierPath.bezierPath()
self.path = path
def _moveTo(self, (x, y)):
self.path.moveToPoint_((x, y))
def _lineTo(self, (x, y)):
self.path.lineToPoint_((x, y))
def _curveToOne(self, (x1, y1), (x2, y2), (x3, y3)):
self.path.curveToPoint_controlPoint1_controlPoint2_((x3, y3), (x1, y1), (x2, y2))
def _closePath(self):
self.path.closePath()