wxPen.py 680 B

1234567891011121314151617181920212223242526272829
  1. from fontTools.pens.basePen import BasePen
  2. __all__ = ["WxPen"]
  3. class WxPen(BasePen):
  4. def __init__(self, glyphSet, path=None):
  5. BasePen.__init__(self, glyphSet)
  6. if path is None:
  7. import wx
  8. path = wx.GraphicsRenderer.GetDefaultRenderer().CreatePath()
  9. self.path = path
  10. def _moveTo(self, p):
  11. self.path.MoveToPoint(*p)
  12. def _lineTo(self, p):
  13. self.path.AddLineToPoint(*p)
  14. def _curveToOne(self, p1, p2, p3):
  15. self.path.AddCurveToPoint(*p1 + p2 + p3)
  16. def _qCurveToOne(self, p1, p2):
  17. self.path.AddQuadCurveToPoint(*p1 + p2)
  18. def _closePath(self):
  19. self.path.CloseSubpath()