summaryrefslogtreecommitdiff
path: root/misc/pylib/robofab/pens/quartzPen.py
blob: dd1947ccf1378a8ad97d8e3fc7fc73bf8d7aafb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from fontTools.pens.basePen import BasePen

class QuartzPen(BasePen):

	"""Pen to draw onto a Quartz drawing context (Carbon.CG)."""

	def __init__(self, glyphSet, quartzContext):
		BasePen.__init__(self, glyphSet)
		self._context = quartzContext

	def _moveTo(self, (x, y)):
		self._context.CGContextMoveToPoint(x, y)

	def _lineTo(self, (x, y)):
		self._context.CGContextAddLineToPoint(x, y)

	def _curveToOne(self, (x1, y1), (x2, y2), (x3, y3)):
		self._context.CGContextAddCurveToPoint(x1, y1, x2, y2, x3, y3)

	def _closePath(self):
		self._context.closePath()