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 2015/12/02 18:10:11 UTC

[jira] [Resolved] (PDFBOX-3144) NullPointerException in TTFSubsetter

     [ https://issues.apache.org/jira/browse/PDFBOX-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Hewson resolved PDFBOX-3144.
---------------------------------
    Resolution: Fixed

Ok, I've added some code to avoid the NPE in the future.

> NullPointerException in TTFSubsetter
> ------------------------------------
>
>                 Key: PDFBOX-3144
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3144
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.0
>         Environment: Version 2.0.0-RC2
>            Reporter: Philip Helger
>            Assignee: John Hewson
>             Fix For: 2.0.0
>
>
> An NPE happens in "public void TTFSubsetter.add(int unicode)" because the "unicodeCmap" member is null.
> This might be, because the passed "ttf" member is based on a "MemoryTTFDataStream" and has only 38 glyphs (so it might already be a subset). The available tables of the TTF are only: [fpgm, head, cvt , glyf, loca, gasp, hmtx, prep, hhea, maxp]
> The variables of the underyling font are:
> {code}
> this	PDType0Font  (id=58)	
> 	afmStandard14	null	
> 	avgFontWidth	0.0	
> 	cMap	CMap  -> Identity-H
> 	cMapUCS2	null	
> 	descendantFont	PDCIDFontType2  (id=155)	
> 	dict	COSDictionary  -> COSDictionary{(COSName{Type}:COSName{Font}) (COSName{BaseFont}:COSName{AAAMSE+OpenSans-Bold}) (COSName{Subtype}:COSName{Type0}) (COSName{Encoding}:COSName{Identity-H}) (COSName{DescendantFonts}:COSArray{[COSDictionary{(COSName{Type}:COSName{Font}) (COSName{Subtype}:COSName{CIDFontType2}) (COSName{BaseFont}:COSName{AAAMSE+OpenSans-Bold}) (COSName{CIDSystemInfo}:COSDictionary{(COSName{Registry}:COSString{Adobe}) (COSName{Ordering}:COSString{Identity}) (COSName{Supplement}:COSInt{0}) }) (COSName{FontDescriptor}:COSDictionary{(COSName{Type}:COSName{FontDescriptor}) (COSName{FontName}:COSName{AAAMSE+OpenSans-Bold}) (COSName{Flags}:COSInt{4}) (COSName{FontWeight}:COSFloat{700.0}) (COSName{ItalicAngle}:COSFloat{0.0}) (COSName{FontBBox}:COSArray{[COSFloat{-619.1406}, COSFloat{-292.96875}, COSFloat{1318.8477}, COSFloat{1068.8477}]}) (COSName{Ascent}:COSFloat{1068.8477}) (COSName{Descent}:COSFloat{-292.96875}) (COSName{CapHeight}:COSFloat{713.8672}) (COSName{XHeight}:COSFloat{545.89844}) (COSName{StemV}:COSFloat{251.93846}) (COSName{FontFile2}:COSStream{(COSName{Filter}:COSName{FlateDecode}) (COSName{Length}:COSInt{5625}) (COSName{Length1}:COSInt{8036}) }) (COSName{CIDSet}:COSStream{(COSName{Filter}:COSName{FlateDecode}) (COSName{Length}:COSInt{20}) }) }) (COSName{W}:COSArray{[COSInt{3}, COSArray{[COSInt{260}]}, COSInt{68}, COSArray{[COSInt{604}, COSInt{633}, COSInt{514}, COSInt{633}, COSInt{591}]}, COSInt{74}, COSArray{[COSInt{565}, COSInt{657}, COSInt{305}]}, COSInt{15}, COSArray{[COSInt{290}]}, COSInt{79}, COSArray{[COSInt{305}]}, COSInt{16}, COSArray{[COSInt{322}]}, COSInt{80}, COSArray{[COSInt{982}]}, COSInt{17}, COSArray{[COSInt{285}]}, COSInt{81}, COSArray{[COSInt{657}, COSInt{619}]}, COSInt{19}, COSArray{[COSInt{571}]}, COSInt{83}, COSArray{[COSInt{633}]}, COSInt{20}, COSArray{[COSInt{571}]}, COSInt{85}, COSArray{[COSInt{454}, COSInt{497}, COSInt{434}, COSInt{657}]}, COSInt{27}, COSArray{[COSInt{571}, COSInt{571}, COSInt{285}]}, COSInt{93}, COSArray{[COSInt{488}]}, COSInt{36}, COSArray{[COSInt{690}, COSInt{672}]}, COSInt{40}, COSArray{[COSInt{560}]}, COSInt{48}, COSArray{[COSInt{943}, COSInt{813}]}, COSInt{53}, COSArray{[COSInt{660}, COSInt{551}, COSInt{579}, COSInt{756}]}, COSInt{61}, COSArray{[COSInt{579}]}]}) (COSName{CIDToGIDMap}:COSStream{(COSName{Filter}:COSName{FlateDecode}) (COSName{Length}:COSInt{84}) (COSName{Length1}:COSInt{188}) }) }]}) (COSName{ToUnicode}:COSStream{(COSName{Filter}:COSName{FlateDecode}) (COSName{Length}:COSInt{324}) }) }
> 	embedder	PDCIDFontType2Embedder 
> 	fontDescriptor	null	
> 	fontWidthOfSpace	-1.0	
> 	isCMapPredefined	true	
> 	isDescendantCJK	false	
> 	noUnicode	HashSet<E>  -> empty
> 	toUnicodeCMap	null	
> 	widths	null	
> {code}
> I will try to find a minimum example on how to reproduce this. Currently it is only reproducible as part of a bigger package :|



--
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