Skip to content

LR-PREF-INTERFACE: text is drawn in the seven sizes, so no two sizes are half a point apart (stacked on #1374) - #2898

Open
nledford wants to merge 2 commits into
storytold:mainfrom
nledford:type-roles-2-sizes
Open

nledford wants to merge 2 commits into
storytold:mainfrom
nledford:type-roles-2-sizes

Conversation

@nledford

@nledford nledford commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #1374 (merge order to main: #1374 → this). This PR's own commit is 8c1905c032; b341826e11 under it is #1374's, so the diff against main also shows #1374's lines until it lands. It is cut from the old #1374, which held all eight parts.

Problem

The interface draws 17 text sizes from 8.5 to 20 pt, 102 of 237 uses on half points: a slider's name at 12.5 pt beside a checkbox's 13, a caption at 11 pt in Settings and 11.5 in Info, panel titles at 13.5, 14, 15 and 17. The parent PR gives the seven sizes names and moves the call sites that already asked for one of them; this one moves the rest.

Change

  • Every text shape the library, a photo being edited, Settings and the dialogs draw is on the seven sizes: the 115 call sites that were off the scale name the size their job has (t.caption(), t.body_strong() …). The smallest text is 10 pt (it was 8.5).
  • t.font(n) and t.semibold(n) keep their signatures and give the size of the scale nearest n (of two equally near, the one nearer body), so code that still asks by number lands on the scale too (TextSize::nearest).
  • A window's title (the Heading text style) is 15 pt, a panel's size; it was 16.
  • Chips and choices are caption size, so the Export dialog is 602 pt wide where it was 615.
  • Tests: tests_type_scale.rs (every text shape drawn by the library, a photo being edited, each tab of Settings and three dialogs is on the scale; any number asked for lands on it; the line over a square cell ends before the format), the Heading assertion in tests_type_roles.rs and the new Export width in tests_dialog_fit.rs. A What's New entry.

Not in this PR:

  • About 15 calls that still ask the theme for a half-point size (t.font(11.5), t.semibold(12.5) …) are drawn at the nearest size by the rule above, not moved to a role; a few of them land one step from their neighbor with the same job (a menu group heading in Edit's profile menu is 11 pt, the one in the mask-effects menu is 12). The last PR of the chain adds a check that lists them.
  • The legend of the Frame Rate debug overlay (Help ▸ Debug) is still 9 pt; it moves in the last PR of the chain.
  • The dates of the What's New entries in this chain are the day each was written, not the day it will land; they are set when the chain is merged.
  • The later parts, each its own PR in this order: dim text, links and cautions at 4.5:1; marks and words over a picture; how an exposure and a number read; longer words in Edit, the choices and the filter bar; small things in how the interface writes; cargo xtask type and its rule in CLAUDE.md.

How it was checked

  • After the port onto Enforce Rust coding standards via Clippy #3111's layout (this head, cbc04f85c9): cargo check --workspace --all-targets and cargo fmt with cargo clippy --workspace --all-targets -- -D warnings (Enforce Rust coding standards via Clippy #3111's lints; with MENU-BAR: clippy passes on macOS again (Quit, About and Settings share one branch) #2973's one-file clippy fix applied uncommitted) pass at the top of this chain; cargo xtask type passes (143 files, 17 sizes asked by number); cargo test -p lightcraft-ui-egui --lib filtered on type_, dialog_fit and crop_rotate: 72 passed; each commit's changed lines equal the ones before the port except where Enforce Rust coding standards via Clippy #3111 moved the code (compared line by line), and the docs and locale checks are clean. The full cargo xtask ci was not run locally at this head: the hosted CI gate runs it. The bullets below are from before the port, at the heads they name.
  • The full cargo xtask ci at this head (cc17af1d7d), here: cargo fmt clean; clippy clean except apps/lightcraft/src/native_menu.rs:492 ("this if has identical blocks", on main too, MENU-BAR: clippy passes on macOS again (Quit, About and Settings share one branch) #2973); then the rest of the run past that one: cargo test --workspace --lib --bins --tests: 5,012 tests passed, 1 failed, accessibility::every_interactive_node_has_a_name_in_every_view_and_tool on the missing glyph "▸" (U+25B8), which fails on main too (LR-BEHAV-LOCALIZE: menu paths with →, not the ▸ no UI font has (#1950) #2016); the parity, layers, assets and wasm steps passed. The hosted CI gate runs the same on the pushed head
  • Its own tests: cargo test -p lightcraft-ui-egui --lib tests_type (9 passed) and tests_dialog_fit (6 passed)
  • Failing first (a throwaway worktree, this PR's panel and import.rs call sites put back to the parent's, the new theme API kept): 4 of the 9 tests_type tests fail: the_library_draws_its_text_on_the_scale, a_photo_being_edited_draws_its_text_on_the_scale, settings_and_the_dialogs_draw_their_text_on_the_scale and the_line_over_a_square_cell_ends_before_the_format. The others, and the new Export width in tests_dialog_fit, were not run on the old code: they exercise the theme API this PR adds
  • An independent reviewer read this PR's diff against its parent; the findings it made that were real are fixed in this head (790fbf2842), the rest are under Not in this PR. The branch was rebased onto a newer main after that review; a second reviewer read this commit's diff at cc17af1d7d and the rebase against 790fbf2842 and found no problems (the only new text on screen from main, the Info panel's "Show Metadata For" row and its several-photo rows, is on the scale)

Review: a fresh read-only reviewer subagent at cbc04f8 (it read all seven commits of this chain against their originals); later: rebased onto #1374 b341826 from 3e6e473

Screenshots

Before and after, each taken from a release build of the parent's head (before: #1374 at 0f3f760766) and of this PR's head before the rebase (after: 790fbf2842; the rebase moved no size), in a 1600 × 1000 window at 2× scale, in a throwaway in-memory session with the procedural demo photos, driven only through the control channel. Each pair is the same scene on both builds. A pair marked "crop" is a cut-out of the full-size shot, so the small text is readable. Sizes move by up to a point, so the differences are small by design; each caption names what to look at.

Library grid, Charcoal (dark): look at the sidebar rows ("All Photos", "Recently Added"…) and the Auto / B&W / HDR / Reset chips in the Edit panel, which are slightly smaller (the chips are caption size).

Before After
tr2-grid-charcoal, before tr2-grid-charcoal, after

A photo being edited, Charcoal (dark): same rows and chips, plus the filmstrip under the photo.

Before After
tr2-develop-charcoal, before tr2-develop-charcoal, after

Library grid, Silver (light): the same rows and chips in a light theme.

Before After
tr2-grid-silver, before tr2-grid-silver, after

A photo being edited, Silver (light).

Before After
tr2-develop-silver, before tr2-develop-silver, after

Export dialog, Charcoal: 13 pt narrower (602 pt instead of 615), because its chips and choices are caption size.

Before After
tr2-export-charcoal, before tr2-export-charcoal, after

Settings, General tab, Charcoal: the tab chips and the language choices are caption size.

Before After
tr2-settings-charcoal, before tr2-settings-charcoal, after

Not captured: a Midnight and a Paper pair (the change is the same size in every theme; the next draft in the chain takes all four themes).

Merging

Checklist

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Introduced a consistent set of text sizes across the app, bringing typography in panels, dialogs, settings, and controls into alignment with the theme.
  • Bug Fixes
    • Constrained filenames in square-grid badges to keep them clear of format labels.
  • Documentation
    • Added a guide to the available text sizes and how they’re applied.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
Commits

Reviewing files that changed from the base of the PR and between cbc04f8 and 8c1905c.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between a7494f4 and cbc04f8.

Files selected for processing: 15
  • crates/ui-egui/src/dialogs.rs
  • crates/ui-egui/src/dialogs/import/tags.rs
  • crates/ui-egui/src/dialogs/settings/appearance.rs
  • crates/ui-egui/src/dialogs/settings/slide_overlays.rs
  • crates/ui-egui/src/panels/compare.rs
  • crates/ui-egui/src/panels/denoise.rs
  • crates/ui-egui/src/panels/detail.rs
  • crates/ui-egui/src/panels/detail/crop.rs
  • crates/ui-egui/src/panels/edit/histogram.rs
  • crates/ui-egui/src/panels/edit/sliders.rs
  • crates/ui-egui/src/panels/grid.rs
  • crates/ui-egui/src/panels/left/albums.rs
  • crates/ui-egui/src/panels/left/rows.rs
  • crates/ui-egui/src/panels/topbar.rs
  • crates/ui-egui/src/widgets.rs
Files skipped from review as they are similar to previous changes: 13
  • crates/ui-egui/src/dialogs/settings/slide_overlays.rs
  • crates/ui-egui/src/panels/compare.rs
  • crates/ui-egui/src/panels/detail/crop.rs
  • crates/ui-egui/src/dialogs/settings/appearance.rs
  • crates/ui-egui/src/panels/left/albums.rs
  • crates/ui-egui/src/panels/edit/histogram.rs
  • crates/ui-egui/src/panels/left/rows.rs
  • crates/ui-egui/src/panels/edit/sliders.rs
  • crates/ui-egui/src/widgets.rs
  • crates/ui-egui/src/dialogs.rs
  • crates/ui-egui/src/panels/topbar.rs
  • crates/ui-egui/src/panels/denoise.rs
  • crates/ui-egui/src/panels/grid.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

The theme adds seven named text sizes and maps numeric font requests to the nearest size. UI panels, widgets, and dialogs adopt the theme’s typography tokens. Grid filename fitting and masking tile sizing are updated, with tests covering the scale and text layout.

Changes: Typography scale

Layer / File(s) Summary
Define the text-size scale
crates/ui-egui/src/theme.rs, docs/whats-new.md
Adds seven named text sizes, named regular and semibold font helpers, and nearest-size mapping for numeric requests. Updates egui text styles and documents the scale.
Apply typography tokens
crates/ui-egui/src/panels/*, crates/ui-egui/src/panels/detail/*, crates/ui-egui/src/panels/edit/*, crates/ui-egui/src/panels/left/*, crates/ui-egui/src/panels/right/*, crates/ui-egui/src/widgets.rs, crates/ui-egui/src/dialogs.rs, crates/ui-egui/src/dialogs/*, crates/ui-egui/src/dialogs/import/*, crates/ui-egui/src/dialogs/settings/*
Replaces fixed font sizes and weights with named theme styles across panel, widget, and dialog text.
Check text fitting and scale use
crates/ui-egui/src/panels/grid.rs, crates/ui-egui/src/panels/masking.rs, crates/ui-egui/src/tests.rs, crates/ui-egui/src/tests/type_roles.rs, crates/ui-egui/src/tests/type_scale.rs, crates/ui-egui/src/tests/dialog_fit.rs
Uses caption and micro sizes when fitting masking tile labels and constrains square-grid filenames to the area before the format badge. Adds rendering and layout checks; updates the Export dialog width expectation.

Priority: Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Possibly related issues

Suggested reviewers: aiongg

Merge Risk: Minimal · previous review cbc04

The typography changes preserve the named-size contract and inspected UI layouts, with no actionable merge-blocking risk established.

Security architecture risk: Minimal · up to cbc04

The reviewed changes centralize text sizing without adding access to sensitive operations or expanding application privileges. The flagged dialog helper remains internal and only calculates layout width. No introduced or worsened security issue was identified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected API changes affect font selection and UI geometry, not authorization or access to sensitive resources. Repository source searches found no consumers of the new typography APIs outside ui-egui; external downstream consumers remain unverified.

Trust Boundaries and Controls

  • observed — The flagged tag_field_width entrypoint remains crate-visible rather than externally public. Its base and head caller sets are unchanged, and it does not accept template content or perform template insertion, filesystem operations, or permission checks.
Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: standardizing interface text on seven named sizes. The stacked PR reference adds relevant context.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@nledford

Copy link
Copy Markdown
Contributor Author

Rebased onto main after #2913 (egui 0.37), on #1374's new head. Beyond the rebase: the new "Show Metadata For" label on main (LR-META-INFO) was drawn at 11.5 pt, so it is moved to the caption role with the others (tests_type_scale failed on it before the change).

@nledford
nledford marked this pull request as ready for review October 26, 2026 06:22
@nledford

Copy link
Copy Markdown
Contributor Author

Marked ready for review. It is stacked on #1374: this PR's own commit is cc17af1d7d (the one on top), and b3f7bd1dd2 under it is #1374's. Local cargo xtask ci at this head: everything passes except two failures that also fail on main (the native_menu.rs clippy lint, #2973, and the "▸" glyph accessibility test, #2016). The branch was rebased onto a newer main since the first review; a fresh reviewer read the commit and the rebase and found nothing.

nledford and others added 2 commits October 30, 2026 09:08
… theme

theme::TextSize names seven sizes a point or more apart (10 micro, 11 caption,
12 label, 13 body, 14 title, 15 panel title, 18 display), and Tokens gives each
in both faces: t.caption(), t.body_strong() and the like.

The call sites that already asked for one of those sizes by number
(.size(11.0), t.font(13.0), the Body, Button and Small text styles) name the
role instead. Nothing on screen changes: the sizes that are off the scale (12.5,
11.5, 13.5 and the rest), t.font(n) and t.semibold(n) are as they were.

Tests: tests_type_roles.rs (the seven sizes and their steps, both faces of each
role, the text styles).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…are half a point apart

The interface drew 17 sizes from 8.5 to 20 pt, 102 of 237 uses on half points: a
slider's name at 12.5 beside a checkbox's 13, a caption at 11 in Settings and
11.5 in Info, panel titles at 13.5, 14, 15 and 17.

- The 115 call sites that were off the scale name the size their job has
  (t.caption(), t.body_strong(), ...). The smallest text is 10 pt (was 8.5).
- t.font(n) and t.semibold(n) keep their signatures and give the size of the
  scale nearest n (of two equally near, the one nearer body), so code that asks
  by number is on the scale too. A window's title (the Heading text style) is
  15 pt, a panel's size.
- Chips and choices are caption size, so the Export dialog is 602 pt wide where
  it was 615.

Tests: tests_type_scale.rs (every text shape drawn by the library, a photo being
edited, each tab of Settings and three dialogs is on the scale; any number asked
for lands on it; the line over a square cell ends before the format).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@wanikhawar wanikhawar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is stacked on #1374, which needs changes first (its locale edits). Please rebase once #1374 has landed. It conflicts with main now.

@wanikhawar

Copy link
Copy Markdown
Contributor

This is stacked on #1374, which is still open and conflicts with main, so this can't be merged or fully reviewed until that lands. Main has since moved most panels onto the Craft framework (#4750), so many of the 20+ conflicting files now draw their text through framework widgets; please rebase after #1374 and re-check, per surface, that the seven-size claim and type_scale hold for what is drawn today. Please also say in the description that t.font(n) now snaps to the scale for every remaining caller (smallest text 10 pt, window titles 15 pt, Export dialog width changes), so that behaviour change is deliberate and visible.

This branch has not been deployed

No deployments
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.

2 participants