3

So, there is a QFontDatabase::families() method which returns a QStringList of all available font families probably by looking it up at local registry, such as HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts. Currently I'm trying to make a combobox which includes not only all available system font families, but their substitutes as well, such as Arial Baltic, Arial Greek, etc.

At first I thought that a simple nested loop of iterating over each font family and running it throught QFont::substitutes() or QFont::substitutions() method, and then looping through returned QStringLists and pushing back these families into a separate container would work, but these methods just return an empty QStringList every time, even though I can clearly see that in my registry, a bunch of font substitutions do in fact exist.

Sadly, I couldn't find any relevant information nor examples on these methods on Internet, so my current theory is QFont does not dirrectly load system font substitutions but instead only works with the ones that you insert by yourself, using QFont::insertSubstitutions

I know that I could've used WINAPI's EnumFontFamilies method and that it does in fact provide me with what I'm looking for, but saldy, that would limit my current implementation to windows only

p.ivanov
  • 31
  • 2
  • 1
    On MS Windows installed languages are not the same as fonts see [EnumUILanguages](https://learn.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-enumuilanguagesw). – Richard Critten Jun 08 '23 at 15:37
  • Hmm maybe you are looking for https://doc.qt.io/qt-6/qfontdatabase.html#writingSystems? – Osyotr Jun 08 '23 at 20:04

0 Answers0