allow top level <font> definition that applies to text in the whole dialog
and makes the layouter use this font's metrics
This commit is contained in:
parent
6c331a55a8
commit
cabf53537a
2 changed files with 14 additions and 2 deletions
|
@ -420,8 +420,14 @@ FGDialog::display (SGPropertyNode * props)
|
||||||
// Let the layout widget work in the same property subtree.
|
// Let the layout widget work in the same property subtree.
|
||||||
LayoutWidget wid(props);
|
LayoutWidget wid(props);
|
||||||
|
|
||||||
puFont *fnt = _gui->getDefaultFont();
|
SGPropertyNode *fontnode = props->getNode("font");
|
||||||
wid.setDefaultFont(fnt, int(fnt->getPointSize()));
|
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 pw=0, ph=0;
|
||||||
int px, py, savex, savey;
|
int px, py, savex, savey;
|
||||||
|
@ -681,6 +687,8 @@ FGDialog::setupObject (puObject * object, SGPropertyNode * props)
|
||||||
FGFontCache *fc = _gui->get_fontcache();
|
FGFontCache *fc = _gui->get_fontcache();
|
||||||
puFont *lfnt = fc->get(nft);
|
puFont *lfnt = fc->get(nft);
|
||||||
object->setLabelFont(*lfnt);
|
object->setLabelFont(*lfnt);
|
||||||
|
} else {
|
||||||
|
object->setLabelFont(*_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props->hasValue("property")) {
|
if (props->hasValue("property")) {
|
||||||
|
|
|
@ -142,6 +142,10 @@ private:
|
||||||
// The GUI subsystem.
|
// The GUI subsystem.
|
||||||
NewGUI * _gui;
|
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
|
// PUI provides no way for userdata to be deleted automatically
|
||||||
// with a GUI object, so we have to keep track of all the special
|
// 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
|
// data we allocated and then free it manually when the dialog
|
||||||
|
|
Loading…
Reference in a new issue