From 227f65a1300cdc8bc5f57fc472a11e388f4e4518 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 23 Apr 2023 06:07:40 +0200 Subject: Main.java: Don't embed the font This finally works. My guess is that the library was embedding the font and, crucially, _subsetting_ the font. But since we don't set any values before writing out the PDF, it was probably subsetting to 0 glyphs, effectively making it appear that the desired font wasn't being set. Forcing no embedding renders the font correctly. --- Main.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Main.java b/Main.java index fd4a8d5..701119f 100644 --- a/Main.java +++ b/Main.java @@ -38,7 +38,7 @@ public class Main { FontProgram courier_program = FontProgramFactory .createFont("/System/Library/Fonts/Supplemental/Copperplate.ttc", 0, false); PdfFont courier = PdfFontFactory - .createFont(courier_program, PdfEncodings.UTF8, PdfFontFactory.EmbeddingStrategy.PREFER_EMBEDDED); + .createFont(courier_program, PdfEncodings.UTF8, PdfFontFactory.EmbeddingStrategy.FORCE_NOT_EMBEDDED); PdfAcroForm form = PdfAcroForm.getAcroForm(pdf, false); Map fields = form.getFormFields(); -- cgit v1.2.3