diff --git a/src/GUI/dialog.cxx b/src/GUI/dialog.cxx index f6f48a783..450b1977f 100644 --- a/src/GUI/dialog.cxx +++ b/src/GUI/dialog.cxx @@ -420,8 +420,14 @@ FGDialog::display (SGPropertyNode * props) // Let the layout widget work in the same property subtree. LayoutWidget wid(props); - puFont *fnt = _gui->getDefaultFont(); - wid.setDefaultFont(fnt, int(fnt->getPointSize())); + SGPropertyNode *fontnode = props->getNode("font"); + if (fontnode) { + FGFontCache *fc = _gui->get_fontcache(); + _font = fc->get(fontnode); + } else { + _font = _gui->getDefaultFont(); + } + wid.setDefaultFont(_font, int(_font->getPointSize())); int pw=0, ph=0; int px, py, savex, savey; @@ -681,6 +687,8 @@ FGDialog::setupObject (puObject * object, SGPropertyNode * props) FGFontCache *fc = _gui->get_fontcache(); puFont *lfnt = fc->get(nft); object->setLabelFont(*lfnt); + } else { + object->setLabelFont(*_font); } if (props->hasValue("property")) { diff --git a/src/GUI/dialog.hxx b/src/GUI/dialog.hxx index 295945e95..ef0cd4e93 100644 --- a/src/GUI/dialog.hxx +++ b/src/GUI/dialog.hxx @@ -142,6 +142,10 @@ private: // The GUI subsystem. NewGUI * _gui; + // The dialog font. Defaults to the global gui font, but can get + // overridden by a top level font definition. + puFont * _font; + // PUI provides no way for userdata to be deleted automatically // with a GUI object, so we have to keep track of all the special // data we allocated and then free it manually when the dialog