Skip to content

fix(examples): the carousel sets leading in points, not multiples - #500

Merged
DemchaAV merged 1 commit into
developfrom
fix/carousel-line-breathing
Aug 4, 2026
Merged

fix(examples): the carousel sets leading in points, not multiples#500
DemchaAV merged 1 commit into
developfrom
fix/carousel-line-breathing

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Why

Every lineSpacing call in the carousel carried a typographic multiplier — 1.03, 1.06, 1.25, 1.4, 1.45. The API takes points:

  • ParagraphBuilder.lineSpacing is documented @param lineSpacing line spacing in points;
  • its default is private double lineSpacing = 0.0 — a multiplier's default would be 1.0, and 0.0 would collapse every line onto one;
  • TextFlowSupport:681-689 adds it as totalHeight += (lineCount - 1) * gap, on top of the font's own line height.

So the deck asked for one to one-and-a-half points of extra leading on type ranging from 26 pt to 156 pt, and rendered at effectively default leading throughout. That is why every slide read as a wall of text.

What changed

The values move into the file's own design units and taper with type size, because display faces need proportionally less leading than body copy: 8 * SCALE on the 132 pt headline, 6 on the 82 pt slide titles, 5 on the 40 pt lead paragraph, 4 on the 28 pt card body, 3 on the chart labels and the footnote. On the 33 pt card body that moves the gap from 1.4 pt to 4.7 pt. A comment at the first site records what the unit is, since the next person will guess the same way.

Verification

Rendered before and after, rasterized at 110 dpi, and measured the card panels rather than judging by eye:

card body lines before after delta
1 4 391 px 407 px +10.5 pt
2 3 343 px 353 px +6.5 pt
3 2 294 px 298 px +2.6 pt
4 3 342 px 352 px +6.5 pt

Three, two and one inter-line gaps of 3.3 pt each — exactly what the arithmetic predicts, which is the check that the change did what it claims rather than something else.

The deck stays six slides; the last card on the tallest slide clears the bottom margin by 193 pt. The three-line wrap of the cover headline is pre-existing — it is in the before render too.

./mvnw -B -ntp clean verifyBUILD SUCCESS, exit 0, 692 tests in the closing module. CommittedAssetDriftTest green: this deck is in UNPUBLISHED_PREVIEWS, so no committed asset moves with it.

A larger finding this exposed — not fixed here

The same misreading is repo-wide. Counting numeric literals in src/main:

module multiplier-shaped (< 2.0) point-shaped (≥ 2.0)
core 1 0
templates 34 0
examples 55 3

Zero call sites in the engine or the published templates use the API as documented. TimelineBuilder:287 sets 1.3 on every timeline entry body — that is engine code that ships. All the CV, cover-letter, invoice and proposal presets do the same, so every preset a user renders is running at essentially default leading while its author intended 1.3–1.5×.

docs/templates/v1-classic/authoring.md:189 is likely where it started: it says "default 1.0 squashes \n-joined lines", which is wrong — the default is 0.0.

Fixing that is a separate decision with real consequences: correcting 35 call sites in shipped code moves every layout snapshot and visual-regression baseline. Flagged for a call, not folded in here.

Lane: examples. No production code, no public API.

Every lineSpacing call in this file carried a typographic multiplier —
1.03, 1.06, 1.25, 1.4, 1.45. ParagraphBuilder.lineSpacing takes points:
TextFlowSupport adds it between wrapped lines as `(lineCount - 1) * gap`,
on top of the font's own line height. So the deck asked for a point and a
half of extra leading on type ranging from 26 to 156 points, and rendered
at effectively default leading throughout. Every slide read as a wall.

The values are now expressed in the file's own design units, tapering with
type size because display faces need proportionally less: 8 * SCALE on the
132pt headline, 6 on the 82pt slide titles, 5 on the 40pt lead paragraph,
4 on the 28pt card body, 3 on the chart labels and the footnote. On the
33pt card body that moves the gap from 1.4pt to 4.7pt.

Measured on the rendered pages at 110 dpi: a four-line card grows 10.5pt, a
three-line card 6.5pt, a two-line card 2.6pt — three, two and one inter-line
gaps of 3.3pt each, which is what the arithmetic predicts. The deck stays
six slides and the last card on the tallest slide still clears the bottom
margin by 193pt.

./mvnw -B -ntp clean verify — BUILD SUCCESS, 692 tests in the closing
module, CommittedAssetDriftTest green: this deck is an unpublished preview,
so no committed asset moves with it.
@DemchaAV
DemchaAV merged commit 39de48a into develop Aug 4, 2026
10 checks passed
@DemchaAV
DemchaAV deleted the fix/carousel-line-breathing branch August 4, 2026 07:37
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