1
0
Fork 0

Make it possible to define a different font for the labels

This commit is contained in:
ehofman 2005-05-03 11:58:33 +00:00
parent d6e42c9e89
commit 2c3b8e075c
2 changed files with 17 additions and 13 deletions

View file

@ -546,20 +546,21 @@ FGDialog::setupObject (puObject * object, SGPropertyNode * props)
if (props->hasValue("label")) if (props->hasValue("label"))
object->setLabel(props->getStringValue("label")); object->setLabel(props->getStringValue("label"));
#if 0 if ( SGPropertyNode *nft = props->getNode("font", false) ) {
if (props->hasValue("style")) { SGPath path( _font_path );
int style = PUSTYLE_DEFAULT; string name = props->getStringValue("name");
string s = props->getStringValue("style"); float size = props->getFloatValue("size", 13.0);
if (s == "underline") style = PUSTYLE_SPECIAL_UNDERLINED; float slant = props->getFloatValue("slant", 0.0);
else if (s == "small-bevelled") style = PUSTYLE_SMALL_BEVELLED; if ( name.empty() ) name = "typewriter";
else if (s == "small-shaded") style = PUSTYLE_SMALL_SHADED; path.append( name );
else if (s == "boxed") style = PUSTYLE_BOXED; path.concat( ".txf" );
else if (s == "bevelled") style = PUSTYLE_BEVELLED;
else if (s == "shaded") style = PUSTYLE_SHADED; fntFont *font = new fntTexFont;
else if (s == "dropshadow") style = PUSTYLE_DROPSHADOW; font->load( (char *)path.c_str() );
object->setStyle(style);
puFont lfnt(font, size, slant);
object->setLabelFont( lfnt );
} }
#endif
if ( SGPropertyNode *ncs = props->getNode("color", false) ) { if ( SGPropertyNode *ncs = props->getNode("color", false) ) {
sgVec4 color; sgVec4 color;

View file

@ -12,6 +12,7 @@
#include <simgear/compiler.h> // for SG_USING_STD #include <simgear/compiler.h> // for SG_USING_STD
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <simgear/misc/sg_path.hxx>
#include <vector> #include <vector>
SG_USING_STD(vector); SG_USING_STD(vector);
@ -141,6 +142,8 @@ private:
// dialog closes. // dialog closes.
char ** make_char_array (int size); char ** make_char_array (int size);
vector<char **> _char_arrays; vector<char **> _char_arrays;
SGPath _font_path;
}; };
// //