FL_COURIER is not Courier

58 views
Skip to first unread message

pvr...@btinternet.com

unread,
Mar 1, 2024, 4:50:02 PM3/1/24
to fltk.general
My system is debian bookworm, and I have started to test some of the user settings in my app.

I have implemented a font selector for choosing which font to use in displaying the data in a spreadsheet like table. I naively coded to use Fl::get_all_fonts() and was able to find a Courier font. However populating the widget with all fonts was taking forever and a day.

I decided to limit the font selector to just the FLTK default font table, and noticed that the entry selected by FL_COURIER is _NOT_ Courier but a different monospaced font. I had built FLTK library using the default settings for CMake, but I am confused by the various different options: Wayland, pango, etc. and that's a rabbit hole I don't want to go down.

I am starting to get used to this different font, but I would like to get Courier back as my default monospaced font, and specified by FL_COURIER if possible, so the W11/MSVC version and my debian version look the same in this respect.

Regards Phil.

imm

unread,
Mar 1, 2024, 5:14:58 PM3/1/24
to General FLTK
The fltk "built-in" fonts generally pick up the system defaults, the names aren't literal any more, just sort of place keepers that give a clue as to roughly what you'll get...

FWIW if you run the test/utf demo from the shell, and you pick a face you like it'll print the name (as seen by fltk) to the shell.

You can then use that name to set that face as the FL_COURIER face.

fl::set_font (FL_COURIER, " blah");

Something like that anyway...
--
Ian
From my Fairphone FP3

w1hkj

unread,
Mar 1, 2024, 5:16:34 PM3/1/24
to 'pvr...@btinternet.com' via fltk.general
My applications fldigi, flrig and a few others all enumerate the entire font list.  Yes it can take enough time that you do not want to execute that code in the main thread.  Set it up to do this in a separate temporary thread.  See attached.

David
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/087ab59c-9dbf-40c8-a675-f2fad4edd47fn%40googlegroups.com.

font_browser.cxx
font_browser.h

pvrose

unread,
Mar 1, 2024, 5:45:51 PM3/1/24
to fltkg...@googlegroups.com

On 1 March 2024, at 22:14, imm <imaca...@gmail.com> wrote:

>
>
>On Fri, 1 Mar 2024, 21:50 phil wrote:
>
>My system is debian bookworm, and I have started to test some of the user settings in my app.
>
>I have implemented a font selector for choosing which font to use in displaying the data in a spreadsheet like table. I naively coded to use Fl::get_all_fonts() and was able to find a Courier font. However populating the widget with all fonts was taking forever and a day.
>
>I decided to limit the font selector to just the FLTK default font table, and noticed that the entry selected by FL_COURIER is _NOT_ Courier but a different monospaced font. I had built FLTK library using the default settings for CMake, but I am confused by the various different options: Wayland, pango, etc. and that's a rabbit hole I don't want to go down.
>
>I am starting to get used to this different font, but I would like to get Courier back as my default monospaced font, and specified by FL_COURIER if possible, so the W11/MSVC version and my debian version look the same in this respect.
>

>The fltk "built-in" fonts generally pick up the system defaults, the names aren't literal any more, just sort of place keepers that give a clue as to roughly what you'll get...
>
>FWIW if you run the test/utf demo from the shell, and you pick a face you like it'll print the name (as seen by fltk) to the shell.
>
>You can then use that name to set that face as the FL_COURIER face.
>
>fl::set_font (FL_COURIER, " blah");

Thanks Ian,

I'll look into that. Would I have to do that for all four entries (bold, italic combos)?

Phil


>
>Something like that anyway...
>
>--
>Ian
>From my Fairphone FP3
>

>--
>You received this message because you are subscribed to the Google Groups "fltk.general" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral...@googlegroups.com.

>To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/CAGFM6dbdMx0KXW003HCDasGMhtd%3D1qPFwcDTHkkZooLeHo1AwQ%40mail.gmail.com.

pvrose

unread,
Mar 1, 2024, 5:49:49 PM3/1/24
to fltkg...@googlegroups.com

On 1 March 2024, at 22:16, w1hkj <w1...@bellsouth.net> wrote:

>My applications fldigi, flrig and a few others all enumerate the entire font list.  Yes it can take enough time that you do not want to execute that code in the main thread.  Set it up to do this in a separate temporary thread.  See attached.
>David
>

Thanks Dave.

I've not noticed any particular lag opening either flrig or fldigi, so I'll have a look at your code. I can't open it on this device, so it's a job for tomorrow.

Phil


>On 3/1/24 15:50, 'pvr...@btinternet.com' via fltk.general wrote:
>
>My system is debian bookworm, and I have started to test some of the user settings in my app.
>
>I have implemented a font selector for choosing which font to use in displaying the data in a spreadsheet like table. I naively coded to use Fl::get_all_fonts() and was able to find a Courier font. However populating the widget with all fonts was taking forever and a day.
>
>I decided to limit the font selector to just the FLTK default font table, and noticed that the entry selected by FL_COURIER is _NOT_ Courier but a different monospaced font. I had built FLTK library using the default settings for CMake, but I am confused by the various different options: Wayland, pango, etc. and that's a rabbit hole I don't want to go down.
>
>I am starting to get used to this different font, but I would like to get Courier back as my default monospaced font, and specified by FL_COURIER if possible, so the W11/MSVC version and my debian version look the same in this respect.
>

>Regards Phil.


>
>--
>You received this message because you are subscribed to the Google Groups "fltk.general" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral...@googlegroups.com.

>To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/087ab59c-9dbf-40c8-a675-f2fad4edd47fn%40googlegroups.com.


>
>--
>You received this message because you are subscribed to the Google Groups "fltk.general" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral...@googlegroups.com.

>To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/dbd4c83d-e0a9-c4b1-0fb3-bdbcd8641ccf%40bellsouth.net.

Greg Ercolano

unread,
Mar 1, 2024, 6:57:04 PM3/1/24
to fltkg...@googlegroups.com


On 3/1/24 14:45, 'pvrose' via fltk.general wrote:

>fl::set_font (FL_COURIER, " blah");

Would I have to do that for all four entries (bold, italic combos)?


    In my experience, yes; for each fltk font you want to use (FL_COURIER, FL_COURIER_BOLD..),
    you'd need to set the fl::set_font() function for each one to change it.

    For instance on my machine the test/utf8 program spits out these Courier variation names:

idx 529
User name :Courier New:
FLTK name :Courier New:
size 16

idx 530
User name :Courier New Bold:
FLTK name :Courier New Bold:
size 16

idx 531
User name :Courier New Italic:
FLTK name :Courier New Italic:
size 16

idx 532
User name :Courier New Bold Italic:
FLTK name :Courier New Bold Italic:
size 16

    So in a test program to access all those, you'd use:

#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Terminal.H>

void MakeBox(int Y, Fl_Font font) {
  Fl_Box *box = new Fl_Box(0,Y,400,40,"ABCDEFGHabcdefgh");
  box->box(FL_FLAT_BOX);
  box->color(FL_WHITE);
  box->labelfont(font);
}

int main(int argc, char **argv) {
  Fl::set_font(FL_COURIER,            "Courier New");
  Fl::set_font(FL_COURIER_BOLD,       "Courier New Bold");
  Fl::set_font(FL_COURIER_ITALIC,     "Courier New Italic");
  Fl::set_font(FL_COURIER_BOLD_ITALIC,"Courier New Bold Italic");
  Fl_Window win(400,200,"Test");
  MakeBox(0, FL_COURIER);
  MakeBox(50, FL_COURIER_BOLD);
  MakeBox(100, FL_COURIER_ITALIC);
  MakeBox(150, FL_COURIER_BOLD_ITALIC);
  win.show();
  return Fl::run();
}

    ..on my system the result being:



    If I comment out the Fl::set_font() calls and rebuild, I get this as my default FL_COURIER* fonts:





pvr...@btinternet.com

unread,
Mar 2, 2024, 10:29:47 AM3/2/24
to fltkg...@googlegroups.com
Thanks Greg,




int main(int argc, char **argv) {
  Fl::set_font(FL_COURIER,            "Courier New");
  Fl::set_font(FL_COURIER_BOLD,       "
Courier New Bold");
  Fl::set_font(FL_COURIER_ITALIC,     "
Courier New Italic");
  Fl::set_font(FL_COURIER_BOLD_ITALIC,"Courier New Bold Italic");


I had to download Courier New from fontzone.net, then this worked fine for me on Debian. It worked fine on W11/MSVC as well.

I did find that the non-bold font does not work that well with white text on black background - I have an optional dark mode emulation, but using bold when in that mode works fine.

Phil.

imm

unread,
Mar 2, 2024, 10:44:52 AM3/2/24
to General FLTK
Cool, glad that works.

FWIW, Debian does have (IIRC) a decent and usable Courier-like face built-in, I'm sure I remember using that in the past. Can't remember what it was called though.

I do remember having some #ifdef in my start code to pick the "correct" face on Linux vs Win though.

supsm17

unread,
Mar 11, 2024, 7:24:55 PM3/11/24
to fltk.general
>  The fltk "built-in" fonts generally pick up the system defaults, the names aren't literal any more, just sort of place keepers that give a clue as to roughly what you'll get...
What's up with FL_SCREEN then? What font is it supposed to represent?

Ian MacArthur

unread,
Mar 12, 2024, 6:28:41 AM3/12/24
to fltk.general
On Monday 11 March 2024 at 23:24:55 UTC sups... wrote:
>  The fltk "built-in" fonts generally pick up the system defaults, the names aren't literal any more, just sort of place keepers that give a clue as to roughly what you'll get...
 
What's up with FL_SCREEN then? What font is it supposed to represent?

The "screen" font.
Recall that the names were meaningful sometime last century, and the "screen font" was the font that your default terminal used.
Indeed, it still is - on most XFT systems at least, there's still an alias called "screen" that returns some fixed pitch face that the default terminal console can use.

I think our docs describe it as "Default monospaced screen font".
These days, under Win32 it usually maps to "Terminal", I think the Mac gets "Monaco", XFT gets whatever your systems has the "screen" alias mapped as, and Xlib will get Lucida Typewriter or something similar.

 

supsm17

unread,
Mar 12, 2024, 9:50:49 PM3/12/24
to fltk.general
Interesting. Doesn't the windows command prompt use Consolas rather than Terminal though?
Reply all
Reply to author
Forward
0 new messages