Skip to content

fix(text): activate verticalAlign on maxHeight alone#28

Merged
chiefcll merged 1 commit into
mainfrom
feat/text-vertical-align-activate-on-maxheight
May 22, 2026
Merged

fix(text): activate verticalAlign on maxHeight alone#28
chiefcll merged 1 commit into
mainfrom
feat/text-vertical-align-activate-on-maxheight

Conversation

@chiefcll
Copy link
Copy Markdown
Contributor

Summary

  • verticalAlign was silently ignored unless contain included height. Setting verticalAlign: 'middle' on a node with only maxHeight did nothing. This splits the gating so verticalAlign activates whenever maxHeight > 0, while the mountY-against-maxHeight override stays tied to contain & height (preserves existing mount semantics).
  • Removes the stale "Not yet implemented in the SDF renderer" docstring on the verticalAlign prop — CoreTextNode already drives the offset for both backends — and corrects the documented @default (Stage.ts resolves missing values to 'top', not 'middle').
  • Adds a 3-line row to the visual regression matrix (taller 280×280 container) to catch any first-line vs last-line asymmetry across top / middle / bottom.

Decisions

  • 'top' semantics: kept as CSS line-box (current behavior — half-leading above the first cap-top). No new 'top-tight' enum.
  • 'bottom' semantics: kept as CSS — half-leading slack below the last descender.
  • 'baseline': explicitly considered and skipped (no obvious meaning in a block-vs-maxHeight context).
  • Activation: maxHeight > 0 alone. This is the only behavior change.

Test plan

  • pnpm build clean.
  • vitest run — 168/168 pass.
  • Full VRT in Docker CI mode — 163/163 pass against the new certified set (only text-vertical-align-{1,2}.png changed; all other text/scaling/contain snapshots produce identical bytes because the default is unchanged).
  • Verified rendered output for 1-line / 2-line / 3-line × top / middle / bottom × sdf / canvas matches expectations (cap-anchored baselines land on the green reference lines).

🤖 Generated with Claude Code

verticalAlign was silently ignored unless `contain` included height — so
setting `verticalAlign: 'middle'` on a node with only `maxHeight` did
nothing. Split the gating: verticalAlign now activates whenever
maxHeight > 0, while the mountY-against-maxHeight override stays tied
to `contain & height` (preserving existing mount semantics).

Also fix the stale `Not yet implemented in the SDF renderer` docstring
on the verticalAlign prop — CoreTextNode handles both backends — and
correct the documented default (Stage.ts resolves to 'top'). Adds a
3-line row to the visual regression matrix to cover first/last-line
asymmetry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@chiefcll chiefcll merged commit d9d9d2b into main May 22, 2026
1 check passed
@chiefcll chiefcll deleted the feat/text-vertical-align-activate-on-maxheight branch May 22, 2026 16:48
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