Loosen headline leading for 2-line headlines

1.1 line-height reads fine for a single line but felt cramped once a
headline wraps to two lines. Added a lineHeightTwoLine token (1.2),
applied only when fit.lineCount === 2 — single-line and 3-line headlines
are unaffected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ShaneandClaude Sonnet 5 committed 2026-07-16 18:34:18 -05:00
1 parent e9895ff051
commit db133fbd33
2 files changed
+7 -1

No files matched your search

+3 -1
View File
@@ -262,7 +262,9 @@ export async function GET(req: Request) {
}
const headlineSize = fit.fontSize * s
const headlineLineHeight = Math.round(headlineSize * HEADLINE.lineHeight)
const headlineLineHeight = Math.round(
headlineSize * (fit.lineCount === 2 ? HEADLINE.lineHeightTwoLine : HEADLINE.lineHeight)
)
// Gap between highlight runs on a line — a real space glyph's advance
// width at the rendered size, applied as marginLeft (see textBlock below).
const spaceWidthPx = measureLineWidth(headlineFont, ' ', headlineSize, HEADLINE.letterSpacing)
+4
View File
@@ -27,6 +27,10 @@ export const typography = {
compact: { minSize: 40, maxSize: 56 },
},
lineHeight: 1.1,
// Slightly looser leading once a headline wraps to 2 lines — 1.1 reads
// fine for a single line but feels a touch tight once there's a
// second line stacked underneath.
lineHeightTwoLine: 1.2,
letterSpacing: -0.02, // em
},
eyebrow: {