summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/fltkplatform.cc25
-rw-r--r--dw/fltkplatform.hh2
2 files changed, 26 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);
diff --git a/dw/fltkplatform.hh b/dw/fltkplatform.hh
index f681f91a..d26dad09 100644
--- a/dw/fltkplatform.hh
+++ b/dw/fltkplatform.hh
@@ -14,6 +14,8 @@ namespace fltk {
class FltkFont: public core::style::Font
{
+ static lout::container::typed::HashTable <lout::object::ConstString,
+ lout::object::Integer> *systemFonts;
static lout::container::typed::HashTable <dw::core::style::FontAttrs,
FltkFont> *fontsTable;