[PyQt] Antialiasing on windows 7 platform

Kovid Goyal kovid at kovidgoyal.net
Thu Apr 9 03:44:06 BST 2015


On windows, Qt uses GDI for drawing text. Which means that it cannot
change various things about text rendering, such as hinting (and
presumably antialiasing), as they are under the control of GDI. You can
compile Qt 5.4.x to use the freetype font engine on windows as well, in
which case text rendering should be identical to linux.

See the note for QFont::HintingPreference for details. While that is
about font hinting, not antialiasing, I believe similar restrictions
apply for anti-aliasing.

Kovid.

On Wed, Apr 08, 2015 at 12:41:35PM -0400, Sylvain Corlay wrote:
> Hello,
> 
> I am having trouble obtaining anti-aliasing in Windows 7 when rendering text
> 
> Both
>     `painter.setRenderHint(QPainter.Antialiasing)`
> and
>     `font.setStyleStrategy(QFont.PreferAntialias)` are ineffective.
> 
> However, anti-aliasing works when setting up ClearType and smooth edges
> system-wise
> 
>     - Control Panel >
>          Appearance and Personalization >
>              Adjust ClearType text >
>                  enable "Turn on CrearType".
>     - Start Menu >
>           Adjust the appearance and performance of Windows" or from
> Computer >
>               System Properties >
>                   Windows Experience Index (link) >
>                       [shield] Adjust visual effects (left sidebar) >
>                           enable "Smooth edges of screen fonts"
> 
> Is there a way to forcibly enable anti-aliasing when drawing text, even
> when those settings are unset? It works perfectly on Linux.
> 
> Thanks,
> Sylvain

> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt


-- 
_____________________________________

Dr. Kovid Goyal 
http://www.kovidgoyal.net
http://calibre-ebook.com
_____________________________________


More information about the PyQt mailing list