From: ehofman Date: Tue, 3 May 2005 11:58:33 +0000 (+0000) Subject: Make it possible to define a different font for the labels X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2c3b8e075c53e07b9207dbb0570724d835f47f4a;p=flightgear.git Make it possible to define a different font for the labels --- diff --git a/src/GUI/dialog.cxx b/src/GUI/dialog.cxx index 22ad22c22..eb90de044 100644 --- a/src/GUI/dialog.cxx +++ b/src/GUI/dialog.cxx @@ -546,20 +546,21 @@ FGDialog::setupObject (puObject * object, SGPropertyNode * props) if (props->hasValue("label")) object->setLabel(props->getStringValue("label")); -#if 0 - if (props->hasValue("style")) { - int style = PUSTYLE_DEFAULT; - string s = props->getStringValue("style"); - if (s == "underline") style = PUSTYLE_SPECIAL_UNDERLINED; - else if (s == "small-bevelled") style = PUSTYLE_SMALL_BEVELLED; - else if (s == "small-shaded") style = PUSTYLE_SMALL_SHADED; - else if (s == "boxed") style = PUSTYLE_BOXED; - else if (s == "bevelled") style = PUSTYLE_BEVELLED; - else if (s == "shaded") style = PUSTYLE_SHADED; - else if (s == "dropshadow") style = PUSTYLE_DROPSHADOW; - object->setStyle(style); + if ( SGPropertyNode *nft = props->getNode("font", false) ) { + SGPath path( _font_path ); + string name = props->getStringValue("name"); + float size = props->getFloatValue("size", 13.0); + float slant = props->getFloatValue("slant", 0.0); + if ( name.empty() ) name = "typewriter"; + path.append( name ); + path.concat( ".txf" ); + + fntFont *font = new fntTexFont; + font->load( (char *)path.c_str() ); + + puFont lfnt(font, size, slant); + object->setLabelFont( lfnt ); } -#endif if ( SGPropertyNode *ncs = props->getNode("color", false) ) { sgVec4 color; diff --git a/src/GUI/dialog.hxx b/src/GUI/dialog.hxx index f081d88c0..55b0f9061 100644 --- a/src/GUI/dialog.hxx +++ b/src/GUI/dialog.hxx @@ -12,6 +12,7 @@ #include // for SG_USING_STD #include +#include #include SG_USING_STD(vector); @@ -141,6 +142,8 @@ private: // dialog closes. char ** make_char_array (int size); vector _char_arrays; + + SGPath _font_path; }; //