You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2015/11/06 18:45:11 UTC

[jira] [Commented] (PDFBOX-3093) Exception in TTFParser

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

Tilman Hausherr commented on PDFBOX-3093:
-----------------------------------------

I tried this with your font:
{code}
        PDDocument doc = new PDDocument();
        PDType0Font.load(doc, new FileInputStream("..../resfont.ttf"));
{code}
and it doesn't work because the post table is also missing. I then added "true" as third load parameter made a change in PDType0Font.java to pass "embedded" to {{new TTFParser}} but then I got an NPE. I kept doing more changes and still had trouble... long story short: please attach a PDF file with that font.

> Exception in TTFParser
> ----------------------
>
>                 Key: PDFBOX-3093
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3093
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Timur Kamalov
>         Attachments: Skipping_font_tables_with_zero_length_.patch, resfont.ttf
>
>
> The reason for this is an ambiguity in the TrueType specification. Namely, one of the font tables (OS/2) is present in the font directory with length 0. The specification itself is completely silent about this. 
> The only other information I was able to find is:
> - the FreeType font library (http://www.freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#FT_Sfnt_Table_Info) assumes that any table having 0 length in the font directory is treated as missing.
> - Google OpenType Sanitizer would report an error in such situation: https://github.com/khaledhosny/ots/blob/master/src/ots.cc, lines 575-578
> - there are several related discussions at Adobe forums: https://forums.adobe.com/thread/1616317 , https://forums.adobe.com/thread/1611899
>  As allowing zero length tables in TrueType fonts seems to be quite logical (and also implicitly confirmed by Adobe Acrobat validator), I've changed the TTFParser to skip tables with 0 length.
> Attaching patch and font file. Will add test file also if necessary.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org