hotfix(pdf): swap vet-referral marker ⚠ → (!) for WinAnsi compatibility

Root cause: src/pdf/fonts.ts embeds StandardFonts.Helvetica /
HelveticaBold / TimesRoman, which use WinAnsi encoding (Latin-1
only). PDF export threw `WinAnsi cannot encode "⚠" (0x26a0)` the
moment the text-height estimator measured a vet-flagged leaf
label (countSegmentedLines → widthOfTextAtSize).

Fix: replace the PDF prefix "⚠ " with WinAnsi-safe "(!) ". The
picker DOM keeps the original "⚠" since browsers render U+26A0
natively — the limitation is purely on the PDF side.

Regression test exercises embedFonts + widthOfTextAtSize on a
realistic prefixed label; would catch any future non-WinAnsi
marker re-introduction.

Follow-up (not in scope): switch the PDF body to embedded TTF
(Inter / Fraunces per CLAUDE.md spec) so the catalog can carry
arbitrary glyphs. CLAUDE.md states TTFs should be used; current
StandardFonts is a drift from intent.

155/155 tests green, typecheck clean.
This commit is contained in:
Bastien Chanot committed 2026-05-21 03:33:59 +02:00
1 parent f5307ce61c
commit 143fdc3208
2 files changed
+17 -1

No files matched your search

+1 -1
View File
@@ -404,7 +404,7 @@ export async function addObservationPage(
const value = group
.map((f) => {
const lbl = locale === 'en' ? f.labelEnSnapshot : f.labelFrSnapshot
return f.requiresVetReferral ? `⚠ ${lbl}` : lbl
return f.requiresVetReferral ? `(!) ${lbl}` : lbl
})
.join(' · ')
sections.push({