Make it possible to define a different font for the labels
This commit is contained in:
parent
d6e42c9e89
commit
2c3b8e075c
2 changed files with 17 additions and 13 deletions
|
@ -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;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <simgear/compiler.h> // for SG_USING_STD
|
||||
#include <simgear/props/props.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
||||
#include <vector>
|
||||
SG_USING_STD(vector);
|
||||
|
@ -141,6 +142,8 @@ private:
|
|||
// dialog closes.
|
||||
char ** make_char_array (int size);
|
||||
vector<char **> _char_arrays;
|
||||
|
||||
SGPath _font_path;
|
||||
};
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue