With Qt, if you use QPainter.drawText() you can pass a string of characters you want to draw and coordinates of the bounding rect as argument. However when drawing a path with QPainter.drawPath() you can't just specify a bounding rect or coordinates the path should fit in.
Is there a built-in method of QPainterPath to make it fit inside a bounding rect or coordinates? Or do I have to program the appropriate translation and scaling manually?
Also, how do I create a QPixmap from a QPainterPath of a given size?
What I'm trying to do: I have a font object which hosts vector coordinates and would like to draw its glyphs. I already have a function that creates a QPainterPath() from the Font object. It's for a font editor.
Thanks for stepping-by.
Well, answering myself for the first part of the question: it's not the path that should be changed but the painter, you can save its state then translate,scale it etc... then draw your path and restore its state afterwards. E.g.:
painter.save()
painter.translate(0,-self.squareSize)
painter.scale(factor, -factor)
painter.fillPath(glyph, Qt.black)
painter.restore()