<div dir="ltr"><div>I've not used variable fonts yet, but you should probably start by inspecting the QFont instance using the related "variable" and "tag" functions introduced in 6.7, such as <a href="https://doc.qt.io/qt-6/qfont.html#variableAxisTags">https://doc.qt.io/qt-6/qfont.html#variableAxisTags</a></div><div>Maybe you can create a small program that lists all fonts and the results of those functions, then compare it with the Windows font dialog.</div><div><br></div><div>Cheers,<br></div><div>MaurizioB<br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">Il giorno sab 11 gen 2025 alle ore 16:08 John Sturtz <<a href="mailto:john@sturtz.org">john@sturtz.org</a>> ha scritto:<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 class="msg811256223017179208"><div><div>😊  Thanks again.  Boy, I've got a lot to learn ...</div><div><br></div><div>I saw those other .ttf files (actually, in the distribution I got, they're in a subdirectory called <i>static,</i> which really ought to have tipped me off), but I had overlooked them.</div><div><br></div><div>Is there a way to tell from Qt whether a font is variable or static?  Windows Font Settings seems to know (it displays 'Variable font' for some fonts and not for others), so I guess it must be a contained in the font file?</div>
<div><br></div>
<div>
<div>------ Original Message ------</div>
<div>From "Charles" <<a href="mailto:peacech@gmail.com" target="_blank">peacech@gmail.com</a>></div>
<div>To "John Sturtz" <<a href="mailto:john@sturtz.org" target="_blank">john@sturtz.org</a>></div>
<div>Cc "Maurizio Berti" <<a href="mailto:maurizio.berti@gmail.com" target="_blank">maurizio.berti@gmail.com</a>>; <a href="mailto:pyqt@riverbankcomputing.com" target="_blank">pyqt@riverbankcomputing.com</a></div>
<div>Date 1/10/2025 7:45:38 PM</div>
<div>Subject Re: Re[4]: QFontDatabase/QFont question</div></div><div><br></div>
<div id="m_811256223017179208x006a2b79b97d48b"><blockquote cite="http://CABthHP_04+sJPGU+UdYBgER126G_L=8-ipVCME4Y7NBtOmmfQQ@mail.gmail.com" type="cite" class="m_811256223017179208cite2">
<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">> 
I thought the font was inherently variable? 
<br></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">If you download the font from Google Fonts, there are 2 ttf files with "variable" in the name, these are the variable fonts. There are also a bunch of ttf files in a "ttf" directory, these are the static fonts. It is not about how you access the font, it is about which ttf files you install.<br></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">> QFontDatabase offers no italic style for Bahnschrift Condensed.  If I create with QFont(), it is initially condensed.  But if I call .setItalic(True), it no longer is condensed; it's just plain Bahnschrift. <br><br>You need to set both the style name and the stretch. The font name and style flags do the font matching while the style name limits the matched fonts. Since there are no matching fonts with the style flags, obliquefication uses whatever font matched first. If you set the style name, obliqueficiation is limited to the font with that style.<br><br>f = QFont('Bahnschrift', 24)<br>f.setStyleName('Condensed')<br>f.setStretch(QFont.Stretch.Condensed)<br>f.setItalic(True)</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jan 11, 2025 at 8:01 AM John Sturtz <<a href="mailto:john@sturtz.org" target="_blank">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><div><div><span>------ Original Message ------</span></div><div>
<div>From "Charles" <<a href="mailto:peacech@gmail.com" target="_blank">peacech@gmail.com</a>></div>
<div>To "John Sturtz" <<a href="mailto:john@sturtz.org" target="_blank">john@sturtz.org</a>></div>
<div>Cc "Maurizio Berti" <<a href="mailto:maurizio.berti@gmail.com" target="_blank">maurizio.berti@gmail.com</a>>; <a href="mailto:pyqt@riverbankcomputing.com" target="_blank">pyqt@riverbankcomputing.com</a></div>
<div>Date 1/9/2025 10:55:57 PM</div>
<div>Subject Re: Re[2]: QFontDatabase/QFont question</div></div><div><br></div>
<div id="m_811256223017179208m_-7526689799793630018xa3b021e08467456"><blockquote cite="http://CABthHP_pTKsaSBVrJKPVYqWjy5ViW-WfZfqD-2am93LZDyr5Gw@mail.gmail.com" type="cite">
<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">> 
you're getting a named style from the variable font file 
<br></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">You didn't mention that you are using the variable font. I didn't use the variable font instead I use the static fonts. I also got the thin oblique font with the variable fonts.</div></div></blockquote>I thought the font was inherently variable?  Or is it a matter of how you access it?  Use <font face="Consolas">QFontDatabase()</font><font style="font-size:16px" size="3"> (accessing by style name),</font> and you are using it as a variable font; use <font style="font-size:16px" size="3" face="Consolas">QFont</font> + <font style="font-size:16px" size="3" face="Consolas">.setWeight()</font> and <font style="font-size:16px" size="3" face="Consolas">.setItalic()</font> methods, and you are using it as static (= 'simulated' = 'synthesized').  Do I understand that correctly?<br><font size="2" face="arial, helvetica, sans-serif"><br></font><blockquote cite="http://CABthHP_pTKsaSBVrJKPVYqWjy5ViW-WfZfqD-2am93LZDyr5Gw@mail.gmail.com" type="cite"><div dir="ltr"><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">These codes works for me:</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">1. f = QFont('Exo', 24, 700, True) # use QFont specifying weight and italic</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">2. f = QFont('Exo', 24); f.setWeight(700); f.setItalic(True)</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">3. f = QFontDatabase('Exo', 'Bold', 24); f.setStyleName('Bold Italic')</div></div></blockquote>Yes, these all work for me as well [the last needs to be <font style="font-size:16px" size="3" face="Consolas">QFontDatabase<font color="#ff0000">.font</font>('Exo', 'Bold', 24)</font>]<br><font size="2" face="arial, helvetica, sans-serif"><br></font><blockquote cite="http://CABthHP_pTKsaSBVrJKPVYqWjy5ViW-WfZfqD-2am93LZDyr5Gw@mail.gmail.com" type="cite"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Note that italic is part of the style name. If you call setItalic(True) there is a mismatch between the style flags and the style name. So if you use QFontDatabase and style name always use setStyleName to change the style, otherwise use QFont and setWeight and setItalic.</div></div></blockquote>So it seems the moral is not to intermingle <font style="font-size:16px" size="3" face="Consolas">QFont</font> (static) and <font style="font-size:16px" size="3" face="Consolas">QFontDatabase</font> (variable) methods.</div><div id="m_811256223017179208m_-7526689799793630018xa3b021e08467456"><font style="font-size:16px" size="3"><br></font></div><div id="m_811256223017179208m_-7526689799793630018xa3b021e08467456"><font style="font-size:16px" size="3">But this case still troubles me:</font></div><div id="m_811256223017179208m_-7526689799793630018xa3b021e08467456"><br><div><div id="m_811256223017179208m_-7526689799793630018x41031e36418341b4b3275cee4116510a"><div style="background-color:rgba(0,0,0,0);margin:0px">I see the problem with other fonts as well -- Bahnschrift, for example, which comes with Windows.  If I create a <font face="Consolas">QFont</font> object with <font face="Consolas">QFontDatabase.font()</font>:</div><div style="background-color:rgba(0,0,0,0);margin:0px"><br></div><div style="background-color:rgba(0,0,0,0);margin:0px"><font face="Consolas">  Â  Â  Â  f = QFontDatabase.font('Bahnschrift', 'Condensed', 24)
</font></div><div style="background-color:rgba(0,0,0,0);margin:0px"><br></div><div style="background-color:rgba(0,0,0,0);margin:0px">and then apply <font face="Consolas">.setItalic(True</font><font face="Consolas">)</font> to it, it's italic, but no longer Condensed.</div><div style="background-color:rgba(0,0,0,0);margin:0px"><br></div><div style="background-color:rgba(0,0,0,0);margin:0px">And actually, the same thing happens if I create the font with <font face="Consolas">QFont()</font> directly:</div><div style="background-color:rgba(0,0,0,0);margin:0px"><br></div><div style="background-color:rgba(0,0,0,0);margin:0px"><font face="Consolas">  Â  Â  Â  f = QFont(
</font></div><div style="background-color:rgba(0,0,0,0);margin:0px"><font face="Consolas">  Â  Â  Â  Â  Â  'Bahnschrift Condensed',
</font></div><div style="background-color:rgba(0,0,0,0);margin:0px"><font face="Consolas">  Â  Â  Â  Â  Â  pointSize=24
</font></div><div style="background-color:rgba(0,0,0,0);margin:0px"><font face="Consolas">  Â  Â  Â  )
</font></div><div style="background-color:rgba(0,0,0,0);margin:0px"><br></div><div style="background-color:rgba(0,0,0,0);margin:0px">Here also, the font is fine initially, but after <font face="Consolas">.setItalic(True)</font> it is no longer Condensed.</div></div></div></div><div id="m_811256223017179208m_-7526689799793630018xa3b021e08467456"><font size="2" face="arial, helvetica, sans-serif"><br></font></div><div id="m_811256223017179208m_-7526689799793630018xa3b021e08467456"><font style="font-size:16px" size="3" face="Consolas">QFontDatabase</font> offers no italic style for Bahnschrift Condensed.  If I create with <font style="font-size:16px" size="3" face="Consolas">QFont()</font>, it is initially condensed.  But if I call <font style="font-size:16px" size="3" face="Consolas">.setItalic(True)</font>, it no longer is condensed; it's just plain Bahnschrift.</div><div id="m_811256223017179208m_-7526689799793630018xa3b021e08467456"><font style="font-size:16px" size="3"><br></font></div><div id="m_811256223017179208m_-7526689799793630018xa3b021e08467456">I'd think this must be a bug?</div><div id="m_811256223017179208m_-7526689799793630018xa3b021e08467456"><font style="font-size:16px" size="3"><br></font></div><div id="m_811256223017179208m_-7526689799793630018xa3b021e08467456"><font style="font-size:16px" size="3">/John</font></div><div id="m_811256223017179208m_-7526689799793630018xa3b021e08467456"><br></div><div id="m_811256223017179208m_-7526689799793630018xa3b021e08467456"><blockquote cite="http://CABthHP_pTKsaSBVrJKPVYqWjy5ViW-WfZfqD-2am93LZDyr5Gw@mail.gmail.com" type="cite"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div></div>
</div></blockquote></div>
</blockquote></div>
</div></div></blockquote></div>
</blockquote></div>
</div></div></blockquote></div><div><br clear="all"></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi<br><a href="http://www.jidesk.net" target="_blank">http://www.jidesk.net</a></div>