<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="gmail-hs_cos_wrapper_post_body" class="gmail-hs_cos_wrapper gmail-hs_cos_wrapper_meta_field gmail-hs_cos_wrapper_type_rich_text"><span style="font-family:"Courier New",Courier,monospace" class="gmail-">-platform windows:fontengine=directwrite</span></span> command line parameter.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 15, 2024 at 10:12 AM 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>
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></div>