Openplanet 1.28 is out now, and includes dear imgui's new dynamic fonts code. This opens a whole new world of possibilities that were previously not possible.
Notable changes
Some of the notable changes in this version:
- Loading UI fonts is now practically free in terms of performance. This means no more waiting for
UI::LoadFontto finish, which should greatly improve load times with plugins that were loading fonts. - No more limit on font texture size; previously the game could crash if you would load fonts that are too large. This is no more, as multiple texture pages will be created as they are needed.
- You can now dynamically change the size of fonts using
UI::PushFontorUI::PushFontSize. - Characters are only rasterized when they are needed, so you can render practically every character you wish. Openplanet will by default use fallback fonts to render Japanese and Chinese characters.
- UI scaling is now dynamic as well! The limits are removed, high scales are now possible, and you can change the scaling at runtime without having to restart the game.
This comes at the cost of some small API changes. Generally, you will not need to pass anything extra to UI::LoadFont anymore; fallback fonts for icons and other Unicode characters can now always be used. Ranges are also no longer required, as the full range of characters in any font is always going to be available.
For compatibility with older code, you can still pass a "legacy size" to UI::LoadFont, which will act as a fallback size to use when the UI needs to use a default size (eg. when calling UI::PushFont without a size). Most older code will be written this way and thus will continue to work.
There's now also a new UI::LoadSystemFont function that can be used to load fonts from the C:\Windows\Fonts folder. For example, you can load Comic Sans this way using UI::LoadSystemFont("comic.ttf").
Enjoy! If you find any bugs with the new UI updates, please report them on Github.