Pre-submission Checklist
Hexa.NET.ImGui Version
2.2.9
Bug Description
ImFontConfig is initialized with all fields being 0, null, or otherwise default.
However, this is not correct, and attempting to use an ImFontConfig created this way causes errors.
As per https://github.com/ocornut/imgui/blob/1bcc23ef123869240971427902b32109c8157e24/imgui_draw.cpp#L2418, the following values need to have different defaults:
FontDataOwnedByAtlas should default to true
ExtraSizeScale should default to 1 (currently not exposed?)
GlyphMaxAdvanceX should default to float.MaxValue
RasterizerMultiply should default to 1
RasterizerDensity should default to 1
Steps to Reproduce
- Create a new
ImFontConfig
- Attempt to use it (for example, in
AddFontFromMemoryTTF)
- You will receive an error
Assertion failed: font_cfg_in->RasterizerDensity > 0.0f && "Is ImFontConfig struct correctly initialized?"
Expected Behavior
The font is added and later rendered with no errors.
Code Sample
ImFontConfig config = new();
byte[] fontData = ...;
fixed (byte* fontDataPtr = fontData)
ImGui.GetIO().Fonts.AddFontFromMemoryTTF(fontDataPtr, fontData.Length, 16, &config);
Platform
All
.NET Version
net9.0
Additional Context
After initializing the values to their current defaults, there are no further issues.
Pre-submission Checklist
Hexa.NET.ImGui Version
2.2.9
Bug Description
ImFontConfigis initialized with all fields being 0, null, or otherwise default.However, this is not correct, and attempting to use an
ImFontConfigcreated this way causes errors.As per https://github.com/ocornut/imgui/blob/1bcc23ef123869240971427902b32109c8157e24/imgui_draw.cpp#L2418, the following values need to have different defaults:
FontDataOwnedByAtlasshould default totrueExtraSizeScaleshould default to1(currently not exposed?)GlyphMaxAdvanceXshould default tofloat.MaxValueRasterizerMultiplyshould default to1RasterizerDensityshould default to1Steps to Reproduce
ImFontConfigAddFontFromMemoryTTF)Assertion failed: font_cfg_in->RasterizerDensity > 0.0f && "Is ImFontConfig struct correctly initialized?"Expected Behavior
The font is added and later rendered with no errors.
Code Sample
Platform
All
.NET Version
net9.0
Additional Context
After initializing the values to their current defaults, there are no further issues.