fixed incorrect outline for small-caps

This commit is contained in:
tassaron 2017-08-08 20:53:51 -04:00
parent 4d0daa4336
commit 3ed84e1c3e
1 changed files with 12 additions and 3 deletions

View File

@ -146,7 +146,18 @@ class Component(Component):
outliner = QtGui.QPainterPathStroker()
outliner.setWidth(self.stroke)
path = QtGui.QPainterPath()
path.addText(x, y, font, self.title)
if self.fontStyle == 6:
# PathStroker ignores smallcaps so we need this weird hack
path.addText(x, y, font, self.title[0])
fm = QtGui.QFontMetrics(font)
newX = x + fm.width(self.title[0])
strokeFont = self.page.fontComboBox_titleFont.currentFont()
strokeFont.setCapitalization(QFont.SmallCaps)
strokeFont.setPixelSize(int((self.fontSize / 7) * 5))
strokeFont.setLetterSpacing(QFont.PercentageSpacing, 139)
path.addText(newX, y, strokeFont, self.title[1:])
else:
path.addText(x, y, font, self.title)
path = outliner.createStroke(path)
image.setPen(QtCore.Qt.NoPen)
image.setBrush(PaintColor(*self.strokeColor))
@ -167,8 +178,6 @@ class Component(Component):
return frame
def commandHelp(self):
print('Enter a string to use as centred white text:')
print(' "title=User Error"')