diff --git a/HellionChat/Util/ImGuiUtil.cs b/HellionChat/Util/ImGuiUtil.cs index 6714aef..db36fe0 100755 --- a/HellionChat/Util/ImGuiUtil.cs +++ b/HellionChat/Util/ImGuiUtil.cs @@ -786,9 +786,14 @@ internal static class ImGuiUtil private static unsafe int CalcWordWrap(byte* basePtr, int start, int end, float width) { + var font = ImGui.GetFont(); + // ImGui reads this as size / FontSize (imgui_draw.cpp, CalcTextSizeA), not + // as UI scale. The two match only while every font is built at + // SizePx * GlobalScale, which stops holding the moment a second size + // enters a line. var result = ImGuiNative.CalcWordWrapPositionA( - ImGui.GetFont().Handle, - ImGuiHelpers.GlobalScale, + font.Handle, + ImGui.GetFontSize() / font.FontSize, basePtr + start, basePtr + end, width