<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">If your Qt is compiled with freetype, you can try using it instead, see</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><a href="https://doc.qt.io/qt-5/qt-conf.html">https://doc.qt.io/qt-5/qt-conf.html</a> (bottom of page)</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><a href="https://github.com/qt/qtbase/blob/v5.15.14-lts-lgpl/src/plugins/platforms/windows/qwindowsintegration.cpp#L189">https://github.com/qt/qtbase/blob/v5.15.14-lts-lgpl/src/plugins/platforms/windows/qwindowsintegration.cpp#L189</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 15, 2024 at 12:12 PM John F Sturtz <<a href="mailto:john@sturtz.org">john@sturtz.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>Alas. Still working in (Py)Qt5. I'm
probably stuck with it then.<br>
<br>
Thanks.<br>
<br>
/John<br>
<span>
</span><br>
<blockquote type="cite" style="border:0px">
<div style="margin:30px 25px 10px"><div style="width:100%;border-top:2px solid rgba(146,154,163,0.7);padding-top:10px"> <div style="display:inline-block;white-space:nowrap;vertical-align:middle;width:49%">
<a style="color:rgb(72,86,100);padding-right:6px;font-weight:500;text-decoration:none" href="mailto:peacech@gmail.com" target="_blank">Charles</a></div>
<div style="display:inline-block;white-space:nowrap;vertical-align:middle;width:48%;text-align:right"> <font color="#909AA4"><span style="padding-left:6px">Thursday,
November 14, 2024 10:35 PM</span></font></div> </div></div>
<div style="color:rgb(144,154,164);margin-left:24px;margin-right:24px">
<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">That is
the limitation of using GDI font engine. If you are using Qt>=6.7,
trying using
<span id="m_802174999814554572gmail-hs_cos_wrapper_post_body"><span style="font-family:"Courier New",Courier,monospace">-platform windows:fontengine=directwrite</span></span>
command line parameter.<br></div></div><br>
</div>
<div style="margin:30px 25px 10px"><div style="width:100%;border-top:2px solid rgba(146,154,163,0.7);padding-top:10px"> <div style="display:inline-block;white-space:nowrap;vertical-align:middle;width:49%">
<a style="color:rgb(72,86,100);padding-right:6px;font-weight:500;text-decoration:none" href="mailto:john@sturtz.org" target="_blank">John F
Sturtz</a></div> <div style="display:inline-block;white-space:nowrap;vertical-align:middle;width:48%;text-align:right"> <font color="#909AA4"><span style="padding-left:6px">Thursday,
November 14, 2024 9:12 PM</span></font></div> </div></div>
<div style="color:rgb(144,154,164);margin-left:24px;margin-right:24px">
Greetings again!<br>
<br>
This is perhaps a bit of an esoteric question.<br>
<br>
I am using <span style="font-family:monospace">QFontDatabase</span>
and <span style="font-family:monospace">QFont</span> to query and
manipulate some display fonts. On my system, there are some font
family/variant combinations that have pretty long names. Several in the
<span style="font-style:italic">Bahnschrift</span> family, for
instance -- <span style="font-style:italic">Bahnschrift SemiBold
SemiCondensed,
Bahnschrift SemiLight SemiCondensed, </span>and so on.<span style="font-style:italic"></span><span style="font-style:italic"></span><br>
<br>
The Windows font settings app lists these with their full names. Also,
if I query the <span style="font-family:monospace">.ttf</span> file
directly:<br>
<br>
<span style="font-family:monospace"> path =
r'C:\Windows\fonts\bahnschrift.ttf'</span><span style="font-family:monospace"><br>
</span><span style="font-family:monospace"> font =
ttLib.TTFont(path)</span><span style="font-family:monospace"><br>
</span><span style="font-family:monospace"> for instance in
font["fvar"].instances:</span><span style="font-family:monospace"><br>
</span><span style="font-family:monospace"> style =
font["name"].getName(instance.subfamilyNameID, 3, 1, 0x409)</span><span style="font-family:monospace"><br>
</span><span style="font-family:monospace"> print(style)</span><span style="font-family:monospace"><br>
</span><br>
I get the full names.<br>
<br>
However, if I get a list of font families using <span style="font-family:monospace">QFontDatabase().families()</span>, the
names that are returned are truncated to (oddly) 31 characters. So, for
example, <span style="font-style:italic">Bahnschrift SemiBold
SemiConden, Bahnschrift SemiLight SemiConde, </span>and the like.<br>
<br>
And indeed, if I want to create a <span style="font-family:monospace">QFont</span>
object for these, I seem to need to use the truncated names:<br>
<br>
<span style="font-family:monospace">QFont('Bahnschrift SemiBold
SemiConden')</span><span style="font-family:monospace"> # These
work<br>
</span><span style="font-family:monospace">QFont('Bahnschrift
SemiLight Semi</span><span style="font-family:monospace">Conde')</span><span style="font-family:monospace"><br>
</span><br>
<span style="font-family:monospace"><span style="font-family:monospace">QFont('Bahnschrift SemiBold SemiCondensed') # These do
not</span><span style="font-family:monospace"><br>
</span><span style="font-family:monospace">QFont('Bahnschrift
SemiLight Semi</span><span style="font-family:monospace">Condensed')</span><span style="font-family:monospace"><br>
</span></span><br>
Not a <span style="font-family:monospace"><span style="font-style:italic">huge</span></span> deal, but it's a little difficult, because
the names PyQt seems to recognize aren't the ones I'd want to present to
the user (nor ones I would have thought to use, but for the fact that <span style="font-family:monospace">QFontDatabase(</span><span style="font-family:monospace">).families()</span> gave them to me that
way). Any thoughts as to why?<br>
<br>
Thanks again, as always!<br>
<br>
/John<br>
<span style="font-family:monospace"></span>
</div>
</blockquote>
<br>
</div>
</blockquote></div>