diff --git a/src/app/benchmarks/[slug]/share-card/route.tsx b/src/app/benchmarks/[slug]/share-card/route.tsx index 3ecc6c15..115bc86e 100644 --- a/src/app/benchmarks/[slug]/share-card/route.tsx +++ b/src/app/benchmarks/[slug]/share-card/route.tsx @@ -763,6 +763,20 @@ async function renderLeaderboard( const sorted = sortByP50(benchmark); const maxP50 = Math.max(...sorted.map((r) => r.ms.p50)) || 1; const subtitleLB = `Ranked by p50 ยท ${benchmark.metric}.`; + // Scale down type + spacing when the roster is dense OR the title is + // long, otherwise a 2-line 50pt title collides with the row list in + // the 630px canvas (weekend-drift 11 rows + long title case). + const count = sorted.length; + const titleLen = benchmark.title.length; + const dense = count >= 8 || titleLen > 55; + const veryDense = count >= 10 || titleLen > 70; + const titleSize = veryDense ? 32 : dense ? 40 : 50; + const rankSize = veryDense ? 18 : dense ? 20 : 24; + const nameSize = veryDense ? 18 : dense ? 20 : 24; + const valueSize = veryDense ? 22 : dense ? 24 : 28; + const barHeight = veryDense ? 6 : dense ? 7 : 8; + const rowGap = veryDense ? 8 : dense ? 10 : 14; + const logoSize = veryDense ? 22 : dense ? 24 : 28; return new ImageResponse( ( @@ -778,7 +792,7 @@ async function renderLeaderboard(