mirror of
https://github.com/ocornut/imgui.git
synced 2026-06-02 03:00:39 +08:00
Fonts: fixed passing negative sizes to stb_truetype loader.
This commit is contained in:
+2
-2
@@ -4530,10 +4530,10 @@ static bool ImGui_ImplStbTrueType_FontSrcInit(ImFontAtlas* atlas, ImFontConfig*
|
|||||||
}
|
}
|
||||||
src->FontLoaderData = bd_font_data;
|
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);
|
bd_font_data->ScaleFactor = stbtt_ScaleForPixelHeight(&bd_font_data->FontInfo, 1.0f);
|
||||||
else
|
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])
|
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
|
bd_font_data->ScaleFactor *= src->SizePixels / src->DstFont->Sources[0]->SizePixels; // FIXME-NEWATLAS: Should tidy up that a bit
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user