When I use a QPainter to drawText onto a QPixmap using a QFont, it appears anti-aliased when the OS has anti-alias enabled, but not when it doesn't even though I am explicitly setting render hints of the painter and strategy of the font:
QPainter painter(&pixmap);
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
font.setStyleStrategy(QFont::NoSubpixelAntialias); // I do not want clear-type
I know the OS (Windows 7 in this case) is capable of drawing anti-aliased text when anti-alias text is turned off at the OS level because visual studio does this.
How do I get Qt to override this OS's anti-alias setting?
Search term: antialias
You need to make sure you add QFont::PreferAntialias to your font.setStyleStrategy call. Like so:
font.setStyleStrategy(QFont::NoSubpixelAntialias | QFont::PreferAntialias);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With