MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / DebugNodeFont

Method DebugNodeFont

Source/3rdParty/imgui/imgui.cpp:17351–17501  ·  view source on GitHub ↗

[DEBUG] Display details for a single font, called by ShowStyleEditor().

Source from the content-addressed store, hash-verified

17349
17350// [DEBUG] Display details for a single font, called by ShowStyleEditor().
17351void ImGui::DebugNodeFont(ImFont* font)
17352{
17353 ImGuiContext& g = *GImGui;
17354 ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig;
17355 ImFontAtlas* atlas = font->OwnerAtlas;
17356 bool opened = TreeNode(font, "Font: \"%s\": %d sources(s)", font->GetDebugName(), font->Sources.Size);
17357
17358 // Display preview text
17359 if (!opened)
17360 Indent();
17361 Indent();
17362 if (cfg->ShowFontPreview)
17363 {
17364 PushFont(font, 0.0f);
17365 Text("The quick brown fox jumps over the lazy dog");
17366 PopFont();
17367 }
17368 if (!opened)
17369 {
17370 Unindent();
17371 Unindent();
17372 return;
17373 }
17374 if (SmallButton("Set as default"))
17375 GetIO().FontDefault = font;
17376 SameLine();
17377 BeginDisabled(atlas->Fonts.Size <= 1 || atlas->Locked);
17378 if (SmallButton("Remove"))
17379 atlas->RemoveFont(font);
17380 EndDisabled();
17381 SameLine();
17382 if (SmallButton("Clear bakes"))
17383 ImFontAtlasFontDiscardBakes(atlas, font, 0);
17384 SameLine();
17385 if (SmallButton("Clear unused"))
17386 ImFontAtlasFontDiscardBakes(atlas, font, 2);
17387
17388 // Display details
17389#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
17390 SetNextItemWidth(GetFontSize() * 8);
17391 DragFloat("Font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f");
17392 /*SameLine(); MetricsHelpMarker(
17393 "Note that the default embedded font is NOT meant to be scaled.\n\n"
17394 "Font are currently rendered into bitmaps at a given size at the time of building the atlas. "
17395 "You may oversample them to get some flexibility with scaling. "
17396 "You can also render at multiple sizes and select which one to use at runtime.\n\n"
17397 "(Glimmer of hope: the atlas system will be rewritten in the future to make scaling more flexible.)");*/
17398#endif
17399
17400 char c_str[5];
17401 ImTextCharToUtf8(c_str, font->FallbackChar);
17402 Text("Fallback character: '%s' (U+%04X)", c_str, font->FallbackChar);
17403 ImTextCharToUtf8(c_str, font->EllipsisChar);
17404 Text("Ellipsis character: '%s' (U+%04X)", c_str, font->EllipsisChar);
17405
17406 for (int src_n = 0; src_n < font->Sources.Size; src_n++)
17407 {
17408 ImFontConfig* src = font->Sources[src_n];

Callers

nothing calls this directly

Calls 15

PushFontFunction · 0.85
SmallButtonFunction · 0.85
ImTextCharToUtf8Function · 0.85
strcmpFunction · 0.85
TextWrappedFunction · 0.85
BeginTableFunction · 0.85
ImCountSetBitsFunction · 0.85
BulletTextFunction · 0.85

Tested by

no test coverage detected