I use QPainter::setRenderHint(QPainter::Antialiasing, true) to tell Qt that I want it to smooth out any drawing I make (in this case, the text is drawn using drawText() ).
This works fine and the text looks good until I want to rotate the pixmap map that I draw, for example
Painter.translate(0, height()); Painter.rotate(-90);
(to rotate the QPainter 90 degrees counterclockwise and bring it back)
The call to rotate() seems to turn off anti-aliasing for any text drawn - the text is drawn with proper rotation, but without anti-aliasing. Other things seem unaffected - for example, drawLine() still draws a beautifully smooth line.
Any idea what I'm doing wrong?
EDIT: Unsurprisingly, adding text to the path, and then filling out this path, I get smoothed, rotating text. I would rather avoid this route if possible, though.
EDIT (again): I tried using QFont::setStyleStrategy(QFont::PreferAntialias) for the font I am using, without effect. However, a few more experiments show that a basic font such as Arial will still produce smoothed text when rotated, while my custom font (Swiss721 BlkCn BT for anyone interested) will not. Moreover, although this problem exists in Windows 7, I do not have the same problem when working on Ubuntu. This frequently asked question article may seem like Qt is accessing the host operating system to handle font smoothing, so what problems can Windows have when processing rendering from this particular font (which is TrueType, like Arial)?
EDIT (last time, I promise): Increasing the font size to 16pt or higher will fix this problem. It would seem that the problem is that my font is below 16pt - maybe something is related to what was mentioned in the above blog article ?:
In Windows 2000, fonts are usually not smoothed over a certain range (say, sizes 8-16) to make text clearer and easier to read.