Duncan Gibson wrote:
> Greg replied:
>> Don't forget to set the font ;) eg. fl_font().
>> FLTK will crash if the font isn't set before the fl_draw() call.
>
> Is there some reason why this is acceptable behaviour and not an STR?
> You don't need to call fl_font() before setting titles and labels, so
> why is it needed before fl_draw()? Can't the same font be used?
fl_draw() will crash if fl_font() has never been called before
since the program started. IIRC, once fl_font() is called,
the setting is remembered until the next fl_font() call changes it.
It'd be nice if it didn't crash.
I could see fl_font() setting a bit flag that fl_draw() could check,
and either throw an error, or set the font to Helvetica, or draw X's
or some such.
Since font setting brings in the whole font environment (which
is possibly a slow operation when called the first time), I believe
this is why fl_font() is not initialized to a default on start up,
in case the program in question doesn't want to do anything with fonts
(ie. is a shape-drawing only app) and therefore shouldn't suffer font
init overhead.
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev