mirror of
https://github.com/ocornut/imgui.git
synced 2025-10-22 17:11:35 +00:00
Fonts: fixed an issue when a font using MergeMode has a reference size specified but the target font doesn't.
This commit is contained in:
@@ -46,6 +46,10 @@ Breaking Changes:
|
|||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
|
- Fonts: fixed an issue when a font using MergeMode has a reference size
|
||||||
|
specified but the target font doesn't. Usually either all fonts should
|
||||||
|
have a reference size (only required when specifying e.g. GlyphOffset),
|
||||||
|
or none should have a reference size.
|
||||||
- Windows: fixed an issue where resizable child windows would emit border
|
- Windows: fixed an issue where resizable child windows would emit border
|
||||||
logic when hidden/non-visible (e.g. when in a docked window that is not
|
logic when hidden/non-visible (e.g. when in a docked window that is not
|
||||||
selected), impacting code not checking for BeginChild() return value. (#8815)
|
selected), impacting code not checking for BeginChild() return value. (#8815)
|
||||||
|
@@ -4573,15 +4573,16 @@ static bool ImGui_ImplStbTrueType_FontSrcInit(ImFontAtlas* atlas, ImFontConfig*
|
|||||||
}
|
}
|
||||||
src->FontLoaderData = bd_font_data;
|
src->FontLoaderData = bd_font_data;
|
||||||
|
|
||||||
|
const float ref_size = src->DstFont->Sources[0]->SizePixels;
|
||||||
if (src->MergeMode && src->SizePixels == 0.0f)
|
if (src->MergeMode && src->SizePixels == 0.0f)
|
||||||
src->SizePixels = src->DstFont->Sources[0]->SizePixels;
|
src->SizePixels = ref_size;
|
||||||
|
|
||||||
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->MergeMode && src->SizePixels != 0.0f)
|
if (src->MergeMode && src->SizePixels != 0.0f && ref_size != 0.0f)
|
||||||
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 / ref_size; // FIXME-NEWATLAS: Should tidy up that a bit
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user