Thorsten wrote in Mon Sep 05, 2016 8:28 am:Hooray sketched it:you can set up a font mapper, and you can set up an appropriate osgText/CanvasText hierarchy and then use props.copy() to use that as a template
(don't ask me to translate it... it'd take some delving into things).
I wonder if there's a cheaper hack just re-defining the font mapping function on the canvas directly... But it seems the canvas developers did not forsee the need to do font changes by group
This might be an idea that should be added to the wiki to preserve the idea - it should be relatively straightforward to support the font-property per group and recursively dispatch the event to all child elements - I haven't looked at the source code in months, but I'd be surprised if it takes more than 10 lines of C++ code to change the Canvas::Element/Group classes to dispatch the font-mapper property recursively - it should be sufficient to look at other events (properties) that trigger recursive updates (event handling comes to mind).
Broadly speaking, in the C++ code, there is the equivalent of a listener registered that parses the name of the modified property in the Canvas sub-tree hierarchy, if it matches a name that is mapped to a supported event, it will then process that event by parsing the value of the corresponding property, and then recursively call the corresponding event handler for it child elements.
What this means is that the sc::Group code would need to be extended to specifically dispatch font-mapping related updates to all Canvas::Text child elements.
Anybody interested in having a look should review the CanvasText.cxx file, which implements a base class inheriting from Canvas::Element (in SimGear/canvas), the font-mapping stuff should be in there - it would need to be reviewed, generalized and also added to sc::CanvasGroup.cxx
HTH