jvr | e028b38 | 2003-08-26 18:20:27 +0000 | [diff] [blame^] | 1 | from fontTools.pens.basePen import BasePen |
| 2 | |
| 3 | |
| 4 | __all__ = ["CocoaPen"] |
| 5 | |
| 6 | |
| 7 | class 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, (x, y)): |
| 17 | self.path.moveToPoint_((x, y)) |
| 18 | |
| 19 | def _lineTo(self, (x, y)): |
| 20 | self.path.lineToPoint_((x, y)) |
| 21 | |
| 22 | def _curveToOne(self, (x1, y1), (x2, y2), (x3, y3)): |
| 23 | self.path.curveToPoint_controlPoint1_controlPoint2_((x3, y3), (x1, y1), (x2, y2)) |
| 24 | |
| 25 | def _closePath(self): |
| 26 | self.path.closePath() |