Skip to content

docs(templates): lineSpacing is points, not a multiple of the font size - #503

Merged
DemchaAV merged 1 commit into
developfrom
docs/line-spacing-units
Aug 4, 2026
Merged

docs(templates): lineSpacing is points, not a multiple of the font size#503
DemchaAV merged 1 commit into
developfrom
docs/line-spacing-units

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Why

The v1-classic authoring cheatsheet taught lineSpacing as a leading multiplier. Its
address-block recipe passed 1.3 with the comment "default 1.0 squashes \n-joined
lines"
— both halves wrong, and wrong in the direction a reader coming from CSS
line-height already leans.

lineSpacing is extra space in points. ParagraphBuilder initialises it to 0.0
and TextFlowSupport applies it as totalHeight += (lineCount - 1) * gap, so 1.3
bought a little over one point of air rather than 30% more leading, and no 1.0
default ever existed to override.

The page is archived — it carries its own banner saying so, and
which-template-system.md lists it under Historical (archived). It is still worth
correcting, because the error is not about the removed surface the banner disclaims:
ParagraphBuilder.lineSpacing(double) exists unchanged in 2.x with the same
points-based semantics. The page's stated audience is someone maintaining a pre-2.0
caller, and this sentence would send them into 2.x code with the wrong model of a
method that never changed. "Not updated anymore" is a promise to stop adding new
material, not a licence to leave a false statement standing.

What

  • The recipe passes 3 and says what the unit is: extra points, default 0, height
    grows by (lines - 1) × spacing.
  • The same 1.3 in the full template listing further down the page is corrected too —
    leaving it would have kept the misreading one scroll away.
  • The section heading no longer advertises lineSpacing(1.3) as the address-block
    recipe.

Checked the rest of the public docs for the same claim: docs/recipes/lists.md,
rich-text.md and shapes.md already describe it as a gap and pass point-shaped
values, so this page was the only one teaching the multiplier reading.

Tests

./mvnw -B -ntp clean verifyBUILD SUCCESS. No marked snippets on this page, so
the change is prose and sample values only; the guards that read it
(DocsBoldFaceGuardTest, CanonicalSurfaceGuardTest, link checks) pass.

The authoring cheatsheet's address-block recipe passed 1.3 and explained it
as overriding a default of 1.0 — the reading a CSS line-height invites, and
the one the number itself suggests. lineSpacing is extra space in points,
defaulting to 0: a paragraph grows by (lines - 1) * spacing, so 1.3 bought a
little over one point of air rather than 30% more leading, and there was no
1.0 default to override.

The recipe and the full template listing below it now pass a value that does
what the prose beside them promises, and the page states the unit.
@DemchaAV
DemchaAV force-pushed the docs/line-spacing-units branch from 92ef286 to 312bd76 Compare August 4, 2026 11:47
@DemchaAV
DemchaAV merged commit 0b53152 into develop Aug 4, 2026
10 checks passed
@DemchaAV
DemchaAV deleted the docs/line-spacing-units branch August 4, 2026 11:52
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