1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-02-09 04:50:11 +00:00

Fonts: ground work for allowing SizePixels to be optional.

This commit is contained in:
ocornut 2025-05-26 23:13:34 +02:00
parent 402db2ef32
commit 59a11363a5
4 changed files with 16 additions and 7 deletions

View file

@ -1204,6 +1204,9 @@ CODE
#define IMGUI_DEBUG_NAV_SCORING 0 // Display navigation scoring preview when hovering items. Hold CTRL to display for all candidates. CTRL+Arrow to change last direction.
#define IMGUI_DEBUG_NAV_RECTS 0 // Display the reference navigation rectangle for each window
// Default font size if unspecified in both style.FontSizeBase and AddFontXXX() calls.
static const float FONT_DEFAULT_SIZE = 20.0f;
// When using CTRL+TAB (or Gamepad Square+L/R) we delay the visual a little in order to reduce visual noise doing a fast switch.
static const float NAV_WINDOWING_HIGHLIGHT_DELAY = 0.20f; // Time before the highlight and screen dimming starts fading in
static const float NAV_WINDOWING_LIST_APPEAR_DELAY = 0.15f; // Time before the window list starts to appear
@ -8635,7 +8638,7 @@ void ImGui::UpdateFontsNewFrame()
// Apply default font size the first time
ImFont* font = ImGui::GetDefaultFont();
if (g.Style.FontSizeBase <= 0.0f)
g.Style.FontSizeBase = font->LegacySize * g.Style._MainScale;
g.Style.FontSizeBase = (font->LegacySize > 0.0f ? font->LegacySize : FONT_DEFAULT_SIZE) * g.Style._MainScale;
// Set initial font
g.Font = font;