Hello,

When I add to the Scene some rectangles and texts, rectangles are perfect,
but text are too big.

If I add a QGraphicsSimpleTextItem with a font_size of 40, it will display
bigger than the same text/font/size if I draw it in inkscape (or anywhere
else).
Seems that I have to scale with a ratio of 0.75 to get a correct size.

What am I doing wrong ?

here is my sample (I also attach a png with a text in Norasi with a size of
40):

 from PyQt4 import QtGui

import sys

app = QtGui.QApplication(sys.argv)

scene = QtGui.QGraphicsScene(0, 0, 400, 400)

scene.addSimpleText('HELLO 1', QtGui.QFont('Norasi', 40))

t = scene.addSimpleText('HELLO 2', QtGui.QFont('Norasi', 40))

t.setY(100)

t.scale(.75, .75)

view = QtGui.QGraphicsView(scene)

view.setRenderHint(QtGui.QPainter.Antialiasing)

view.setViewportUpdateMode(QtGui.QGraphicsView.BoundingRectViewportUpdate)

view.show()

sys.exit(app.exec_())

<<attachment: text2985.png>>

#!/usr/bin/env python

from PyQt4 import QtGui

import sys

app = QtGui.QApplication(sys.argv)

scene = QtGui.QGraphicsScene(0, 0, 400, 400)
scene.addSimpleText('HELLO 1', QtGui.QFont('Norasi', 40))
t = scene.addSimpleText('HELLO 2', QtGui.QFont('Norasi', 40))
t.setY(100)
t.scale(.75, .75)

view = QtGui.QGraphicsView(scene)
view.setRenderHint(QtGui.QPainter.Antialiasing)
view.setViewportUpdateMode(QtGui.QGraphicsView.BoundingRectViewportUpdate)
view.show()

sys.exit(app.exec_())
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to