WidgetFontManager explanation

Howdy,



I took a closer look at WidgetFontManager and I was mistaken about how it works. To much code, not enough neurons. :slight_smile:



WidgetFontManager is a singleton, however init() needs to be called before getFont() to instantiate it. WidgetFrameAbstract.init() calls WidgetFontManager.init().



When WidgetFontManager instantiates itself it also tries to load the font file. Currently, loading the font file depends on the Renderer being WidgetLWJGLRender. Thats why it fails in TestBezierCurve.



I think font rendering will need to be Renderer specific. I don’t like WidgetFontManager being aware of specific Renderers. I think DisplaySystem might be a good place to put the Renderer specific font creation. So instead of passing Renderer into WidgetFontManager we can pass DisplaySystem in. We can add a getFont method to DisplaySystem that returns a WidgetFont interface. There by removing the Renderer specific stuff from WidgetFontManager.



Let me know what think about doing it this way.



Thanks,

Gregg

That sounds like a pretty good way to handle it. Go ahead and try that and see if it’s how you’d like it. You might want to consider a way of DisplaySystem returning a WidgetRenderer as well. This way WidgetDisplaySystem can be removed. That’s up to you though.