mirror of
https://github.com/ocornut/imgui.git
synced 2025-09-05 19:08:19 +00:00
Fonts: fixed NewFrame() when atlas builder has been created but fonts not added. Fixed GetCustomRect() after atlas clear.
This commit is contained in:
@@ -8668,7 +8668,7 @@ ImFont* ImGui::GetDefaultFont()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImFontAtlas* atlas = g.IO.Fonts;
|
||||
if (atlas->Builder == NULL)
|
||||
if (atlas->Builder == NULL || atlas->Fonts.Size == 0)
|
||||
ImFontAtlasBuildMain(atlas);
|
||||
return g.IO.FontDefault ? g.IO.FontDefault : atlas->Fonts[0];
|
||||
}
|
||||
|
@@ -4362,6 +4362,8 @@ ImTextureRect* ImFontAtlasPackGetRectSafe(ImFontAtlas* atlas, ImFontAtlasRectId
|
||||
if (id == ImFontAtlasRectId_Invalid)
|
||||
return NULL;
|
||||
int index_idx = ImFontAtlasRectId_GetIndex(id);
|
||||
if (atlas->Builder == NULL)
|
||||
ImFontAtlasBuildInit(atlas);
|
||||
ImFontAtlasBuilder* builder = (ImFontAtlasBuilder*)atlas->Builder;
|
||||
if (index_idx >= builder->RectsIndex.Size)
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user