Skip to content

Set the bundled packages' own words in the interface fonts, and check them there - #4859

Merged
max-sixty merged 5 commits into
mainfrom
package-fonts
Oct 31, 2026
Merged

max-sixty merged 5 commits into
mainfrom
package-fonts

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Leaf's core sets every word of its interface in one of the fonts browser/base.css declares (--font-ui, --font-small and the rest), and tests/model/test_interface_fonts.py fails a core rule that sets a face of its own. The bundled packages were outside that check. Run over them, it found 103 rules across 24 stylesheets that set their own size, line height, family or weight, some of them off the type ladder: the trace's 12px floor, visual review's 15px heading, and the file editor's 0.8, 0.88 and 0.9rem. This change moves those rules onto the named fonts and extends the check to the bundled packages, so a package widget's controls, statuses, counts and labels match Leaf's at every density and under every theme.

What changes on screen

Most rules move by a pixel or not at all. These read differently:

  • Gloss card: it takes --font-message, the face a thread card's words take (14px sans, 1.5 line). It was 14px serif at 1.45.
  • File editor name: it takes --font-title (600, 14px sans), as a pane's title. It was 600 14.4px mono.
  • Visual review's case title: markup's reading face (700 15.5px sans) replaces a 500 18px serif.
  • Playground candidate titles and board column names: they take --font-title. Candidate titles go from 600 17px to 14px. Column names go from 13px to 14px, and now follow working density.
  • Trace: its small text loses the 12px floor and takes --font-small (10.5px at working density).
  • An option's ✓: the chosen box cuts the layer's check icon out of its fill as a mask, where an 8px ✓ glyph needed a type size of its own.
  • A call trace's root line and a diff line's comment "+": their bold goes from 700 to 600, the heaviest weight the fonts use.

The source exception

A widget's source text, such as a diff's lines, keeps the code inputs --mono, --code-size and --code-line, and the test allows them. They are theme inputs a page may set on one block (packages.md, "Theme inputs"), and a font resolved at the root would ignore a block's own code size. test_diffs.py's relative-font case now asserts that the code takes its block's size.

Checks

  • test_interface_fonts.py, test_interact_layer.py, dev/tests/model/test_stills.py and the extended relative-font case pass, and pre-commit is clean.
  • leaf-dev stills ran over 22 states against main, and the pairs were read. Code blocks, data sources and diff code show no change.

The maintainer picked both faces on the review page: a gloss card in a thread card's font, and the file editor's name in a pane title's font, as this branch sets them.

This was written by Claude Code on behalf of max-sixty

… them there

`tests/model/test_interface_fonts.py` now reads the bundled packages' sheets
(`packages/**/*.css`, less `vendor/`) as well as the core's, under the same rule
and with no exemptions: a rule that selects an `lf-` class names one of
base.css's `--font-*` fonts or inherits its holder's. On main the packages broke
it 103 times. They hand-rolled faces with leading of 1.3, 1.4 and 1.5 beside the
fonts' 1.45, and some sat off the type ladder: the trace's `max(12px,
var(--t-6))`, the file editor's 0.8 to 0.9rem, the timeline's 12px, visual
review's 15px heading and the option mark's 8px ✓.

### One font for source

`--font-source` (base.css, declared with the other fonts on `:is(:root,
.density-working)`) is source shown as a block, at the theme's code inputs:
`var(--code-size) / var(--code-line) var(--mono)`. Code blocks and a data
widget's source (reading.css), `lf-diff`'s host and code rows, and
`lf-call-diff` name it. A theme that sets `--code-size` on the root reaches it;
setting `--code-size` on a subtree no longer resizes the code blocks inside it,
as setting `--t-5` on a subtree doesn't resize `--font-ui` (packages.md, "Theme
inputs"). A `pre` now resets weight and slant, so code quoted inside an italic
blockquote stands upright.

### Each kind of word names its font

Toolbars, statuses, counts, readouts and captions take `--font-small`,
`--font-compact` or `--font-ui` by size; names `--font-name`; titles
`--font-title`; chips `--font-chip`; paths and mono readouts `--font-code`; the
trace's tooltip `--font-tip`; a checkpoint's name and a timeline's labels
`--font-status`; Plot's chart `--font-fine`, whose 10px is the size Plot lays
its axes out for. Weight 700 drops to 600, and a `<strong>` total keeps its
weight through `--font-title`. A drawing whose words stand in rows of stated
heights (the trace's timeline, `lf-timeline`'s chart) names its font and keeps
`line-height: 1`, as the core's margin entry does. The screenshot's frame names
wear `.lf-label`, so they now take the label font from it.

### Boxes a line used to size are sized by layout

- The option add field keeps its font's own line. Under a finger, where the
  entry floor sets its words at 16px, a negative margin of half what that line
  adds over the option's keeps the row at the option's height. The add cell
  takes the row's font, as a card's already took the page's, so on a desktop
  the field matches its option without a pinned line.
- An option's `§` reference and the trace's moment flag centre their words by
  padding.
- A side list's summary and outcome lines are their fonts' lines, and the
  strip's pre-upgrade reserve is computed from the same fonts.
- The contents map clamps its labels at `2lh` and `1lh`, and an outline row's
  padding keeps it at the aim floor under the taller line.

### Words of the page in a widget's box

- A gloss card reads in the face of the prose around its phrase, upright and at
  regular weight, as paper already prints it, rather than in a 14px serif of its
  own.
- Visual review's case title takes markup's reading face, which the review
  already wears: a sans heading at `--t-3`, bold, where it was a 500-weight
  serif at `--t-2`.
- A diff's thread outlet names `--font-message`, and a playground candidate's
  title `--font-title`.

### Also

- The option mark's ✓ is the layer's `check` icon cut out of the filled box by a
  mask, with a forced-colors fill, rather than an 8px glyph.
- The default package's apparatus rule keeps only tabular figures, since every
  label it lists names its own font, and is imported last so those fonts no
  longer reset the figures, as they had on samples' and stacked tabs' labels.
- `packages.md` tells package authors that a widget's own words name the font
  for their kind, and why.
- `leaf-dev stills` gains states for an open gloss, a deck, the detail dial and
  the file editor.

### Checks

- `leaf-dev stills f70e039` (the merge base) over 85 states that draw every
  changed package, the four new ones included. Most differences are leading
  under a pixel. The larger ones are deliberate: the gloss card, visual
  review's case title, the playground candidate titles (17px to 14px), the
  file editor's name (14.4px bold mono to `--font-code`), the screenshot's
  frame names (13px to the label font), and the trace's small words at working
  density (its 12px floor gone, so 10.5px there).
- `leaf-dev probe` of the option add field on a desktop and under a finger:
  the add cell is its option's height in both arms (31px and 44px).
- `tests/model/test_interface_fonts.py`, `tests/model/test_interact_layer.py`,
  `dev/tests/model/test_stills.py` and
  `test_an_inline_patch_stays_readable_until_its_drawing_arrives` pass.
  `test_the_add_field_previews_the_option_it_will_make` fails on this branch
  and on its merge base alike: Add stands about 5px below its field's middle in
  both.
…reaches it

`--font-source`, the source face the previous commit declared with the interface
fonts, resolved on the root and in a working-density scope. A page that sets
`--code-size` on one block, as packages.md's "Theme inputs" allows, no longer
resized that block's code: `test_diffs.py`'s relative-font diff, which sets
`--code-size: 1em`, drew at the root's 13.5px instead of its text's 17px.

The font is gone. Code blocks and a data widget's source (reading.css), lf-diff's
host and code rows, and lf-call-diff state `var(--mono)`, `var(--code-size)` and
`var(--code-line)` again, as on main. lf-diff's code rows state them as longhands
rather than the `font` shorthand, so they now inherit the host's
`font-variant-ligatures: none` where the shorthand reset it.

`test_interface_fonts.py` allows those three inputs as a source face's own family,
size and line: they are theme inputs a page may set on a subtree, and they set the
page's source rather than the interface's words. The relative-font case now
asserts that the diff's code takes its text's size while a diff that sets no code
size keeps the theme's; it failed with the root font (13.5px against 17px) and
passes now.
…density

The previous commit named `--font-name` for a column's name and the card count
beside it. That font resolves on the root only, so a thread's names keep their
size at any density, and on a working-density board it set these at the root's
13px where main drew 12px. `--font-title` (600, `--t-5`) follows the density:
14px at the default, where main drew 600 13px, and 12.5px at working density.
… its title

Two faces from the first commit read worse than main.

- A gloss card inherited the prose around its phrase, which on a reading page set
  it at 17px with a 1.6 line, heavier than the paragraph it explains, and wrapped a
  one-line tip. The explanation is words in a card standing over the page, so it
  now takes `--font-message`, the face a thread card's words take: 14px sans on a
  1.5 line. The shorthand sets it upright and regular, so the card no longer
  states its slant and weight.
- `--font-code` set the file editor's name at 11.5px, smaller than the code under
  it. The name is the pane's title, as a board's column names and a playground
  candidate's titles are, so it takes `--font-title`: 600 at `--t-5`, in sans.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approval is held for the maintainer's gloss-card and file-editor font choices, as requested in the PR description.

Inherited test failure

test_the_add_field_previews_the_option_it_will_make fails its Add-icon/text-center alignment assertion on both the reviewed tree (317.453125px versus 312.453125px) and base commit 945fce2f85f07a7185de4c4207a19d6de0773797 (317.796875px versus 312.453125px). This is already tracked in #4817 and does not withhold the code verdict.

@max-sixty

Copy link
Copy Markdown
Owner Author

@leaf-agent the maintainer has made both font picks the review held approval for: a gloss card takes --font-message and the file editor's name takes --font-title, which is what this head (d7efac6) already sets. The PR description now records them. Please re-review.

This was written by Claude Code on behalf of max-sixty

@max-sixty
max-sixty merged commit 1b63014 into main Oct 31, 2026
5 checks passed
@max-sixty
max-sixty deleted the package-fonts branch October 31, 2026 22:56
leaf-agent added a commit that referenced this pull request Nov 2, 2026
Worktree activation shrank its overview and path because their
pre-activation space still assumed a 1.5 line height after #4859 moved
the text onto interface fonts using 1.45. Reserve those lines with the
same named fonts and CSS `1lh`, so future font changes carry their
startup geometry with them. The original native-layout regression fails
before this fix with a 1.28125px shift and passes afterward at 1600px
and 720px.

The visible change is confined to the pre-activation overview and open
worktree path reservations. The activated collection has the same
measured height on both revisions. A new `worktree-startup` stills state
holds the activation module until capture; open, closed, dark and phone
worktree states were also captured and inspected.

Validation: the native startup and worktree summary layout checks passed
(4 cases and 12 subtests), interface-font and stills tooling checks
passed, all 737 runtime tests passed, and Ruff checks passed. A
base/candidate startup probe loaded the same 42 JavaScript requests and
3,453,669 JavaScript bytes through first state presentation; stylesheet
code grew by 56 bytes.

Closes #4985 — automated triage

<details><summary>Pre-activation worktree: before and after</summary>

The authored evidence starts slightly higher, matching where activation
already placed it.

![Before activation on
main](https://github.com/user-attachments/assets/7237e082-d98d-4948-931c-efb8331cf4c8)

![Before activation with the corrected
reservations](https://github.com/user-attachments/assets/ae32bc65-d8da-46d7-95c0-5503300581e4)

</details>

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 2, 2026
The selected-option tests still required a ✓ text glyph after #4859
deliberately replaced it with a masked check icon. Check the mark's
painted fill and cut-out instead, preserving the accessible-name and
interaction assertions. The ring measurement also sampled a scope label
covering the right edge; leave the active group before measuring so the
test reads the ring itself. The reopened-card test likewise leaves
binding badges before inspecting the selection mark.

All five reported failures reproduced before the repair and pass
afterward, including with 6× CPU throttling. A control with the check
mask removed fails the new pixel assertion. Ruff and formatting checks
pass. Product rendering is unchanged.

Closes #5077 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 3, 2026
…2px floor (#5204)

`test_trace_overview_shows_every_row_and_preserves_page_scrolling`
failed because it still asserted a 12px floor that #4859 removed on
purpose. That PR moved the trace's small text from `max(12px,
var(--t-6))` to `--font-small` and said so in its "What changes on
screen" list ("its small text loses the 12px floor and takes
`--font-small`"). At reading density `--t-6` is 0.71875rem (11.5px), so
the caption came out at 11.5px and failed `>= 12`.

This PR keeps #4859's intent and changes only the test. The two `>= 12`
checks become one assertion: the ruler labels and the caption share a
font size, family and color. That keeps the old color pairing and adds
size and family. Nothing changes on screen.

The test failed locally on `main` with the reported assertion and passes
with this change. It compares longhand properties rather than the `font`
shorthand, because Chrome can return an empty shorthand when
`font-variant-numeric` is set, and an empty-equals-empty comparison
would pass without checking anything.

Closes #5159 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 3, 2026
…ch floor (#5208)

Under touch, each contents link stands 43.984px tall, 1/64px short of
the 44px floor `test_a_table_of_contents_link_is_a_finger_s_aim` checked
exactly. The link reaches the floor through padding, `(--aim-floor -
1lh) / 2`
([toc.css](https://github.com/max-sixty/leaf/blob/9be85f5638a650fb1c890d4c7ed93e0b729c5846/packages/default/styles/toc.css#L119)).
Since #4859 set the outline in `--font-ui` (14px at line-height 1.45, so
a 20.3px line), Chrome truncates the line box and the padding to 1/64px
layout units, and the sum falls short by one unit. Before that change
the line was 1.3 and happened to round to the floor.

Padding is the layer's documented way to state a block floor (the
aim-floor comment in `browser/styles/components/surfaces.css`).
`test_coarse_pointer_panel_lists_give_humane_aims` already accepts the
same shortfall by checking against 43.9. This test now uses that
threshold too. It still checks the same behavior: finger-sized rows
under touch and compact 24–30px rows under a mouse. No CSS or layout
changes.

The test fails on current `main` (both links measure 43.984375px) and
passes with this change.

Closes #5163 — automated triage

Co-authored-by: leaf-agent <[email protected]>
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