PyQt5 bug in font settings

Colin McPhail mcphail_colin at
Wed Oct 7 12:21:21 BST 2020

> On 7 Oct 2020, at 09:33, ullix <ullix at> wrote:
> I believe I found a bug in PyQt5 (or QT?) , surfacing only under Windows, perhaps only Win10
> The problem: A font may be set, and confirmed by PyQt5 to be in use, yet the actual font is a completely different one. I noticed this when I defined a fixed width font, but became a proportional font, despite PyQt5 telling it is Courier New.
> More details already reported here:
Qt's documentation for QFont ( <>) implies that a QFont instance records what you asked for rather than what font it selected:

When you create a QFont object you specify various attributes that you want the font to have. Qt will use the font with the specified attributes, or if no matching font exists, Qt will use the closest matching installed font. The attributes of the font that is actually used are retrievable from a QFontInfo <> object. If the window system provides an exact match exactMatch <>() returns true.

If you create and interrogate a QFontInfo instance after creating your QFont then you can see how the font selection went. As to why you don't get the font you ask for on Windows 10, I'm afraid I can't help with that.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the PyQt mailing list