aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortassaron2017-08-08 20:53:51 -0400
committertassaron2017-08-08 20:53:51 -0400
commit3ed84e1c3edba46fe8990544ef7e58fe8e3dd901 (patch)
treeff42649ca2e66a49a534d70a210a6e1f7d785fb8 /src
parent4d0daa4336432948ba6543d4becaaa42425ecafd (diff)
fixed incorrect outline for small-caps
Diffstat (limited to 'src')
-rw-r--r--src/components/text.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/components/text.py b/src/components/text.py
index f6bd17d..4d4f5d3 100644
--- a/src/components/text.py
+++ b/src/components/text.py
@@ -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"')