diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2011-01-24 23:01:14 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2011-01-24 23:01:14 +0100 |
commit | 074e67a9185980ee6203d0c32e3d240e57245ad2 (patch) | |
tree | 9f0fc16983c6792022490d3463b100dba806715a /dw/fltkplatform.cc | |
parent | 077343565fc72d251b2ef044c82d179b2443d930 (diff) |
some font handling
Diffstat (limited to 'dw/fltkplatform.cc')
-rw-r--r-- | dw/fltkplatform.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc index 90b62734..d74604c9 100644 --- a/dw/fltkplatform.cc +++ b/dw/fltkplatform.cc @@ -41,8 +41,24 @@ container::typed::HashTable <dw::core::style::FontAttrs, new container::typed::HashTable <dw::core::style::FontAttrs, FltkFont> (false, false); +container::typed::HashTable <lout::object::ConstString, + lout::object::Integer> *FltkFont::systemFonts = NULL; + FltkFont::FltkFont (core::style::FontAttrs *attrs) { + if (!systemFonts) { + systemFonts = new container::typed::HashTable + <lout::object::ConstString, lout::object::Integer> (true, true); + + int k = Fl::set_fonts ("-*"); + for (int i = 0; i < k; i++) { + int t; + const char *name = Fl::get_font_name ((Fl_Font) i, &t); + systemFonts->put(new object::ConstString (name), + new object::Integer (i)); + } + } + copyAttrs (attrs); int fa = 0; @@ -61,7 +77,14 @@ PORT1.3 font = FL_HELVETICA->plus (fa); } #else - font = FL_HELVETICA; + object::ConstString *nameString = new object::ConstString (name); + object::Integer *fontIndex = systemFonts->get(nameString); + delete nameString; + if (fontIndex) { + font = fontIndex->getValue (); + } else { + font = FL_HELVETICA; + } #endif fl_font(font, size); |