I'm currently making a GUI in OpenGL and C++. The systems uses a family tree style structure, where each element has a number of child elements. A window say, could have several buttons and sliders as its children, for example. Each element has fields such as position, width and height etc. associated with it. All elements however use the same font for their text labels. I'm not sure where the best place for the UI's font would be. It would seem wasteful for each element to have a "font" field as it would be exactly the same for each element. Another thought was to have some sort of "UserInterface" class which would house the root element of the system, and therefore indirectly, all its children too. If the UI font was associated with this UserInterface class however, how would each element have access to it without every single element having a pointer to it? This seems a hacky way of doing things.
You can store a font pointer in all of your objects. If it's null, the system can default to a given font (the root item's font). Otherwise it can use its own. In my UI (which was written for a camera, not a desktop game), each window/widget in the tree has a pointer to a decorator object. The decorator contains all kinds of information about things like border thickness, background colour, font colour, font size and so on. If the decorator object is null for any given node in the tree, the node defers to the default decorator, otherwise it uses its own. Making changes to the properties of the default decorator and then redrawing causes all items in the tree that don't have their own decoration to change too.
The truth of the matter is that if you want to give your widget the ability to have a different font, it follows that each widget must at least contain a pointer to a font, even if they're all pointing to the same, default font initially.