@@ -7033,7 +7033,7 @@ static void ImGui::RenderWindowOuterBorders(ImGuiWindow* window)
70337033 if (g.Style.FrameBorderSize > 0 && !(window->Flags & ImGuiWindowFlags_NoTitleBar) && !window->DockIsActive)
70347034 {
70357035 float y = window->Pos.y + window->TitleBarHeight - 1;
7036- window->DrawList->AddLine(ImVec2(window->Pos.x + border_size, y), ImVec2(window->Pos.x + window->Size.x - border_size, y), border_col, g.Style.FrameBorderSize);
7036+ window->DrawList->AddLine(ImVec2(window->Pos.x + border_size * 0.5f , y), ImVec2(window->Pos.x + window->Size.x - border_size * 0.5f , y), border_col, g.Style.FrameBorderSize);
70377037 }
70387038}
70397039
@@ -7130,9 +7130,9 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar
71307130 {
71317131 ImRect menu_bar_rect = window->MenuBarRect();
71327132 menu_bar_rect.ClipWith(window->Rect()); // Soft clipping, in particular child window don't have minimum size covering the menu bar so this is useful for them.
7133- window->DrawList->AddRectFilled(menu_bar_rect.Min + ImVec2(window_border_size, 0), menu_bar_rect.Max - ImVec2(window_border_size, 0) , GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImDrawFlags_RoundCornersTop);
7133+ window->DrawList->AddRectFilled(menu_bar_rect.Min, menu_bar_rect.Max, GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImDrawFlags_RoundCornersTop);
71347134 if (style.FrameBorderSize > 0.0f && menu_bar_rect.Max.y < window->Pos.y + window->Size.y)
7135- window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border), style.FrameBorderSize);
7135+ window->DrawList->AddLine(menu_bar_rect.GetBL() + ImVec2(window_border_size * 0.5f, 0.0f), menu_bar_rect.GetBR() - ImVec2(window_border_size * 0.5f, 0.0f ), GetColorU32(ImGuiCol_Border), style.FrameBorderSize);
71367136 }
71377137
71387138 // Docking: Unhide tab bar (small triangle in the corner), drag from small triangle to quickly undock
@@ -7172,9 +7172,10 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar
71727172 continue;
71737173 const ImGuiResizeGripDef& grip = resize_grip_def[resize_grip_n];
71747174 const ImVec2 corner = ImLerp(window->Pos, window->Pos + window->Size, grip.CornerPosN);
7175- window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(window_border_size, resize_grip_draw_size) : ImVec2(resize_grip_draw_size, window_border_size)));
7176- window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(resize_grip_draw_size, window_border_size) : ImVec2(window_border_size, resize_grip_draw_size)));
7177- window->DrawList->PathArcToFast(ImVec2(corner.x + grip.InnerDir.x * (window_rounding + window_border_size), corner.y + grip.InnerDir.y * (window_rounding + window_border_size)), window_rounding, grip.AngleMin12, grip.AngleMax12);
7175+ const float border_inner = IM_ROUND(window_border_size * 0.5f);
7176+ window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(border_inner, resize_grip_draw_size) : ImVec2(resize_grip_draw_size, border_inner)));
7177+ window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(resize_grip_draw_size, border_inner) : ImVec2(border_inner, resize_grip_draw_size)));
7178+ window->DrawList->PathArcToFast(ImVec2(corner.x + grip.InnerDir.x * (window_rounding + border_inner), corner.y + grip.InnerDir.y * (window_rounding + border_inner)), window_rounding, grip.AngleMin12, grip.AngleMax12);
71787179 window->DrawList->PathFillConvex(col);
71797180 }
71807181 }
@@ -21986,18 +21987,24 @@ void ImGui::DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList* out_draw_list, co
2198621987// [DEBUG] Display details for a single font, called by ShowStyleEditor().
2198721988void ImGui::DebugNodeFont(ImFont* font)
2198821989{
21989- bool opened = TreeNode(font, "Font: \"%s\"\n %.2f px, %d glyphs, %d file (s)",
21990+ bool opened = TreeNode(font, "Font: \"%s\": %.2f px, %d glyphs, %d sources (s)",
2199021991 font->ConfigData ? font->ConfigData[0].Name : "", font->FontSize, font->Glyphs.Size, font->ConfigDataCount);
21991- SameLine();
21992- if (SmallButton("Set as default"))
21993- GetIO().FontDefault = font;
21994- if (!opened)
21995- return;
2199621992
2199721993 // Display preview text
21994+ if (!opened)
21995+ Indent();
21996+ Indent();
2199821997 PushFont(font);
2199921998 Text("The quick brown fox jumps over the lazy dog");
2200021999 PopFont();
22000+ if (!opened)
22001+ {
22002+ Unindent();
22003+ Unindent();
22004+ return;
22005+ }
22006+ if (SmallButton("Set as default"))
22007+ GetIO().FontDefault = font;
2200122008
2200222009 // Display details
2200322010 SetNextItemWidth(GetFontSize() * 8);
@@ -22016,62 +22023,69 @@ void ImGui::DebugNodeFont(ImFont* font)
2201622023 Text("Texture Area: about %d px ~%dx%d px", font->MetricsTotalSurface, surface_sqrt, surface_sqrt);
2201722024 for (int config_i = 0; config_i < font->ConfigDataCount; config_i++)
2201822025 if (font->ConfigData)
22019- if (const ImFontConfig* cfg = &font->ConfigData[config_i])
22020- BulletText("Input %d: \'%s\', Oversample: (%d,%d), PixelSnapH: %d, Offset: (%.1f,%.1f)",
22021- config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH, cfg->GlyphOffset.x, cfg->GlyphOffset.y);
22026+ {
22027+ const ImFontConfig* cfg = &font->ConfigData[config_i];
22028+ int oversample_h, oversample_v;
22029+ ImFontAtlasBuildGetOversampleFactors(cfg, &oversample_h, &oversample_v);
22030+ BulletText("Input %d: \'%s\', Oversample: (%d=>%d,%d=>%d), PixelSnapH: %d, Offset: (%.1f,%.1f)",
22031+ config_i, cfg->Name, cfg->OversampleH, oversample_h, cfg->OversampleV, oversample_v, cfg->PixelSnapH, cfg->GlyphOffset.x, cfg->GlyphOffset.y);
22032+ }
2202222033
2202322034 // Display all glyphs of the fonts in separate pages of 256 characters
22024- if (TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size))
22025- {
22026- ImDrawList* draw_list = GetWindowDrawList();
22027- const ImU32 glyph_col = GetColorU32(ImGuiCol_Text);
22028- const float cell_size = font->FontSize * 1;
22029- const float cell_spacing = GetStyle().ItemSpacing.y;
22030- for (unsigned int base = 0; base <= IM_UNICODE_CODEPOINT_MAX; base += 256)
22031- {
22032- // Skip ahead if a large bunch of glyphs are not present in the font (test in chunks of 4k)
22033- // This is only a small optimization to reduce the number of iterations when IM_UNICODE_MAX_CODEPOINT
22034- // is large // (if ImWchar==ImWchar32 we will do at least about 272 queries here)
22035- if (!(base & 8191) && font->IsGlyphRangeUnused(base, base + 8191))
22035+ {
22036+ if (TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size))
22037+ {
22038+ ImDrawList* draw_list = GetWindowDrawList();
22039+ const ImU32 glyph_col = GetColorU32(ImGuiCol_Text);
22040+ const float cell_size = font->FontSize * 1;
22041+ const float cell_spacing = GetStyle().ItemSpacing.y;
22042+ for (unsigned int base = 0; base <= IM_UNICODE_CODEPOINT_MAX; base += 256)
2203622043 {
22037- base += 8192 - 256;
22038- continue;
22039- }
22040-
22041- int count = 0;
22042- for (unsigned int n = 0; n < 256; n++)
22043- if (font->FindGlyphNoFallback((ImWchar)(base + n)))
22044- count++;
22045- if (count <= 0)
22046- continue;
22047- if (!TreeNode((void*)(intptr_t)base, "U+%04X..U+%04X (%d %s)", base, base + 255, count, count > 1 ? "glyphs" : "glyph"))
22048- continue;
22044+ // Skip ahead if a large bunch of glyphs are not present in the font (test in chunks of 4k)
22045+ // This is only a small optimization to reduce the number of iterations when IM_UNICODE_MAX_CODEPOINT
22046+ // is large // (if ImWchar==ImWchar32 we will do at least about 272 queries here)
22047+ if (!(base & 8191) && font->IsGlyphRangeUnused(base, base + 8191))
22048+ {
22049+ base += 8192 - 256;
22050+ continue;
22051+ }
2204922052
22050- // Draw a 16x16 grid of glyphs
22051- ImVec2 base_pos = GetCursorScreenPos();
22052- for (unsigned int n = 0; n < 256; n++)
22053- {
22054- // We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions
22055- // available here and thus cannot easily generate a zero-terminated UTF-8 encoded string.
22056- ImVec2 cell_p1(base_pos.x + (n % 16) * (cell_size + cell_spacing), base_pos.y + (n / 16) * (cell_size + cell_spacing));
22057- ImVec2 cell_p2(cell_p1.x + cell_size, cell_p1.y + cell_size);
22058- const ImFontGlyph* glyph = font->FindGlyphNoFallback((ImWchar)(base + n));
22059- draw_list->AddRect(cell_p1, cell_p2, glyph ? IM_COL32(255, 255, 255, 100) : IM_COL32(255, 255, 255, 50));
22060- if (!glyph)
22053+ int count = 0;
22054+ for (unsigned int n = 0; n < 256; n++)
22055+ if (font->FindGlyphNoFallback((ImWchar)(base + n)))
22056+ count++;
22057+ if (count <= 0)
2206122058 continue;
22062- font->RenderChar(draw_list, cell_size, cell_p1, glyph_col, (ImWchar)(base + n));
22063- if (IsMouseHoveringRect(cell_p1, cell_p2) && BeginTooltip())
22059+ if (!TreeNode((void*)(intptr_t)base, "U+%04X..U+%04X (%d %s)", base, base + 255, count, count > 1 ? "glyphs" : "glyph"))
22060+ continue;
22061+
22062+ // Draw a 16x16 grid of glyphs
22063+ ImVec2 base_pos = GetCursorScreenPos();
22064+ for (unsigned int n = 0; n < 256; n++)
2206422065 {
22065- DebugNodeFontGlyph(font, glyph);
22066- EndTooltip();
22066+ // We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions
22067+ // available here and thus cannot easily generate a zero-terminated UTF-8 encoded string.
22068+ ImVec2 cell_p1(base_pos.x + (n % 16) * (cell_size + cell_spacing), base_pos.y + (n / 16) * (cell_size + cell_spacing));
22069+ ImVec2 cell_p2(cell_p1.x + cell_size, cell_p1.y + cell_size);
22070+ const ImFontGlyph* glyph = font->FindGlyphNoFallback((ImWchar)(base + n));
22071+ draw_list->AddRect(cell_p1, cell_p2, glyph ? IM_COL32(255, 255, 255, 100) : IM_COL32(255, 255, 255, 50));
22072+ if (!glyph)
22073+ continue;
22074+ font->RenderChar(draw_list, cell_size, cell_p1, glyph_col, (ImWchar)(base + n));
22075+ if (IsMouseHoveringRect(cell_p1, cell_p2) && BeginTooltip())
22076+ {
22077+ DebugNodeFontGlyph(font, glyph);
22078+ EndTooltip();
22079+ }
2206722080 }
22081+ Dummy(ImVec2((cell_size + cell_spacing) * 16, (cell_size + cell_spacing) * 16));
22082+ TreePop();
2206822083 }
22069- Dummy(ImVec2((cell_size + cell_spacing) * 16, (cell_size + cell_spacing) * 16));
2207022084 TreePop();
2207122085 }
22072- TreePop();
2207322086 }
2207422087 TreePop();
22088+ Unindent();
2207522089}
2207622090
2207722091void ImGui::DebugNodeFontGlyph(ImFont*, const ImFontGlyph* glyph)
0 commit comments