You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andrew Thomas (JIRA)" <ji...@apache.org> on 2014/02/21 22:39:19 UTC

[jira] [Commented] (PDFBOX-1790) NPE during PDTrueTypeFont.loadTTF() on Mac TrueType font lacking Windows-platformID CMAPEncodingEntry

    [ https://issues.apache.org/jira/browse/PDFBOX-1790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13908843#comment-13908843 ] 

Andrew Thomas commented on PDFBOX-1790:
---------------------------------------

The incompatibility with Mac fonts seems fairly significant. 

Any idea when action would be taken to address this defect? It didn't get in 1.8.4, and I notice it's not on the roadmap for 1.8.5.

Should this NPE be a Blocker rather than Critical?

> NPE during PDTrueTypeFont.loadTTF() on Mac TrueType font lacking Windows-platformID CMAPEncodingEntry
> -----------------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-1790
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1790
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Writing
>    Affects Versions: 1.8.2
>         Environment: Mac 10.7 / Java 6
>            Reporter: Andrew Thomas
>            Assignee: Andreas Lehmkühler
>            Priority: Critical
>
> I'm attempting to embed a TrueType font using PDFBox, on the Mac, using PDTrueType.loadTTF( PDDocument, InputStream, Encoding ).
> For TrueType fonts originating from Windows (e.g., Tahoma) this works.
> For TrueType fonts originating from the Mac (e.g., Apple Chancery), a NullPointerException is thrown.
>     java.lang.NullPointerException
>                 at org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.loadDescriptorDictionary(PDTrueTypeFont.java:409)
>                 at org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.loadTTF(PDTrueTypeFont.java:201)
>                 at org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.loadTTF(PDTrueTypeFont.java:177)
> I stepped through the code in a debugger. The method PDTrueTypeFont.loadDescriptorDictionary() loops through the cmap table for the font, looking for a cmap with platform ID 3 (Windows), and sets the variable unimap only if one is found. After that loop, the variable unimap is dereferenced without checking for null.
> Some Mac TrueType fonts have platform IDs 0 (Unicode) and 1 (Mac), but not 3 (Windows).
> At the least, a null check seems required. But more desirable would be support for Mac TrueType fonts.
> Am I missing something, or should I enter a bug?
> Example problem font:
> * Apple Chancery (Included with OS)
> Details:
> * PDFBox version: 1.8.2 [Have not yet tested with 1.8.3, which was released a few days ago]
> * Platform: Mac
> * Java 6
> * Font platform IDs: 0, 1



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)