> I have tried your method, but still has segm fault. My code
> is as follows:
>
> int main(int argc, char **argv) {
> Fl_Window *window = new Fl_Window(480, 272);
>   Fl_Box *box = new Fl_Box(20,40,260,100,"******");
>   box->box(FL_UP_BOX);
>   box->labelsize(36);
>   Fl_Font my_fnt;

Sorry - I did not make it clear; you must assign a font index value to "my_fnt" 
before you use it with the Fl::set_font(...) method.

In principle, any value between FL_FREE_FONT and 255 ought to work, I think:

        my_fnt = FL_FREE_FONT + 1;

Or a possibly easier approach would be to override one of the fltk built in 
fonts that you are not intending to use anyway... This tends to be what I 
usually do myself:

        my_fnt = FL_TIMES_BOLD_ITALIC;


>   Fl::set_font(my_fnt, "WenQuanYi Zen Hei");

Another quirk of the fltk font handling is to do with the way font names are 
handled internally (and I do not think this is explicitly documented 
anywhere...)

The upshot is that your code will be more portable if the font name is defined 
with a leading space before it like this:

        Fl::set_font(my_fnt, " WenQuanYi Zen Hei");


>   box->labelfont(my_fnt);
>   box->labeltype(FL_SHADOW_LABEL);
>   window->end();
>   window->show(argc, argv);
>   return Fl::run();
> }
>


You do not say whether the "utf8" or "font" demos run correctly on your target?





_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to