Custom Fonts
Want to add a custom fancy font to your plugin? It’s really easy! You can use any .ttf font, although many have copyrights. Check out https://fonts.google.com/ for a bunch of free fonts to use.
First, make a pointer to save your font. Do this in your .h as a variable
|
|
Next load the font using the GUIManager. This can be done pretty much anywhere, but I recommend using your OnLoad or SetImGuiContext functions. OnLoad happens at startup of the plugin, and SetImGuiContext happens when the plugin’s ImGui is initialized. Either will hopefully ensure your font is loaded before you use it (barring any errors)
|
|
Finally use the font in your ImGui code. Remember that when you push a font, you have to pop it when you’re done.
|
|
Here’s an example using the open source Ubuntu font, as compared to the ImGui default
The code for this is taken from Martinn’s awesome custom font example. I just made this page to get more visibility for it.