1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-19 01:24:20 +00:00

Fonts: clarify assert. (#8680)

This commit is contained in:
ocornut 2025-06-12 16:35:51 +02:00
parent 7ac99a4366
commit 1ec1510ef7
2 changed files with 11 additions and 4 deletions

View file

@ -5301,8 +5301,12 @@ static void ImGui::UpdateTexturesNewFrame()
}
else
{
IM_ASSERT(atlas->Builder != NULL && atlas->Builder->FrameCount != -1 && "If you manage font atlases yourself you need to call ImFontAtlasUpdateNewFrame() on it.");
IM_ASSERT(atlas->RendererHasTextures == has_textures && "If you manage font atlases yourself make sure ImGuiBackendFlags_RendererHasTextures is set consistently with atlas->RendererHasTextures as specified in the ImFontAtlasUpdateNewFrame() call.");
// (1) If you manage font atlases yourself, e.g. create a ImFontAtlas yourself you need to call ImFontAtlasUpdateNewFrame() on it.
// Otherwise, calling ImGui::CreateContext() without parameter will create an atlas owned by the context.
// (2) If you have multiple font atlases, make sure the 'atlas->RendererHasTextures' as specified in the ImFontAtlasUpdateNewFrame() call matches for that.
// (3) If you have multiple imgui contexts, they also need to have a matching value for ImGuiBackendFlags_RendererHasTextures.
IM_ASSERT(atlas->Builder != NULL && atlas->Builder->FrameCount != -1);
IM_ASSERT(atlas->RendererHasTextures == has_textures);
}
}
}
@ -16967,7 +16971,7 @@ void ImGui::DebugNodeFont(ImFont* font)
if (baked->ContainerFont != font)
continue;
PushID(baked_n);
if (TreeNode("Glyphs", "Baked at { %.2fpx, d.%.1f }: %d glyphs%s", baked->Size, baked->RasterizerDensity, baked->Glyphs.Size, (baked->LastUsedFrame < atlas->Builder->FrameCount - 1) ? " *Unused*" : ""))
if (TreeNode("Glyphs", "Baked at { %.2fpx, d.%.2f }: %d glyphs%s", baked->Size, baked->RasterizerDensity, baked->Glyphs.Size, (baked->LastUsedFrame < atlas->Builder->FrameCount - 1) ? " *Unused*" : ""))
{
if (SmallButton("Load all"))
for (unsigned int base = 0; base <= IM_UNICODE_CODEPOINT_MAX; base++)