1
0
mirror of https://github.com/ocornut/imgui.git synced 2025-02-02 12:37:20 +01:00

Debug Tools: Tweaked font preview + indent "Glyphs" block.

This commit is contained in:
ocornut 2025-01-22 16:56:18 +01:00
parent 6906ac979e
commit 71da34c48c
2 changed files with 57 additions and 47 deletions

View File

@ -73,6 +73,7 @@ Other changes:
for rounded tabs. Reduced default thickness (style.TabBarOverlineSize), for rounded tabs. Reduced default thickness (style.TabBarOverlineSize),
increased default rounding (style.TabRounding). (#8334) [@Kian738, @ocornut] increased default rounding (style.TabRounding). (#8334) [@Kian738, @ocornut]
styles as the current look is not right (but ImGuiCol_TabSelectedOverline stays the same). styles as the current look is not right (but ImGuiCol_TabSelectedOverline stays the same).
- Debug Tools: Tweaked font preview.
- Examples: DirectX12: Reduced number of frame in flight from 3 to 2 in - Examples: DirectX12: Reduced number of frame in flight from 3 to 2 in
provided example, to reduce latency. provided example, to reduce latency.
- Examples: Vulkan: better handle VK_SUBOPTIMAL_KHR being returned by - Examples: Vulkan: better handle VK_SUBOPTIMAL_KHR being returned by

View File

@ -16147,18 +16147,24 @@ void ImGui::DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList* out_draw_list, co
// [DEBUG] Display details for a single font, called by ShowStyleEditor(). // [DEBUG] Display details for a single font, called by ShowStyleEditor().
void ImGui::DebugNodeFont(ImFont* font) void ImGui::DebugNodeFont(ImFont* font)
{ {
bool opened = TreeNode(font, "Font: \"%s\"\n%.2f px, %d glyphs, %d file(s)", bool opened = TreeNode(font, "Font: \"%s\": %.2f px, %d glyphs, %d sources(s)",
font->ConfigData ? font->ConfigData[0].Name : "", font->FontSize, font->Glyphs.Size, font->ConfigDataCount); font->ConfigData ? font->ConfigData[0].Name : "", font->FontSize, font->Glyphs.Size, font->ConfigDataCount);
SameLine();
if (SmallButton("Set as default"))
GetIO().FontDefault = font;
if (!opened)
return;
// Display preview text // Display preview text
if (!opened)
Indent();
Indent();
PushFont(font); PushFont(font);
Text("The quick brown fox jumps over the lazy dog"); Text("The quick brown fox jumps over the lazy dog");
PopFont(); PopFont();
if (!opened)
{
Unindent();
Unindent();
return;
}
if (SmallButton("Set as default"))
GetIO().FontDefault = font;
// Display details // Display details
SetNextItemWidth(GetFontSize() * 8); SetNextItemWidth(GetFontSize() * 8);
@ -16182,6 +16188,7 @@ void ImGui::DebugNodeFont(ImFont* font)
config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH, cfg->GlyphOffset.x, cfg->GlyphOffset.y); config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH, cfg->GlyphOffset.x, cfg->GlyphOffset.y);
// Display all glyphs of the fonts in separate pages of 256 characters // Display all glyphs of the fonts in separate pages of 256 characters
{
if (TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size)) if (TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size))
{ {
ImDrawList* draw_list = GetWindowDrawList(); ImDrawList* draw_list = GetWindowDrawList();
@ -16232,7 +16239,9 @@ void ImGui::DebugNodeFont(ImFont* font)
} }
TreePop(); TreePop();
} }
}
TreePop(); TreePop();
Unindent();
} }
void ImGui::DebugNodeFontGlyph(ImFont*, const ImFontGlyph* glyph) void ImGui::DebugNodeFontGlyph(ImFont*, const ImFontGlyph* glyph)