<html theme="themeKey23rand818" iconset="color"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body text="#194869">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"
cite="mid:CABthHP82+yH5Bx3W9Zy-m7JariGaH8pz+VYu5DioS-rL3OiTkg@mail.gmail.com"
style="border: 0px none ! important;">
<div xmlns="http://www.w3.org/1999/xhtml" class="__pbConvHr"
style="margin:30px 25px 10px 25px;"><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:#485664
!important;padding-right:6px;font-weight:500;text-decoration:none
!important;" href="mailto:peacech@gmail.com" moz-do-not-send="true">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 xmlns="http://www.w3.org/1999/xhtml" class="__pbConvBody"
__pbrmquotes="true"
style="color:#909AA4;margin-left:24px;margin-right:24px;">
<meta http-equiv="content-type" content="text/html; charset=utf-8"><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>
<div xmlns="http://www.w3.org/1999/xhtml" class="__pbConvHr"
style="margin:30px 25px 10px 25px;"><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:#485664
!important;padding-right:6px;font-weight:500;text-decoration:none
!important;" href="mailto:john@sturtz.org" moz-do-not-send="true">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 xmlns="http://www.w3.org/1999/xhtml" class="__pbConvBody"
__pbrmquotes="true"
style="color:#909AA4;margin-left:24px;margin-right:24px;">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
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>
</body></html>