Hello,
I'm working on a Vintage Story mod that uses VSImGui for displaying the interface. I'm encountering an issue with displaying Polish diacritical characters (ą, ę, ć, etc.) in the ImGui interface.
I tried loading a custom font with Polish character support in the following way:
private ImFontPtr? customFont = null;
// In the constructor:
private void LoadCustomFont()
{
try
{
string fontPath = Path.Combine(..., "Arial.ttf");
if (File.Exists(fontPath))
{
var io = ImGui.GetIO();
customFont = io.Fonts.AddFontFromFileTTF(fontPath, 16.0f);
// Logs indicate the font was loaded successfully
}
}
catch (Exception ex)
{
// Error handling
}
}
// When rendering:
if (customFont.HasValue)
{
ImGui.PushFont(customFont.Value);
}
// ... drawing interface ...
if (customFont.HasValue)
{
ImGui.PopFont();
}
Unfortunately, after using ImGui.PushFont(customFont.Value), the game crashes without any error message.
Has anyone encountered a similar issue? Is there a recommended way to implement support for non-ASCII characters in VSImGui?
I also tried using Unicode codes directly (\u0105 for 'ą', etc.), but without success.
Thank you in advance for any suggestions!