RE: [fltk.general] Hint on how / where to look for fonts used by FLTK ?

26 views
Skip to first unread message

Ian MacArthur

unread,
Aug 2, 2022, 5:47:27 AM8/2/22
to fltk.general
I have a replacement message box routine with has its own Fl_Box for the "icon", white background, blue text, font size large. I static link. I have two separate apps built against the same library using the same startup code in main(). From the same Linux environment, one will show the icon large as expected, the other is blue but doesn't look bold or large, just the normal height. Yet, if I run it in another Linux environment where it's actually built, via debug mode, the "icon" is large.

Does someone have a hint on where to look at maybe a font issue in the environment it's running in, if it was consistent across the two apps, I'd say that is it for sure because there is limited fonts installed. But the other app is fine. It's weird, any hints?


David,

This is going to depend on how your code "works" to choose a given face, to a large extent.

FLTK itself does not really have any font faces (it has a few built in as a last-resort fallback for GL scenes and so forth, but not for general widget use.) Instead, FLTK basically uses the system services to load whatever faces the OS has installed.

This, of course, means that the faces you actually get vary from host to host… The FLTK default fonts are set up using basic font metrics (we basically use XFT or equivalent API's on other OS to request a face that has some specific properties - size, serif, monospace/proportional, etc.) and that gets a face assigned for each of the FLTK "built-in" fonts, but even these are loaded from the host system and so can change from machine to machine…
If you try and load a face that does not exist on a given host, then I think X11 falls back to using some basic bitmap face, which sounds a lot like what you might be seeing. WinXX and macOs (and FLTK+PanGo) are much better at substituting "close alternatives" so are much less likely to fall back to some duff face…

You may need to show us what you are actually doing, maybe a small compileable example that we can all try out, that manifests the issue for you.
Also, take a look at the test/fonts and the test/utf8 demos to see what fonts each system carries (and the code shows how they can be loaded and used, though may not exactly constitute best-practice, as it is a wee bit of a hack…)


Reply all
Reply to author
Forward
0 new messages