On 01/30/2015 11:56 AM, Jason H wrote: > Back in Qt4, (the last time I wrestled with this issue - Win XP) > there was a setting in Windows about anti-aliased fonts. > Qt respected that setting, unless you explicitly told Qt to override it. >I think you're in a similar situation. >
Sure enough, If I "Turn on clear type" Start->ControlPane->Display-> AdjustClearTypeText/TurnOnClearType The fonts are rendered anti-aliased. But, I think I told Qt to override this with painter.setRenderHint(QPainter::TextAntialiasing,true); Also, I don't think a Display setting should affect how my program renders to a file. Search results suggested that AA required specification of the background color (which seems reasonable), but the following did not help. QBrush bg(Qt::white); painter.setBackground(bg); painter.setBackgroundMode(Qt::OpaqueMode); The bottom line is that my original Qt code was good enough for Linux but not for Windows. Thanks. Bill > >> Sent: Friday, January 30, 2015 at 10:56 AM >> From: "william.croc...@analog.com"<william.croc...@analog.com> >> To: "interest@qt-project.org"<interest@qt-project.org> >> Subject: [Interest] Text is not being anti-aliased. >> >> Hello: >> >> I have code to create a PNG file from a QGraphicsScene. >> When I run this on Linux, text is anti-aliased. This is good. >> When I run this on Windows, text is NOT anti-aliased. This is bad. >> I would like the text to be anti-aliased. >> >> Am I doing something wrong? >> Is this a Windows bug? >> Is there a workaround? >> >> Thanks. >> >> Bill >> >> Qt 4.8.6 >> Visual Studio 2008 >> >> --------------------------------- >> void >> MyScene::exportImagePNG( const QString&fn ) { >> QRectF scene_rect = sceneRect(); >> QSize size(qRound(scene_rect.width()),qRound(scene_rect.height())); >> QImage im(size,QImage::Format_RGB32); >> QPainter painter(&im); >> painter.setRenderHint(QPainter::Antialiasing,true); >> painter.setRenderHint(QPainter::TextAntialiasing,true); >> painter.fillRect(im.rect(),Qt::white); >> render(&painter); >> im.save(fn,"PNG"); >> } >> _______________________________________________ >> Interest mailing list >> Interest@qt-project.org >> http://lists.qt-project.org/mailman/listinfo/interest >> > > _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest