Browse Source

Fonts: fixed passing negative sizes to stb_truetype loader.

ocornut 2 months ago
parent
commit
402db2ef32
1 changed files with 2 additions and 2 deletions
  1. 2 2
      imgui_draw.cpp

+ 2 - 2
imgui_draw.cpp

@@ -4530,10 +4530,10 @@ static bool ImGui_ImplStbTrueType_FontSrcInit(ImFontAtlas* atlas, ImFontConfig*
     }
     src->FontLoaderData = bd_font_data;
 
-    if (src->SizePixels > 0.0f)
+    if (src->SizePixels >= 0.0f)
         bd_font_data->ScaleFactor = stbtt_ScaleForPixelHeight(&bd_font_data->FontInfo, 1.0f);
     else
-        bd_font_data->ScaleFactor = -stbtt_ScaleForMappingEmToPixels(&bd_font_data->FontInfo, 1.0f);
+        bd_font_data->ScaleFactor = stbtt_ScaleForMappingEmToPixels(&bd_font_data->FontInfo, 1.0f);
     if (src != src->DstFont->Sources[0])
         bd_font_data->ScaleFactor *= src->SizePixels / src->DstFont->Sources[0]->SizePixels; // FIXME-NEWATLAS: Should tidy up that a bit