On 10/29/25 20:34 'Klaus Rudolph' via fltk.general wrote:
I copied a bit of code from test/fonts.cxx
Which bit?
I was able to get a list of font names and the index of the list
e.g. I found something like
Nr: 43 Attrib: name BPdots
Nr: 44 Attrib: Bold name BPdots bold
Nr: 45 Attrib: name BPdots Light
Nr: 46 Attrib: name BPdotsDiamond
...
which means, font with name "BPdots bold" has index 44.
Yes, I assume you called something like Fl::set_fonts(...) in the "bit
of code" mentioned above. Correct?
My question is:
If I have the name like "BPdots bold", how can I set my font? OK, I
can run through the list and get the index. But I expect there is some
function, which already do this for me.
Yes, this is not how it should be done. Setting "all" fonts like - I
assume you did - above is wateful.
I tried:
Fl::set_font( 1, "BPdots" );
fl_font( 1, 40 );
or
Fl::set_font( 1, "BPdots bold" );
fl_font( 1, 40 );
Both this did not select the font I want to see. ( or maybe did nothing )
Any hints how I can achieve this? Is there some more documentation?
As you can see in the docs mentioned above, this is - like the available
font names - platform specific. On some platforms (see docs) you need to
add one character before the font name. On some platforms you need only
the family name, on others the full font name.
Which platform are you using for your tests?
BTW: I use # 1 in Fl::set_font( 1, "BPdots" ); But can I have some
"free" number? Maybe totally on the wrong path?
The first "free" font number (i.e. the first font that's not loaded
automatically at startup) is FL_FREE_FONT. You can use this and the
following font numbers to load your own, specific fonts.
If you have further questions after reading the docs, please feel free
to ask again, but please post more details about your platform and code.
Comments are owned by the poster. All other content is copyright 1998-2026 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.