Skip to content

Fit label bounds to text drawn at the current zoom - #369

Merged
danjboyd merged 3 commits into
mainfrom
label-padding-zoom
Nov 9, 2026
Merged

danjboyd merged 3 commits into
mainfrom
label-padding-zoom

Conversation

@danjboyd

@danjboyd danjboyd commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

At fractional zoom, labels use hinted font widths that do not scale evenly: background padding can shrink on one side and the last word can wrap outside the box. Preserve full-size line breaks while measuring the zoomed font, and use the drawn bounds for the background, hit testing and selection outline. Copy and Save keep their full-size bounds.

The test setup now lays out the canvas after loading an image. Label captures use 512-point strips with graphics-state restoration and pixel-density normalization, plus checks for white corners and bounded painted regions. This addresses the hidden-parent failure seen on macOS and avoids the large-image readback used by the failing Windows CI probes. Every original zoom, font, tolerance and behavioral assertion is retained; a new 2600-point capture check catches incomplete readback. Production source is unchanged by these two test corrections.

Validation: exact revised head 31195752dd122dfd80b3f578dd92b1cb1f3bb96a passed all nine private-display Linux label/empty-state cases with zero failures/errors/skips. Its unchanged production tree was previously tested at 05a1936b1c1b82dab063f7ca1ad4e561eecdca2e: 58 focused and 358 full Linux cases, zero failures/errors and three expected full-suite skips. Mac clang syntax checks with XCTest/AppKit headers passed on this exact revised head; no local native runtime run is claimed. The same revised test file passed four offscreen render/readback cases on the Windows carry backend; the window-ordering hit/drag test was not run on that shared desktop. Hosted CI on this revision now passes in the original failing environment; the Windows cache-width explanation remains an inference. Earlier macOS and Windows on-screen checks covered the unchanged production patch; no new human screen check is claimed.

CI on this exact head: all four jobs passed. Windows covered 358 cases with zero failures/errors and six expected skips, including all five label probes. macOS covered 337 cases with zero failures and one skip. Both Linux theme suites and AppImage runtime/smoke checks passed.

Known follow-up: the live editor uses the zoomed font and may wrap lines differently from the finished label.

danjboyd and others added 3 commits November 9, 2026 16:11
On screen a label draws with a font scaled to the zoom, whose hinted advances don't scale evenly, but
its background and wrap width came from the text measured at full size. At 94.7% a yellow label's
right padding shrank to 6 px against 10 on the left. A 36 pt label wrapped its last word out of the
box. Copy and Save draw at full size, so they looked right.

At other zooms, keep the line breaks from full size and size the background from the zoomed font.
Clicks and selection outlines follow what's drawn. Full size draws as before, and export keeps its
own bounds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GzSMSTMRJauuo55mvixfj9
@danjboyd
danjboyd merged commit befb06d into main Nov 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant