]> git.mxchange.org Git - flightgear.git/commitdiff
Make it possible to define a different font for the labels
authorehofman <ehofman>
Tue, 3 May 2005 11:58:33 +0000 (11:58 +0000)
committerehofman <ehofman>
Tue, 3 May 2005 11:58:33 +0000 (11:58 +0000)
src/GUI/dialog.cxx
src/GUI/dialog.hxx

index 22ad22c22d4fb4578db139c79d4a3e6b04f60539..eb90de044e90d0ffe1d2b496cdffd3eb3c5b4e0f 100644 (file)
@@ -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;
index f081d88c0e4c07900a167a568f5b303d290daca7..55b0f9061b502f276f816e3079bbc70e88648cef 100644 (file)
@@ -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;
 };
 
 //