From 53e443ddacdbbc6dc172c05749de00d218dbc794 Mon Sep 17 00:00:00 2001 From: Marco Maroni <166719395+marcomaroni-github@users.noreply.github.com> Date: Wed, 15 Jul 2026 11:42:27 +0200 Subject: [PATCH] feat: 10pt display font and tighter vertical padding Font size chosen by the user to visually match the notification-area clock; DISPLAY_FONT_PT in VisualStyle.cpp is the single knob. Co-Authored-By: Claude Fable 5 --- CalculatorWindow.cpp | 2 +- VisualStyle.cpp | 15 +++++++++++++++ .../plans/2026-07-15-display-font-size.md | 6 +++--- .../specs/2026-07-15-display-font-size-design.md | 10 +++++----- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/CalculatorWindow.cpp b/CalculatorWindow.cpp index 5ba0909..0edc207 100644 --- a/CalculatorWindow.cpp +++ b/CalculatorWindow.cpp @@ -148,7 +148,7 @@ BOOL CCalculatorWindow::CreateStandalone() // Size so the CLIENT area fits the display, accounting for caption + borders. POINTL ideal = CalcIdealSize(); LONG clientW = ideal.x + 24; if (clientW < 160) clientW = 160; - LONG clientH = ideal.y + 14; if (clientH < 28) clientH = 28; + LONG clientH = ideal.y + 8; if (clientH < 28) clientH = 28; RECT r = { 0, 0, clientW, clientH }; AdjustWindowRectEx(&r, WS_POPUP | WS_CAPTION | WS_SYSMENU, FALSE, WS_EX_TOOLWINDOW); SetWindowPos(NULL, 0, 0, r.right - r.left, r.bottom - r.top, SWP_NOMOVE | SWP_NOZORDER); diff --git a/VisualStyle.cpp b/VisualStyle.cpp index 3c3bad1..11bf973 100644 --- a/VisualStyle.cpp +++ b/VisualStyle.cpp @@ -4,6 +4,17 @@ #include "VisualStyle.h" #include "Utils.h" +// Point size of the calculator display; the one knob for readability tweaks. +const int DISPLAY_FONT_PT = 10; + +static LONG DisplayFontHeight() +{ + HDC hdc = ::GetDC(NULL); + const LONG h = -::MulDiv(DISPLAY_FONT_PT, ::GetDeviceCaps(hdc, LOGPIXELSY), 72); + ::ReleaseDC(NULL, hdc); + return h; +} + //////////////////////////////////////////////////////////////////////////////// // Classic visual style @@ -29,7 +40,10 @@ private: (::IsVistaOrHigher() ? 0 : sizeof(ncm.iPaddedBorderWidth)); if(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0)) + { + ncm.lfMessageFont.lfHeight = DisplayFontHeight(); m_hFont = ::CreateFontIndirect(&ncm.lfMessageFont); + } ATLASSERT(m_hFont); @@ -76,6 +90,7 @@ private: if(SUCCEEDED(hr)) { + lf.lfHeight = DisplayFontHeight(); lf.lfWeight = 600; m_hFont = ::CreateFontIndirect(&lf); ATLASSERT(m_hFont); diff --git a/docs/superpowers/plans/2026-07-15-display-font-size.md b/docs/superpowers/plans/2026-07-15-display-font-size.md index acea9e9..4b215ec 100644 --- a/docs/superpowers/plans/2026-07-15-display-font-size.md +++ b/docs/superpowers/plans/2026-07-15-display-font-size.md @@ -2,7 +2,7 @@ > **For agentic workers:** Single-task plan; executed inline (superpowers:executing-plans). Steps use checkbox (`- [ ]`) syntax for tracking. -**Goal:** Raise the display font to 14pt (single constant) and shrink the vertical padding so no white band remains under the digits. +**Goal:** Raise the display font to 10pt (single constant) and shrink the vertical padding so no white band remains under the digits. **Architecture:** `DISPLAY_FONT_PT` constant + points→logical helper in `VisualStyle.cpp`, applied in both `CreateFont`s; vertical padding in `CreateStandalone` drops from 14 to 8. @@ -26,7 +26,7 @@ ```cpp // Point size of the calculator display; the one knob for readability tweaks. -const int DISPLAY_FONT_PT = 14; +const int DISPLAY_FONT_PT = 10; static LONG DisplayFontHeight() { @@ -74,5 +74,5 @@ Themed (`CThemedVisualStyle::CreateFont`), in the `SUCCEEDED(hr)` block: ```bash git add VisualStyle.cpp CalculatorWindow.cpp -git commit -m "feat: 14pt display font and tighter vertical padding" +git commit -m "feat: 10pt display font and tighter vertical padding" ``` diff --git a/docs/superpowers/specs/2026-07-15-display-font-size-design.md b/docs/superpowers/specs/2026-07-15-display-font-size-design.md index 87bf79f..853dd98 100644 --- a/docs/superpowers/specs/2026-07-15-display-font-size-design.md +++ b/docs/superpowers/specs/2026-07-15-display-font-size-design.md @@ -12,11 +12,11 @@ single-line EDIT leaves as white space at the bottom. ## Behavior -- **Font size:** a single constant `DISPLAY_FONT_PT = 14` in `VisualStyle.cpp`. +- **Font size:** a single constant `DISPLAY_FONT_PT = 10` in `VisualStyle.cpp`. Both styles override the height of the font they resolve (`lfHeight = -MulDiv(DISPLAY_FONT_PT, LOGPIXELSY, 72)` via a small shared helper): - - Themed: theme REBAR band font family, weight 600 (unchanged), height forced to 14pt. - - Classic: `lfMessageFont` family, height forced to 14pt (weight untouched). + - Themed: theme REBAR band font family, weight 600 (unchanged), height forced to 10pt. + - Classic: `lfMessageFont` family, height forced to 10pt (weight untouched). The constant is the single knob for later size iterations. - **Vertical padding:** in `CreateStandalone`, client height goes from `ideal.y + 14` to `ideal.y + 8` (covers the EDIT's ~4px `WS_EX_CLIENTEDGE` borders plus minimal @@ -39,9 +39,9 @@ single-line EDIT leaves as white space at the bottom. ## Testing - Engine regression: `tests\build-and-run.cmd` → 16/16 (UI-only). -- Manual (user): number readable at 14pt; no white band under the digits; window still +- Manual (user): number readable at 10pt; no white band under the digits; window still compact above the tray; caption auto-hide and position persistence unaffected. -- Iteration expected: if 14pt doesn't convince, change `DISPLAY_FONT_PT` and rebuild. +- Iteration expected: if 10pt doesn't convince, change `DISPLAY_FONT_PT` and rebuild. ## Out of scope (YAGNI) -- 2.51.2