Details
-
Bug
-
Resolution: Out of scope
-
P4: Low
-
4.3.2
-
None
Description
QImage can in some cases draw text wrongly when comparing it to how QPixmap draws it.
This only happens on Mac.
Reproducible with the following example:
- The letter '7' in the bad.png is missing a pixel.
#include <qpainter>
#include <qimage>
#include <qpixmap>
#include <qapplication>
#include <qcolor>
int main(int argc, char** argv)
{
QApplication app(argc, argv);
QPixmap pm(QSize(100, 100));
pm.fill(QColor(0, 0, 0, 0));
QFont f("Courier", 8);
f.setStyleHint(QFont::AnyStyle, QFont::NoAntialias);
QPainter ppm(&pm);
ppm.setFont(f);
ppm.setPen(Qt::white);
ppm.drawText(QRect(0, 0, 100, 100), 0x484, "012345678 abcdefg");
pm.save("good.png", "PNG");
QImage img(QSize(100, 100), QImage::Format_ARGB32);
QPainter imgP(&img);
imgP.setFont(f);
imgP.setPen(Qt::white);
imgP.drawText(QRect(0, 0, 100, 100), 0x484, "012345678 abcdefg");
img.save("bad.png", "PNG");
}