diff options
| author | kj_sh604 <43.splash@gmail.com> | 2026-03-08 21:00:17 -0400 |
|---|---|---|
| committer | kj_sh604 <43.splash@gmail.com> | 2026-03-08 21:00:17 -0400 |
| commit | 158dbe06681f16131a0770665a521b13db7c7bb0 (patch) | |
| tree | a9f5d1562d481ca9a3ba524742960bf6aa6adfc9 | |
| parent | d29192b67a4e1f88462d46d8608df98bc978da45 (diff) | |
fix: slight top offset on pdf render
| -rw-r--r-- | src/index.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/index.php b/src/index.php index 460a80f..5154ce8 100644 --- a/src/index.php +++ b/src/index.php @@ -657,15 +657,15 @@ questions?</textarea> ctx.font = `${fontSize}px ${fontStack}`; ctx.fillStyle = this.settings.fg; - ctx.textBaseline = 'alphabetic'; + ctx.textBaseline = 'middle'; const lineH = fontSize * this.settings.lineSpacing; - const totalH = lineH * (slide.lines.length - 1) + fontSize; + const totalH = slide.lines.length * lineH; const startX = marginX; - const startY = (H - totalH) / 2 + fontSize; // first baseline + const startY = (H - totalH) / 2; slide.lines.forEach((line, i) => { - ctx.fillText(line, startX, startY + i * lineH); + ctx.fillText(line, startX, startY + (i + 0.5) * lineH); }); } |
