diff options
| author | Manolo Gouy <Manolo> | 2015-04-28 22:02:48 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2015-04-28 22:02:48 +0000 |
| commit | f9fa74e3af0b53102ade659a7a2aa12ddf9ee9a3 (patch) | |
| tree | 01b108a2daa98f5caa6dc3aa15c9067b95ae76fd /src/fl_set_font.cxx | |
| parent | 1c7daeca631f6bbf88b99f9ecd79a5cedd64f550 (diff) | |
Restored the possibility to call Fl::set_font()
in a global initializer (before main() starts).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10726 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_set_font.cxx')
| -rw-r--r-- | src/fl_set_font.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/fl_set_font.cxx b/src/fl_set_font.cxx index 777b6e417..865f8f00d 100644 --- a/src/fl_set_font.cxx +++ b/src/fl_set_font.cxx @@ -32,6 +32,9 @@ static int table_size; the string is not copied, so the string must be in static memory. */ void Fl::set_font(Fl_Font fnum, const char* name) { +#ifdef __APPLE__ + if (!fl_fonts) fl_fonts = Fl_X::calc_fl_fonts(); +#endif while (fnum >= table_size) { int i = table_size; if (!i) { // don't realloc the built-in table @@ -70,7 +73,7 @@ void Fl::set_font(Fl_Font fnum, const char* name) { s->xlist = 0; #endif s->first = 0; - fl_font(-1, 0); + Fl_Display_Device::display_device()->driver()->font(-1, 0); } /** Copies one face to another. */ void Fl::set_font(Fl_Font fnum, Fl_Font from) { @@ -81,7 +84,12 @@ void Fl::set_font(Fl_Font fnum, Fl_Font from) { face. Under X this value is passed to XListFonts to get all the sizes of this face. */ -const char* Fl::get_font(Fl_Font fnum) {return fl_fonts[fnum].name;} +const char* Fl::get_font(Fl_Font fnum) { +#ifdef __APPLE__ + if (!fl_fonts) fl_fonts = Fl_X::calc_fl_fonts(); +#endif + return fl_fonts[fnum].name; +} // // End of "$Id$". |
