bai yuan created PDFBOX-5922: -------------------------------- Summary: An exception was thrown when an OTF font file was parser Key: PDFBOX-5922 URL: https://issues.apache.org/jira/browse/PDFBOX-5922 Project: PDFBox Issue Type: Bug Affects Versions: 2.0.24 Reporter: bai yuan Attachments: Cantarell-VF.otf, image-2024-12-17-15-06-23-047.png
Using OTFParser to parse the attach font file, it will throw an exception. {code:java} try (PDDocument document = new PDDocument()) { PDPage page = new PDPage(); document.addPage(page); OpenTypeFont otf = new OTFParser().parse("Cantarell-VF.otf"); PDFont font = PDType0Font.load(document, otf, false); PDPageContentStream contentStream = new PDPageContentStream(document, page); contentStream.beginText(); contentStream.setFont(font, 12); contentStream.newLineAtOffset(100, 700); contentStream.showText("Hello, this is a test with OTF font!"); contentStream.endText(); contentStream.close(); document.save("output.pdf"); } catch (IOException e) { e.printStackTrace(); } {code} !image-2024-12-17-15-06-23-047.png! -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org