mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
more pyqt float->int goodness
This commit is contained in:
parent
3a83e75401
commit
886ba135b5
@ -79,8 +79,8 @@ class FontLoader:
|
|||||||
rfont = self.cache[font]
|
rfont = self.cache[font]
|
||||||
else:
|
else:
|
||||||
italic = font[2] == QFont.Style.StyleItalic
|
italic = font[2] == QFont.Style.StyleItalic
|
||||||
rfont = QFont(font[0], font[3], font[1], italic)
|
rfont = QFont(font[0], int(font[3]), int(font[1]), italic)
|
||||||
rfont.setPixelSize(font[3])
|
rfont.setPixelSize(int(font[3]))
|
||||||
rfont.setBold(wt>=69)
|
rfont.setBold(wt>=69)
|
||||||
self.cache[font] = rfont
|
self.cache[font] = rfont
|
||||||
qfont = rfont
|
qfont = rfont
|
||||||
@ -508,18 +508,18 @@ class Line(QGraphicsItem):
|
|||||||
painter.save()
|
painter.save()
|
||||||
painter.setPen(QPen(Qt.PenStyle.NoPen))
|
painter.setPen(QPen(Qt.PenStyle.NoPen))
|
||||||
painter.setBrush(QBrush(Qt.GlobalColor.yellow))
|
painter.setBrush(QBrush(Qt.GlobalColor.yellow))
|
||||||
painter.drawRect(x, 0, tok.width, tok.height)
|
painter.drawRect(int(x), 0, tok.width, tok.height)
|
||||||
painter.restore()
|
painter.restore()
|
||||||
painter.setPen(QPen(tok.text_color))
|
painter.setPen(QPen(tok.text_color))
|
||||||
if tok.valign is None:
|
if tok.valign is None:
|
||||||
painter.drawText(x, y, tok.string)
|
painter.drawText(int(x), int(y), tok.string)
|
||||||
elif tok.valign == 'Sub':
|
elif tok.valign == 'Sub':
|
||||||
painter.drawText(x+1, y+self.descent/1.5, tok.string)
|
painter.drawText(int(x+1), int(y+self.descent/1.5), tok.string)
|
||||||
elif tok.valign == 'Sup':
|
elif tok.valign == 'Sup':
|
||||||
painter.drawText(x+1, y-2.*self.descent, tok.string)
|
painter.drawText(int(x+1), int(y-2.*self.descent), tok.string)
|
||||||
x += tok.width
|
x += tok.width
|
||||||
else:
|
else:
|
||||||
painter.drawPixmap(x, 0, tok.pixmap())
|
painter.drawPixmap(int(x), 0, tok.pixmap())
|
||||||
x += tok.width
|
x += tok.width
|
||||||
painter.restore()
|
painter.restore()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user