[ https://issues.apache.org/jira/browse/PDFBOX-5922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17906318#comment-17906318 ]
bai yuan commented on PDFBOX-5922: ---------------------------------- [~tilman] I check this is correct in 2.0.32. You can close this bug. > 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 > Priority: Major > Attachments: Cantarell-VF.otf, Cantarell-VF.pdf, > 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