[ https://issues.apache.org/jira/browse/PDFBOX-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14312697#comment-14312697 ]
John Hewson commented on PDFBOX-2665: ------------------------------------- The real problem is the encode method, what should that do? getStringWidth simply returns the widths of the glyphs which encode has found in the font. The difficulty is that is a user expects a tab to be a single character, then its is wrong for us to say, replace it with four spaces. What if they want three spaces? What if they'd rather have an error when a missing glyph is used, even if it is a whitespace? Different use cases are going to have different needs and our API has to work at the level of the lowest common denominator. Not to mention all the other kinds of whitespace, newlines, form feeds, non-breaking spaces, zero-width joiners, etc. It's too easy for end-users to generate PDFs with missing glyphs unless PDFBox catches this error and throws an exception. Though perhaps we should throw a checked exception? > PDType1Font (HELVETICA) encode getting NullPointerException > ----------------------------------------------------------- > > Key: PDFBOX-2665 > URL: https://issues.apache.org/jira/browse/PDFBOX-2665 > Project: PDFBox > Issue Type: Bug > Components: PDModel > Affects Versions: 2.0.0 > Environment: Win 7, JDK 7, JBoss AS 7 > Reporter: Daniel Brownell > Assignee: John Hewson > Fix For: 2.0.0 > > > Hi, > I have been trying to revert to previous pdfbox-2.0.0 versions, which is why > the error is from a previous build, but this is applicable to the latest > (2.0.0-20150204.015951-1042) too. > I am getting this error, which I was not getting a month ago. > Regards... > Error: java.lang.NullPointerException > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:309) > [pdfbox-2.0.0-20150129.080600-1013.jar:2.0.0-SNAPSHOT] > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:267) > [pdfbox-2.0.0-20150129.080600-1013.jar:2.0.0-SNAPSHOT] > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:316) > [pdfbox-2.0.0-20150129.080600-1013.jar:2.0.0-SNAPSHOT] -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org