mirror of
https://github.com/ocornut/imgui.git
synced 2025-12-22 14:19:04 +00:00
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_sdlgpu3.cpp # imgui.cpp
This commit is contained in:
@@ -2637,6 +2637,7 @@ ImFontAtlas::ImFontAtlas()
|
||||
TexMinHeight = 128;
|
||||
TexMaxWidth = 8192;
|
||||
TexMaxHeight = 8192;
|
||||
TexRef._TexID = ImTextureID_Invalid;
|
||||
RendererHasTextures = false; // Assumed false by default, as apps can call e.g Atlas::Build() after backend init and before ImGui can update.
|
||||
TexNextUniqueID = 1;
|
||||
FontNextUniqueID = 1;
|
||||
@@ -3368,11 +3369,7 @@ void ImFontAtlasBuildMain(ImFontAtlas* atlas)
|
||||
{
|
||||
IM_ASSERT(!atlas->Locked && "Cannot modify a locked ImFontAtlas!");
|
||||
if (atlas->TexData && atlas->TexData->Format != atlas->TexDesiredFormat)
|
||||
{
|
||||
ImVec2i new_tex_size = ImFontAtlasTextureGetSizeEstimate(atlas);
|
||||
ImFontAtlasBuildDestroy(atlas);
|
||||
ImFontAtlasTextureAdd(atlas, new_tex_size.x, new_tex_size.y);
|
||||
}
|
||||
ImFontAtlasBuildClear(atlas);
|
||||
|
||||
if (atlas->Builder == NULL)
|
||||
ImFontAtlasBuildInit(atlas);
|
||||
@@ -4578,15 +4575,16 @@ static bool ImGui_ImplStbTrueType_FontSrcInit(ImFontAtlas* atlas, ImFontConfig*
|
||||
}
|
||||
src->FontLoaderData = bd_font_data;
|
||||
|
||||
const float ref_size = src->DstFont->Sources[0]->SizePixels;
|
||||
if (src->MergeMode && src->SizePixels == 0.0f)
|
||||
src->SizePixels = src->DstFont->Sources[0]->SizePixels;
|
||||
src->SizePixels = ref_size;
|
||||
|
||||
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);
|
||||
if (src->MergeMode && src->SizePixels != 0.0f)
|
||||
bd_font_data->ScaleFactor *= src->SizePixels / src->DstFont->Sources[0]->SizePixels; // FIXME-NEWATLAS: Should tidy up that a bit
|
||||
if (src->MergeMode && src->SizePixels != 0.0f && ref_size != 0.0f)
|
||||
bd_font_data->ScaleFactor *= src->SizePixels / ref_size; // FIXME-NEWATLAS: Should tidy up that a bit
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user