1from __future__ import print_function, division, absolute_import 2from fontTools.misc.py23 import * 3from fontTools.pens.basePen import BasePen 4 5 6__all__ = ["QtPen"] 7 8 9class QtPen(BasePen): 10 11 def __init__(self, glyphSet, path=None): 12 BasePen.__init__(self, glyphSet) 13 if path is None: 14 from PyQt5.QtGui import QPainterPath 15 path = QPainterPath() 16 self.path = path 17 18 def _moveTo(self, p): 19 self.path.moveTo(*p) 20 21 def _lineTo(self, p): 22 self.path.lineTo(*p) 23 24 def _curveToOne(self, p1, p2, p3): 25 self.path.cubicTo(*p1+p2+p3) 26 27 def _qCurveToOne(self, p1, p2): 28 self.path.quadTo(*p1+p2) 29 30 def _closePath(self): 31 self.path.closeSubpath() 32