feat(pdf): embed Helvetica + Times-Roman standard fonts (MVP)

This commit is contained in:
Bastien Chanot committed 2026-05-18 21:44:25 +02:00
1 parent 55d9c32076
commit ba30e0dbaf
1 file changed
+8 -10
+8 -10
View File
@@ -1,4 +1,4 @@
import type { PDFDocument, PDFFont } from 'pdf-lib'
import { PDFDocument, StandardFonts, type PDFFont } from 'pdf-lib'
export interface EmbeddedFonts {
bodyRegular: PDFFont
@@ -6,13 +6,11 @@ export interface EmbeddedFonts {
headingRegular: PDFFont
}
/**
* Embeds Inter (body) and Fraunces (headings) into the PDF document.
* Font files are fetched from /fonts/ in the public directory.
* Both fonts must be TTF (pdf-lib does not support woff2 directly).
*/
export async function embedFonts(
_pdfDoc: PDFDocument,
): Promise<EmbeddedFonts> {
throw new Error('not implemented')
export async function embedFonts(pdfDoc: PDFDocument): Promise<EmbeddedFonts> {
const [bodyRegular, bodyBold, headingRegular] = await Promise.all([
pdfDoc.embedFont(StandardFonts.Helvetica),
pdfDoc.embedFont(StandardFonts.HelveticaBold),
pdfDoc.embedFont(StandardFonts.TimesRoman),
])
return { bodyRegular, bodyBold, headingRegular }
}