Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
None
-
5.12.3
-
None
Description
QPainter renders crooked text.
In attached image, left 'Unable to render embedded object: File (' is rendered by QPainter and right ') not found.' is captured from MS PowerPoint.
The font family is 'Noto Sans' and point size is 60.
You can see that left one is crooked while right one is perfectly symmetric.
Left one is rendered by next code:
#include <QtGui> auto main(int argc, char **argv) -> int { QGuiApplication app{argc, argv}; QImage image{100, 100, QImage::Format_RGB32}; QFont font{"Noto Sans"}; font.setPointSize(60); QPainter painter{&image}; painter.fillRect(image.rect(), Qt::white); painter.setFont(font); painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); painter.drawText(image.rect(), Qt::AlignCenter, "!"); painter.end(); image.save("D:/test-alpha.png"); return 0; }