You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "John Hewson (JIRA)" <ji...@apache.org> on 2014/08/05 21:24:12 UTC
[jira] [Comment Edited] (PDFBOX-2215) NPE in
PDTrueTypeFont.makeFontDescriptor
[ https://issues.apache.org/jira/browse/PDFBOX-2215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14086634#comment-14086634 ]
John Hewson edited comment on PDFBOX-2215 at 8/5/14 7:23 PM:
-------------------------------------------------------------
It works for me but makeFontDescriptor is called when a font is loaded from the local system, so it seems that our local systems are providing different TTF files for "Symbol", I'm on OS X 10.9.3. From the extra information in the exception message I can compare the cmaps in our respective fonts:
{code}
Tilman: [{1 0}, {3 0}] = (Macintosh, Roman), (Windows, Symbol)
John: [{0 3}, {1 0}] = (Unicode, BMP), (Macintosh, Roman)
{code}
The old code was looking for a (Windows, Unicode) cmap, while the new code is looking for a (Unicode, Full/BMP) cmap. Neither will work on your system with this font, because it only has a (Windows, Symbol) cmap. I've added some code to the trunk so that PDFBox will look for the following cmaps in order: Unicode/Full, Unicode/BMP, Windows/Unicode, Windows/Symbol.
Microsoft's [Recommendations for OpenType Fonts|http://www.microsoft.com/typography/otspec/recom.htm] says that "Symbol" encoding actually means "Unicode, non-standard character set", so this seems ok, because we want a Unicode cmap.
was (Author: jahewson):
It works for me but makeFontDescriptor is called when a font is loaded from the local system, so it seems that our local systems are providing different TTF files for "Symbol", I'm on OS X 10.9.3. From the extra information in the exception message I can compare the cmaps in our respective fonts:
{code}
Tilman: [{1 0}, {3 0}] = {Macintosh, Roman}, {Windows, Symbol}
John: [{0 3}, {1 0}] = {Unicode, BMP}, {Macintosh, Roman}
{code}
The old code was looking for a {Windows, Unicode} cmap, while the new code is looking for a {Unicode, Full/BMP} cmap. Neither will work on your system with this font, because it only has a {Windows, Symbol} cmap. I've added some code to the trunk so that PDFBox will look for the following cmaps in order: Unicode/Full, Unicode/BMP, Windows/Unicode, Windows/Symbol.
Microsoft's [Recommendations for OpenType Fonts|http://www.microsoft.com/typography/otspec/recom.htm] says that "Symbol" encoding actually means "Unicode, non-standard character set", so this seems ok, because we want a Unicode cmap.
> NPE in PDTrueTypeFont.makeFontDescriptor
> ----------------------------------------
>
> Key: PDFBOX-2215
> URL: https://issues.apache.org/jira/browse/PDFBOX-2215
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 2.0.0
> Reporter: Tilman Hausherr
> Assignee: John Hewson
> Fix For: 2.0.0
>
> Attachments: PDFBOX-2215-027073.pdf
>
>
> I get an NPE with the attached file:
> {code}
> java.lang.NullPointerException
> at org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.makeFontDescriptor(PDTrueTypeFont.java:337)
> at org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.getFontDescriptor(PDTrueTypeFont.java:150)
> at org.apache.pdfbox.pdmodel.font.PDFont.getFontHeight(PDFont.java:350)
> {code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)