Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
4.7.3, 5.0.0 Beta 1, 5.1.0 RC1
-
Windows 7 x64
Description
On Windows only, the spacing between characters is often incorrect when using QPainter::drawText with a rotated QPainter. In the test application below, the drawn strings should be identical except for a small, almost unnoticeable rotation. As it is, it is clear that the spacing between the "w"'s and "i"'s is way off.
main.cpp
#include <QtGui> #include <QFont> class MyWidget : public QWidget { public: MyWidget(QWidget *parent = NULL) : QWidget(parent) { setFixedSize(100, 100); } protected: void paintEvent(QPaintEvent *) { QFont f; f.setFamily("Arial"); f.setPixelSize(11); QPainter painter(this); painter.setFont(f); painter.setBrush(Qt::NoBrush); painter.setPen(Qt::SolidLine); painter.drawText(50, 50, "wiwi"); painter.rotate(1.); painter.drawText(50, 70, "wiwi"); } }; int main(int argc, char **argv) { QApplication app(argc, argv); MyWidget w; w.show(); return app.exec(); }
A screenshot of what this looks like on my machine is attached. Some things I have noticed:
- It is fine on X11 (Ubuntu, at least) and Mac OS X.
- It only affects certain fonts at certain sizes. If, for example, you change the font in the example to pixel size 12 or point size 11, it looks fine.
- This may be a duplicate of
QTBUG-20900. It certainly seems like the same behavior. I wasn't positive, however, so opened up a second bug and added reciprocal links.
Attachments
Issue Links
- is replaced by
-
QTBUG-20900 QPainterPath::addText has incorrect font spacing on Windows only
- Closed