<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<p>Instead of using QFont try using the CSS (or QSS) to set the font
<br>
</p>
<div class="moz-cite-prefix">On 10/7/2020 8:42 AM, ullix wrote:<br>
</div>
<blockquote type="cite"
cite="mid:b936672c-e284-7d26-5f67-f303494e5bb2@urkam.de">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<p><span style="font-size: 14px;" class=""><span
style="caret-color: rgb(64, 66, 68); color: rgb(64, 66, 68);
background-color: rgb(255, 255, 255);" class="">hen 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 </span><a
href="https://doc.qt.io/qt-5/qfontinfo.html" style="margin:
0px; padding: 0px; border: 0px; vertical-align: baseline;
color: rgb(23, 168, 26); text-decoration: none;
transition-duration: 0.3s;" class="" moz-do-not-send="true">QFontInfo</a><span
style="caret-color: rgb(64, 66, 68); color: rgb(64, 66, 68);
background-color: rgb(255, 255, 255);" class=""> object. If
the window system provides an exact match </span><a
href="https://doc.qt.io/qt-5/qfont.html#exactMatch"
style="margin: 0px; padding: 0px; border: 0px;
vertical-align: baseline; color: rgb(23, 168, 26);
text-decoration: none; transition-duration: 0.3s;" class=""
moz-do-not-send="true">exactMatch</a><span
style="caret-color: rgb(64, 66, 68); color: rgb(64, 66, 68);
background-color: rgb(255, 255, 255);" class="">() returns </span><code
style="margin: 0px; padding: 0px; border: 0px;
vertical-align: baseline; caret-color: rgb(64, 66, 68);
color: rgb(64, 66, 68);" class="">true</code><span
style="caret-color: rgb(64, 66, 68); color: rgb(64, 66, 68);
background-color: rgb(255, 255, 255);" class="">.</span></span></p>
<p><span style="font-size: 14px;" class=""><span
style="caret-color: rgb(64, 66, 68); color: rgb(64, 66, 68);
background-color: rgb(255, 255, 255);" class="">... and this
is what I intended and it worked correctly until recently
(on Linux it still works.)</span></span></p>
<p><span style="font-size: 14px;" class=""><span
style="caret-color: rgb(64, 66, 68); color: rgb(64, 66, 68);
background-color: rgb(255, 255, 255);" class="">But even
stranger: when all I define (on Windows) is 'self.fontstd =
QFont("Consolas", 10)', <br>
</span></span></p>
<p><span style="font-size: 14px;" class=""><span
style="caret-color: rgb(64, 66, 68); color: rgb(64, 66, 68);
background-color: rgb(255, 255, 255);" class="">the
fontifnfo result is:<br>
</span></span></p>
<p><span style="font-size: 14px;" class=""><span
style="caret-color: rgb(64, 66, 68); color: rgb(64, 66, 68);
background-color: rgb(255, 255, 255);" class="">-Family:Consolas,
fixed:True, size:10, style:0, styleHint:5, styleName:,
weight:50, exactMatch:False</span></span></p>
<p><span style="font-size: 14px;" class=""><span
style="caret-color: rgb(64, 66, 68); color: rgb(64, 66, 68);
background-color: rgb(255, 255, 255);" class="">Note that it
matches all request, yet the exactMatch comes as false?</span></span></p>
<p><span style="font-size: 14px;" class=""><span
style="caret-color: rgb(64, 66, 68); color: rgb(64, 66, 68);
background-color: rgb(255, 255, 255);" class=""><br>
</span></span></p>
<div class="moz-cite-prefix">Am 07.10.20 um 13:21 schrieb Colin
McPhail:<br>
</div>
<blockquote type="cite"
cite="mid:LO2P265MB0512AE44F2A931563AFFF37F850A0@LO2P265MB0512.GBRP265.PROD.OUTLOOK.COM">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 7 Oct 2020, at 09:33, ullix <<a
href="mailto:ullix@urkam.de" class=""
moz-do-not-send="true">ullix@urkam.de</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">I believe I found a bug in PyQt5 (or QT?) ,
surfacing only under Windows, perhaps only Win10<br
class="">
<br class="">
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.<br class="">
<br class="">
More details already reported here:<br class="">
<br class="">
<a
href="https://stackoverflow.com/questions/64213031/python3-with-pyqt5-on-win10-ignores-font-settings"
class="" moz-do-not-send="true">https://stackoverflow.com/questions/64213031/python3-with-pyqt5-on-win10-ignores-font-settings</a><br
class="">
<br class="">
<br class="">
</div>
</div>
</blockquote>
</div>
Hi,
<div class="">Qt's documentation for QFont (<a
href="https://doc.qt.io/qt-5/qfont.html" class=""
moz-do-not-send="true">https://doc.qt.io/qt-5/qfont.html</a>)
implies that a QFont instance records what you asked for
rather than what font it selected:</div>
<div class=""><br class="">
</div>
<blockquote style="margin: 0 0 0 40px; border: none; padding:
0px;" class="">
<div class="">
<div class=""><span style="font-size: 14px;" class=""><span
style="caret-color: rgb(64, 66, 68); color: rgb(64,
66, 68); background-color: rgb(255, 255, 255);"
class="">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 </span><a
href="https://doc.qt.io/qt-5/qfontinfo.html"
style="margin: 0px; padding: 0px; border: 0px;
vertical-align: baseline; color: rgb(23, 168, 26);
text-decoration: none; transition-duration: 0.3s;"
class="" moz-do-not-send="true">QFontInfo</a><span
style="caret-color: rgb(64, 66, 68); color: rgb(64,
66, 68); background-color: rgb(255, 255, 255);"
class=""> object. If the window system provides an
exact match </span><a
href="https://doc.qt.io/qt-5/qfont.html#exactMatch"
style="margin: 0px; padding: 0px; border: 0px;
vertical-align: baseline; color: rgb(23, 168, 26);
text-decoration: none; transition-duration: 0.3s;"
class="" moz-do-not-send="true">exactMatch</a><span
style="caret-color: rgb(64, 66, 68); color: rgb(64,
66, 68); background-color: rgb(255, 255, 255);"
class="">() returns </span><code style="margin: 0px;
padding: 0px; border: 0px; vertical-align: baseline;
caret-color: rgb(64, 66, 68); color: rgb(64, 66, 68);"
class="">true</code><span style="caret-color: rgb(64,
66, 68); color: rgb(64, 66, 68); background-color:
rgb(255, 255, 255);" class="">.</span></span></div>
</div>
</blockquote>
<font class="" color="#404244"><span style="caret-color: rgb(64,
66, 68); font-size: 14px;" class=""><br class="">
</span></font>
<div class=""><font class="" color="#404244"><span
style="caret-color: rgb(64, 66, 68);" class="">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.</span></font></div>
<div class=""><font class="" color="#404244"><span
style="caret-color: rgb(64, 66, 68);" class=""><br
class="">
</span></font></div>
<div class=""><font class="" color="#404244"><span
style="caret-color: rgb(64, 66, 68);" class="">Regards,</span></font></div>
<div class=""><font class="" color="#404244"><span
style="caret-color: rgb(64, 66, 68);" class="">Colin</span></font></div>
</blockquote>
</blockquote>
</body>
</html>