Getting real textFont of a ListBox

Hello,
in a project of mine I use temporarilyInstallFonts (from WFS), and it works all right for all controls except Listbox and Canvas.
In such cases (Listbox and canvas) Xojo uses the System font.
See <https://xojo.com/issue/55423>

Since I do not know when the bug will be fixed, and since the issue affects only Listboxes and canvases, I was thinking of a way to retrieve the “real” listbox.textfont in order to apply some workaround. For instance:

if myListbox.textfont = myCustomFont then
//do something
else
//do something else
end if

Unfortunately this snippet, for myListbox.textfont, always returns “myCustomFont” even if actually theListbox shows the text using System font.

So, is there any other way to know the really-used textFont of a Listbox?
No plugins, please.

Suggestions welcome. Thank you.

On MacOS (El Capitan), current Xojo (2019r1.1), this code in the MouseDown Event of a listbox returns the correct listbox font:

Msgbox Me.TextFont

Edit:
macOS refused to decompress the file tempFonts.zip (downloaded from the Feeedback case). Using The Archiver do the job without error. I do not tried to load the font.

Have you tried that font on other application (TextEdit, Page, …) ?

Edited: Please notice that the current issue is targeted “Windows”. Thanks.

Emile, this code is in the open event of a listbox:
me.textFont = “someFont”//yes, this precise name
me.addrow “Hello”

Then in the mousedown event or in the action event of pushbutton:
msgbox me.textFont (or listbox1.textfont)

Since I guess you do not have the “someFont” font installed, you’ll see that the listbox uses the System font, yet the msgbox shows “someFont” which does not even exist, it is just a string.

The same issue happens when a temporarily installed font is not loaded, or it is loaded but some controls do not use it.
And my issue is just that, in Windows, a temporarily installed font works OK on all controls, except Listboxes and canvases.

Hence my post about a better way, in this particular situation, to trap the “real” font used by a listbox.

And yes, if that particular font is manually installed, listboxes and canvases work all right.

OK.

[quote=446037:@Carlo Rubini]The same issue happens when a temporarily installed font is not loaded, or it is loaded but some controls do not use it.
And my issue is just that, in Windows, a temporarily installed font works OK on all controls, except Listboxes and canvases.

Hence my post about a better way, in this particular situation, to trap the “real” font used by a listbox.[/quote]

You can set the font to Arial, and it will work with all versions of Windows.

If your app is targeted at Windows 10 users, for instance because it is in the Windows Store, you can use SegoeUI. It is the font used for all UI in UWP apps.

You can also find which version of the system is running, and set the font appropriately.

Michel,
I use a temporarily installed font because the app is cross-platform (Mac and Windows) with interface mostly in Bangla which on the Mac is very poorly supported (two fonts, one of which could be considered good for comic magazines, and the other looks pretty good but fails in some composed letters).
Of course, one can always download other fonts, but as developers we should depend on fonts we know are available by default.

On the other end, Windows support for Bangla has always been very good, from Vrinda (once upon a time) to Sonar Bangla in Windows 10.

Now, precisely because of deficiencies on the Mac side, I made my own font to be used both on Mac and Windows builts.

But the issue I’m facing at present with Windows is pushing me towards leaving out the temporarily installed font approach and instead using the Sonar Bangla font. Leaving the temporarily installed font approach only on the Mac.

Thank you for answering.

Precisely, my suggestion was to use fonts that are installed by default with Windows.