diff options
| author | Martin Kaistra | 2017-04-22 11:06:07 +0200 |
|---|---|---|
| committer | Martin Kaistra | 2017-04-22 11:06:07 +0200 |
| commit | 01de150f7401a3f2640999298f9b6f1c0c7a101a (patch) | |
| tree | 98acf4390fab3debe8ce8c53a238e468cf50e2de /core.py | |
| parent | 19cf45785461ffd44c8bdec7ae4634bf828e75ed (diff) | |
| parent | 23ba08397fba9641d239b70ff397f9e3e10f53c0 (diff) | |
Merge branch 'HunterwolfAT-font-settings#8'
Diffstat (limited to 'core.py')
| -rw-r--r-- | core.py | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -26,7 +26,7 @@ class Core(): except: return "avconv" - def drawBaseImage(self, backgroundImage, titleText, titleFont): + def drawBaseImage(self, backgroundImage, titleText, titleFont, fontSize, alignment, xOffset, yOffset): if self._image == None or not self.lastBackgroundImage == backgroundImage: self.lastBackgroundImage = backgroundImage @@ -45,11 +45,20 @@ class Core(): self._image1 = QtGui.QImage(self._image) painter = QPainter(self._image1) font = titleFont - font.setPointSizeF(35) + font.setPointSizeF(fontSize) painter.setFont(font) painter.setPen(QColor(255, 255, 255)) - painter.drawText(70, 375, titleText) + yPosition = yOffset + + fm = QtGui.QFontMetrics(font) + if alignment == 0: #Left + xPosition = xOffset + if alignment == 1: #Middle + xPosition = xOffset - fm.width(titleText)/2 + if alignment == 2: #Right + xPosition = xOffset - fm.width(titleText) + painter.drawText(xPosition, yPosition, titleText) painter.end() buffer = QtCore.QBuffer() |
