Skip to content

Centre the voucher letter whatever the bold font - #122

Merged
TomiMalamud merged 1 commit into
mainfrom
claude/sdk-pdf-generation-i7gy4m
Oct 12, 2026
Merged

TomiMalamud merged 1 commit into
mainfrom
claude/sdk-pdf-generation-i7gy4m

Conversation

@TomiMalamud

Copy link
Copy Markdown
Collaborator

With lapyme's Geist theme, the letter sat low in its box. The cause is the letter's lineHeight: 1: react-pdf places the baseline at the font's ascent within that fixed line box, so a font with a tall ascent sinks the capital.

Measured

Baseline of a 24 pt capital in the 40 pt box, compared with the baseline that centres the capital, in points:

Bold font Before (lineHeight: 1) After (font's own line box)
Helvetica-Bold 0.98 low 0.22 high
Times-Bold 1.49 low 0.05 low
Courier-Bold 2.86 low 1.30 low
Geist Bold (lapyme) 3.60 low 0.00

Change

  • theme.ts: the letter style drops lineHeight, and a comment says why. The box keeps its fixed 40 × 40 size, so nothing else in the header moves.
  • Test: for Helvetica-Bold and Times-Bold, the capital's centre is within 0.5 pt of the box's centre. With lineHeight: 1 the test fails with 0.98 pt.
  • Changeset: a patch bump for both packages, to 0.25.1.

Validation

  • pnpm check
  • pnpm typecheck
  • pnpm test
  • pnpm check:docs

🤖 Generated with Claude Code

https://claude.ai/code/session_01PWf3KVPSbVbfiQgseVoyNW


Generated by Claude Code

The letter had lineHeight 1, which sinks the capital by the font's ascent:
1 pt with Helvetica and 3.6 pt with Geist. Without it, the font's own line
box centres the capital: within 0.25 pt for Helvetica, Times and Geist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWf3KVPSbVbfiQgseVoyNW
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T19:18:42.719945Z 502d5ea PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@TomiMalamud
TomiMalamud merged commit cdec00f into main Oct 12, 2026
2 checks passed
@TomiMalamud
TomiMalamud deleted the claude/sdk-pdf-generation-i7gy4m branch October 12, 2026 19:21
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