Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
4.8.0
-
None
-
Windows
Description
Try this on Windows, assuming font is a QFont and device a QPaintDevice:
QPainter painter(device);
QTransform matrix(0.5, 0, 0, 0.5, 0, 0);
painter.setWorldTransform(matrix);
QStaticText staticText("test");
painter.drawStaticText(QPoint(300, 300), staticText);
If font is a TrueType font, it works correctly. Change font to a type 1 font and it draws the text in the wrong place.
This seems to be caused by commit 243535036078fec14bc460ccf41708ff14878797 which was made to fix QTBUG-19086. Previously QRasterPaintEngine::drawStaticTextItem would only use the font's pixel size to determine whether transformations should be allowed. Now it calls supportsTransformation(QFontEngine*), which also includes the Windows-specific logic that used to be specific to drawTextItem. But when a similar test is done higher up in QPainter::drawStaticText, it calls the weaker version of supportsTransformation that only uses the pixel size and the matrix, and so doesn't include this Windows-only special case. This asymmetry means that in the case of type 1 fonts (and probably other cases) the positioning ends up incorrect.