[Interest] Text is not being anti-aliased.
william.crocker at analog.com
william.crocker at analog.com
Sat Jan 31 01:28:54 CET 2015
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.crocker at analog.com"<william.crocker at analog.com>
>> To: "interest at qt-project.org"<interest at 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 at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>
>
More information about the Interest
mailing list