Skip to content

LR-PREF-INTERFACE: text sizes have names, the seven type roles of the theme - #1374

Open
nledford wants to merge 1 commit into
storytold:mainfrom
nledford:type-roles
Open

nledford wants to merge 1 commit into
storytold:mainfrom
nledford:type-roles

Conversation

@nledford

@nledford nledford commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Off main.

Part 1 of 8 of what was this one 3,200-line PR: it was too large to review in one sitting and held eight changes with their own behavior, so it is split along those lines (the list is under Not in this PR). Each later part is opened off main once the one before it has landed, so none is stacked.

Problem

Text sizes are numbers written where the text is drawn: 44 places set a size past Tokens::font and Tokens::semibold, and there is no name for a size that a panel can use. The interface drew 17 sizes from 8.5 to 20 pt, 102 of 237 uses on half points, and nothing says which size has which job.

This part gives the sizes names and moves the call sites that already ask for one of those sizes. It changes nothing on screen: the sizes that are off the scale come in the next part, because that change reaches every panel and needs its own before and after.

Change

  • theme::TextSize: seven sizes, each with a job and each a point or more from the next. 10 micro (a badge on a thumbnail), 11 caption (an explanation, the caption over a field), 12 label (a count, a tab's title), 13 body (controls, rows, values), 14 title (a section's header), 15 panel title (a panel's or window's name), 18 display (the title over the photos).
  • Tokens::caption(), body_strong() and the like give each in the regular and the semibold face; Tokens::regular(size) and Tokens::strong(size) take the size as a value.
  • The 30 call sites that already asked for one of these sizes by number (.size(11.0), .size(12.0), .size(13.0), one FontId::proportional(14.0)) name the role instead, and the Body, Button and Small text styles are body(), body() and caption(). In each, the size and the face are what they were.
  • Tests, tests_type_roles.rs: the seven sizes and their order, each role's size in both faces (a regular and a semibold font, the same as regular(size) and strong(size)), the three text styles.

Not in this PR (the rest of the old #1374, in this order, each its own PR off main after this one; they are not opened yet, so they have no numbers):

  1. Text drawn in the seven sizes: the off-scale call sites (12.5, 11.5, 13.5 …) move to a role, t.font(n) and t.semibold(n) give the nearest size, the window title (Heading, 16 pt now) is 15, the Export dialog is 602 pt wide where it was 615. With before and after screenshots.
  2. Dim text, links and cautions stand 4.5:1 in every theme (Tokens::legible, text_link, …).
  3. Marks and words over a picture: one light ink on a shade.
  4. An exposure reads one way, a minus sign, columns of figures, Arabic and Persian digits.
  5. Longer words keep to their place in Edit, the choices and the filter bar.
  6. Emphasis shows, a value is no larger than its header, an empty view wraps, the German date.
  7. cargo xtask type as a step of ci, and its rule in CLAUDE.md: a maintainer's decision, so it is alone.

How it was checked

  • Review: a fresh reviewer subagent read the rebase onto the Enforce Rust coding standards via Clippy #3111 layout at 3e6e473.
  • Review: deep-reviewer, fresh context, at e4095ac (the rebase onto main 472560b309; one conflict, panels/edit.rs, where main's lens readout replaced the label this PR had changed and its .size(11.0) became .font(t.caption())): approved, no P1 or P2.
  • cargo xtask ci: not run locally; the hosted CI gate runs it on this head. Run here at e4095acc06 on this Mac after the rebase onto main 472560b309: cargo check --workspace --all-targets; cargo clippy --workspace --all-targets -- -D warnings; cargo test -p lightcraft-ui-egui type_roles theme edit (117); the rebase check (conflict markers, doubled docs rows, locale keys); a comparison of the PR's diff before and after the rebase (3 groups, all main's lens readout replacing the "No lens data" label, read and accepted).
  • Tests that fail without this change: tests_type_roles.rs is new and uses the new API (it does not build without it)
  • No user-visible change to check by running the app: nothing drawn changes. Every one of the 30 swapped sites was compared one by one by an independent reviewer, who checked that the size, the face and everything else on the line are as before (including that .size(x) and .font(font) pick the same family for each of these widgets in egui 0.36), and that Heading, font() and semibold() are untouched

Screenshots

None: nothing drawn changes.

Merging

Checklist

  • No new panic path in non-test code
  • No new text on screen, so no locale key
  • No parity row or What's new entry: nothing visible changes (the entry comes with the part that changes the sizes)
  • New code has a caller: the 30 call sites and the three text styles use the roles; the rest are used by the next part
  • No new assets, packages or fonts
  • Ready to merge

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Style
    • Updated typography across panels, dialogs, settings, and photo details to use a consistent theme-based font hierarchy.
    • Standardized text roles and sizing for captions, labels, body text, and headings, including general interface text styles.
    • Existing wording, colors, and interaction behavior remain unchanged.

@nledford nledford changed the title Type: text is set in seven sizes, each with a job (stacked on #1333) LR-PREF-INTERFACE: text is set in seven sizes, readable in every theme, with numbers that line up (stacked on #1287) Oct 15, 2026
@nledford

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@nledford

Copy link
Copy Markdown
Contributor Author

Rebased onto main after #2913 (egui 0.37). Nothing changed beyond the rebase: the commit's own lines are the same as before (17 files, +207/−32); only context lines around them come from main.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nledford

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Rate Limit Exceeded

@nledford have exceeded the limit for the number of chat messages per hour. Please wait 37 minutes and 39 seconds before sending another message.

@FredApps FredApps 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.

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: text sizes have names, the seven type roles of the theme (LR-PREF-INTERFACE). Hard-coded .size(11.0) calls on labels in the dialogs, keymap and settings appearance pages are replaced by .font(t.caption()), so a size comes from a role in the theme and can be scaled by the interface size preference. Naming the roles removes magic numbers and is the precondition for an interface-size setting; the changes in the lines I saw keep the colour calls as they were. A mechanical replacement across many files should be checked for any place where the explicit size was deliberately different from the role (the replacement changes 11.0 to whatever caption() returns), and the PR should list the role values and the places that were not converted. A screenshot of one dialog before and after is the cheap evidence. I read three hunks. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

@nledford

nledford commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

… 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>
@nledford

nledford commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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.

A check is failing and this conflicts with main. Please rebase and fix the failure. Since this is part 1 of 8, it is worth keeping it free of changes from the later parts.

@wanikhawar

Copy link
Copy Markdown
Contributor

Is this superseded by #2898, #2899 and #2904? If so, please close it. If not, please rebase, fix the Windows gate, and drop the tests that assert the constant values (rule 27).

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.

3 participants