Browse Source

Fonts: Fixed miscalculation of Ellipsis ("...") character width when automatically created from a single comma character.

ocornut 7 months ago
parent
commit
90094a871a
2 changed files with 4 additions and 2 deletions
  1. 2 0
      docs/CHANGELOG.txt
  2. 2 2
      imgui_draw.cpp

+ 2 - 0
docs/CHANGELOG.txt

@@ -63,6 +63,8 @@ Other changes:
   windows with the ImGuiWindowFlags_NoNavInputs flag. (#8231)
 - Debug Tools: Debug Log: hovering 0xXXXXXXXX values in log is allowed even
   if a popup is blocking mouse access to the debug log window. (#5855)
+- Fonts: Fixed miscalculation of Ellipsis ("...") character width when automatically
+  created from a single comma character, affecting some fonts/settings (not all).
 - Demo: Added label edition to Property Editor demo + fix an ID issue. (#8266) [@moritz-h]
 - Misc: Fixed misc/cpp/imgui_stdlib.h/.cpp not supporting IMGUI_DISABLE. (#8294) [@juur]
 - Backends: Allegro5: Avoid calling al_set_mouse_cursor() repeatedly since it appears

+ 2 - 2
imgui_draw.cpp

@@ -3799,8 +3799,8 @@ void ImFont::BuildLookupTable()
         const ImFontGlyph* glyph = FindGlyph(dot_char);
         EllipsisChar = dot_char;
         EllipsisCharCount = 3;
-        EllipsisCharStep = (glyph->X1 - glyph->X0) + 1.0f;
-        EllipsisWidth = EllipsisCharStep * 3.0f - 1.0f;
+        EllipsisCharStep = (float)(int)(glyph->X1 - glyph->X0) + 1.0f;
+        EllipsisWidth = glyph->X0 + EllipsisCharStep * 3.0f - 1.0f;
     }
 }