fighting with fonts
font-management rabbit hole in the theme editor… still wip
changes
font management in the theme editor
the theme editor now has a proper Fonts section
- import
.ttf/.otffonts directly from the editor - assign fonts to roles like Body, Bold, Monospace, Icons, etc.
- merge fonts together so icon fonts can be stacked on top of regular fonts
- rename, delete, and change the size of fonts
- fontsets are now saved as part of the theme, so imported fonts persist across restarts
the role system isn’t fully wired up yet currently Body is used as the default editor font and Monospace is used for the console.
im still working on the whole font management system here and its very unfinished and kinda untested.. very WIP!!!
hot-reloading
the annoying part was getting font changes to work while the renderer is running on another thread.
rebuilding the ImGui font atlas in the middle of a frame was… not ideal, and eventually resulted in an assertion.
now font changes mark the atlas as dirty, and the editor waits for the render thread to finish before rebuilding the atlas at a safe point.
not the prettiest solution, but it seems to be working.. kind of
dpi & freetype
also experimented with DPI handling for fonts and wrapped FreeType into a single shared instance instead of creating separate instances everywhere.
still figuring out exactly how I want the DPI/font sizing stuff to behave, but it’s getting there.
bug fixes
while doing all of this I also ended up fixing a few unrelated things:
- fixed an old GUI rendering bug where text could stop rendering or become garbled because of a pointer race
- thanks to @staneko for helping test/report that one since I couldn’t reproduce it properly on my system
- fixed a weird compilation issue related to namespace escaping
- bumped the vendored ImGui version for some dynamic font-related fixes
- a few other small UI changes and cleanup
still working on this, and the font management side definitely isn’t finished yet…
most of this time was just spent trying to get it to half-work so.. yep..
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.