feat(pdf): embed Helvetica + Times-Roman standard fonts (MVP)
This commit is contained in:
1 parent
55d9c32076
commit
ba30e0dbaf
1 file changed
+8
-10
+8
-10
@@ -1,4 +1,4 @@
|
|||||||
import type { PDFDocument, PDFFont } from 'pdf-lib'
|
import { PDFDocument, StandardFonts, type PDFFont } from 'pdf-lib'
|
||||||
|
|
||||||
export interface EmbeddedFonts {
|
export interface EmbeddedFonts {
|
||||||
bodyRegular: PDFFont
|
bodyRegular: PDFFont
|
||||||
@@ -6,13 +6,11 @@ export interface EmbeddedFonts {
|
|||||||
headingRegular: PDFFont
|
headingRegular: PDFFont
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
export async function embedFonts(pdfDoc: PDFDocument): Promise<EmbeddedFonts> {
|
||||||
* Embeds Inter (body) and Fraunces (headings) into the PDF document.
|
const [bodyRegular, bodyBold, headingRegular] = await Promise.all([
|
||||||
* Font files are fetched from /fonts/ in the public directory.
|
pdfDoc.embedFont(StandardFonts.Helvetica),
|
||||||
* Both fonts must be TTF (pdf-lib does not support woff2 directly).
|
pdfDoc.embedFont(StandardFonts.HelveticaBold),
|
||||||
*/
|
pdfDoc.embedFont(StandardFonts.TimesRoman),
|
||||||
export async function embedFonts(
|
])
|
||||||
_pdfDoc: PDFDocument,
|
return { bodyRegular, bodyBold, headingRegular }
|
||||||
): Promise<EmbeddedFonts> {
|
|
||||||
throw new Error('not implemented')
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user