diff --git a/misc/freetype/imgui_freetype.cpp b/misc/freetype/imgui_freetype.cpp index 43cc8a334..960f949a4 100644 --- a/misc/freetype/imgui_freetype.cpp +++ b/misc/freetype/imgui_freetype.cpp @@ -451,6 +451,7 @@ static bool ImGui_ImplFreeType_FontBakedInit(ImFontAtlas* atlas, ImFontConfig* s if (ImFabs(cur_height - size) < 0.001f) { best_index = i; + best_height = cur_height; break; } else if (cur_height < size) @@ -463,7 +464,7 @@ static bool ImGui_ImplFreeType_FontBakedInit(ImFontAtlas* atlas, ImFontConfig* s } else { - if (best_height > cur_height) + if (best_height < size && best_height < cur_height) { best_index = i; best_height = cur_height;