Fontsize proportional to screen resolution?

Corak55

13-09-2015 20:59:34

Dear fellowers,

for an application I'd like to set a text with MyGUI that uses the same space relative to the screen resolution (let's say 5% of the screen width). How can I set such a proportion?

Kind regards
Corak

Crystal Hammer

14-09-2015 13:35:07

Yeah that'd be great to have that done in MyGui already, but it's not.
I'm doing it by creating fonts in code, and passing a font size determined by some constant multiplied by screen height.
Have to do that on start and on resolution changes which doesn't work for me.
There is some code that creates font in mygui\Tools\FontEditor\FontExportSerializer.cpp in generateFont* methods.
Or just search for MyGUI::ResourceTrueTypeFont* font = MyGUI::FactoryManager::getInstance().createObject<MyGUI::ResourceTrueTypeFont> on web.
Also see this topic: viewtopic.php?f=17&t=30293 with my code for it in CreateFonts().