<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">I tested it and Qt 6.8.0 seems to use directwrite by default. Any other engine still results in truncated names. Directwrite gives a better font family names.</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">Qt 6.8.0 (no parameter or using -platform windows:fontengine=directwrite)</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Inconsolata SemiCondensed<br>  SemiCondensed<br>  SemiCondensed Medium<br>  SemiCondensed Bold<br>Inconsolata Condensed<br>  Condensed<br>  Condensed Medium<br>  Condensed Bold<br>Inconsolata<br>  Regular<br>  Medium<br>  Bold</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">Qt5/Qt6 with -platform windows:fontengine=gdi/-platform windows:fontengine=freetype</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Inconsolata SemiCondensed Mediu<br>  Regular<br>Inconsolata Condensed Medium<br>  Regular<br>Inconsolata SemiCondensed<br>  Medium<br>  Regular<br>  Bold<br>Inconsolata Condensed<br>  Medium<br>  Regular<br>  Bold<br>Inconsolata Medium<br>  Regular<br>Inconsolata<br>  Medium<br>  Regular<br>  Bold</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 15, 2024 at 11:33 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>I'm probably in over my head here.  Don't 
know how to check whether <span style="font-family:monospace">(Py)Qt</span>
 is compiled with freetype.<br>
<br>
Following the instructions at the bottom of the page, I did put the <span style="font-family:monospace">qt.conf</span> file shown in the 
directory where <span style="font-family:monospace">python.exe</span> 
resides [probably wouldn't ultimately be the optimal location for it, 
but that is what <span style="font-family:monospace">QCoreApplication.applicationDirPath()</span>
 returns, and it seemed the easiest thing to try first].<br>
<br>
That didn't appear to change the behavior ...<br>
<br>
At one point awhile back, I did try to make a push to migrate my code to
 <span style="font-family:monospace">Qt6</span>, but there was one 
piece of code I never could get to work properly.  So I abandoned the 
effort.  :-<<br>
<br>
Thanks again!<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 11:27 PM</span></font></div>    </div></div>
  <div style="color:rgb(144,154,164);margin-left:24px;margin-right:24px">
<div dir="ltr"><div 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 style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:small"><a href="https://doc.qt.io/qt-5/qt-conf.html" target="_blank">https://doc.qt.io/qt-5/qt-conf.html</a>
 (bottom of page)</div><div 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" target="_blank">https://github.com/qt/qtbase/blob/v5.15.14-lts-lgpl/src/plugins/platforms/windows/qwindowsintegration.cpp#L189</a></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 11:12 PM</span></font></div>    </div></div>
  <div style="color:rgb(144,154,164);margin-left:24px;margin-right:24px">

Alas.  Still working in (Py)Qt5.  I'm 
probably stuck with it then.<br>
<br>
Thanks.<br>
<br>
/John<br>
<span>

</span><br>

<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: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 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_1872413903903797671gmail-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></div>