1from __future__ import print_function, division, absolute_import 2from fontTools.misc.py23 import * 3from fontTools.pens.basePen import BasePen 4 5 6__all__ = ["WxPen"] 7 8 9class WxPen(BasePen): 10 11 def __init__(self, glyphSet, path=None): 12 BasePen.__init__(self, glyphSet) 13 if path is None: 14 import wx 15 path = wx.GraphicsRenderer.GetDefaultRenderer().CreatePath() 16 self.path = path 17 18 def _moveTo(self, p): 19 self.path.MoveToPoint(*p) 20 21 def _lineTo(self, p): 22 self.path.AddLineToPoint(*p) 23 24 def _curveToOne(self, p1, p2, p3): 25 self.path.AddCurveToPoint(*p1+p2+p3) 26 27 def _qCurveToOne(self, p1, p2): 28 self.path.AddQuadCurveToPoint(*p1+p2) 29 30 def _closePath(self): 31 self.path.CloseSubpath() 32