diff options
| author | Felipe Corrêa da Silva Sanches | 2015-09-28 12:40:00 -0300 |
|---|---|---|
| committer | Adrien Tétar | 2015-09-29 11:47:49 +0200 |
| commit | 51a80dc8ce5cb7f41111b2cbc3b0fb53f1966016 (patch) | |
| tree | dd1370ea2f9c29258d984ae937d7c9161a0c90d2 /Lib | |
| parent | 57aa7ed59d8e067717e965ef57f7f68a015fc2f3 (diff) | |
| download | trufont-51a80dc8ce5cb7f41111b2cbc3b0fb53f1966016.tar.bz2 | |
generating multiple paths when dealing with multiple components
Diffstat (limited to 'Lib')
| -rw-r--r-- | Lib/defconQt/glyphView.py | 5 | ||||
| -rw-r--r-- | Lib/defconQt/representationFactories/glyphViewFactory.py | 16 |
2 files changed, 13 insertions, 8 deletions
diff --git a/Lib/defconQt/glyphView.py b/Lib/defconQt/glyphView.py index 1e05a99..88073ae 100644 --- a/Lib/defconQt/glyphView.py +++ b/Lib/defconQt/glyphView.py @@ -1284,8 +1284,9 @@ class GlyphView(QGraphicsView): scene._outlineItem.setZValue(-995) scene._glyphObject = self._glyph # components - path = self._glyph.getRepresentation("defconQt.OnlyComponentsQPainterPath") - scene.addPath(path, brush=QBrush(componentFillColor)) + paths = self._glyph.getRepresentation("defconQt.OnlyComponentsQPainterPath") + for path in paths: + scene.addPath(path, brush=QBrush(componentFillColor)) def addPoints(self): scene = self.scene() diff --git a/Lib/defconQt/representationFactories/glyphViewFactory.py b/Lib/defconQt/representationFactories/glyphViewFactory.py index fe5183d..1b96cdc 100644 --- a/Lib/defconQt/representationFactories/glyphViewFactory.py +++ b/Lib/defconQt/representationFactories/glyphViewFactory.py @@ -29,15 +29,17 @@ class NoComponentsQtPen(QtPen): def OnlyComponentsQPainterPathFactory(glyph, font):
pen = OnlyComponentsQtPen(font)
glyph.draw(pen)
- pen.path.setFillRule(Qt.WindingFill)
- return pen.path
+ return pen.getData()
class OnlyComponentsQtPen(BasePen):
def __init__(self, glyphSet):
BasePen.__init__(self, glyphSet)
- self.pen = QtPen(glyphSet)
- self.path = self.pen.path
+ self._glyphSet = glyphSet
+ self.paths = []
+
+ def getData(self):
+ return self.paths
def _moveTo(self, p):
pass
@@ -57,9 +59,11 @@ class OnlyComponentsQtPen(BasePen): except KeyError:
return
else:
- tPen = TransformPen(self.pen, transformation)
+ pen = QtPen(self._glyphSet)
+ pen.path.setFillRule(Qt.WindingFill)
+ tPen = TransformPen(pen, transformation)
glyph.draw(tPen)
-
+ self.paths.append(pen.path)
# ----------
# point data
|
