diff --git a/Dalamud/Interface/Utility/ImGuiHelpers.cs b/Dalamud/Interface/Utility/ImGuiHelpers.cs
index e3b0ff8d1..444463d41 100644
--- a/Dalamud/Interface/Utility/ImGuiHelpers.cs
+++ b/Dalamud/Interface/Utility/ImGuiHelpers.cs
@@ -314,6 +314,7 @@ public static class ImGuiHelpers
glyph->U1,
glyph->V1,
glyph->AdvanceX * scale);
+ target.Mark4KPageUsedAfterGlyphAdd((ushort)glyph->Codepoint);
changed = true;
}
else if (!missingOnly)
@@ -415,6 +416,8 @@ public static class ImGuiHelpers
/// If returns null.
public static unsafe void* AllocateMemory(int length)
{
+ // TODO: igMemAlloc takes size_t, which is nint; ImGui.NET apparently interpreted that as uint.
+ // fix that in ImGui.NET.
switch (length)
{
case 0:
@@ -436,35 +439,6 @@ public static class ImGuiHelpers
}
}
- ///
- /// Mark 4K page as used, after adding a codepoint to a font.
- ///
- /// The font.
- /// The codepoint.
- public static unsafe void Mark4KPageUsedAfterGlyphAdd(this ImFontPtr font, ushort codepoint)
- {
- // Mark 4K page as used
- var pageIndex = unchecked((ushort)(codepoint / 4096));
- font.NativePtr->Used4kPagesMap[pageIndex >> 3] |= unchecked((byte)(1 << (pageIndex & 7)));
- }
-
- ///
- /// Creates a new instance of with a natively backed memory.
- ///
- /// The created instance.
- /// Disposable you can call.
- public static unsafe IDisposable NewFontAtlasPtrScoped(out ImFontAtlasPtr font)
- {
- font = new(ImGuiNative.ImFontAtlas_ImFontAtlas());
- var ptr = font.NativePtr;
- return Disposable.Create(() =>
- {
- if (ptr != null)
- ImGuiNative.ImFontAtlas_destroy(ptr);
- ptr = null;
- });
- }
-
///
/// Creates a new instance of with a natively backed memory.
///
@@ -557,6 +531,18 @@ public static class ImGuiHelpers
/// if it is not default; otherwise, .
public static unsafe ImFontPtr OrElse(this ImFontPtr self, ImFontPtr other) =>
self.NativePtr is null ? other : self;
+
+ ///
+ /// Mark 4K page as used, after adding a codepoint to a font.
+ ///
+ /// The font.
+ /// The codepoint.
+ internal static unsafe void Mark4KPageUsedAfterGlyphAdd(this ImFontPtr font, ushort codepoint)
+ {
+ // Mark 4K page as used
+ var pageIndex = unchecked((ushort)(codepoint / 4096));
+ font.NativePtr->Used4kPagesMap[pageIndex >> 3] |= unchecked((byte)(1 << (pageIndex & 7)));
+ }
///
/// Finds the corresponding ImGui viewport ID for the given window handle.