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

Tilman Hausherr commented on PDFBOX-3806:
-----------------------------------------

Thanks for the file. The font is incorrect that the second table 
("leftSideBearing") was missing, although it should have had 2 entries 
(numGlyphs 9 minus 7 from the first table):
{quote}
leftSideBearing         FWord[ ]        Here the advanceWidth is assumed to be 
the same as the advanceWidth for the last entry above. The number of entries in 
this array is derived from numGlyphs (from ‘maxp’ table) minus 
numberOfHMetrics. This generally is used with a run of monospaced glyphs (e.g., 
Kanji fonts or Courier fonts). Only one run is allowed and it must be at the 
end. This allows a monospaced font to vary the left side bearing values for 
each glyph. 
{quote}
So I'll change the code to move {{if (bytesRead < getLength())}} down to make 
sure that the table is always created. Its entries will be 0, obviously.

> Nullpointer exception in getLeftSideBearing
> -------------------------------------------
>
>                 Key: PDFBOX-3806
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3806
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Daniel Persson
>            Priority: Minor
>         Attachments: font.raw
>
>
> While processing todays batch of data we got a Nullpointer exception in 
> getLeftSideBearing. Sadly I can't give you the PDF.
> ```
>     public int getLeftSideBearing(int gid) {
>         return gid < 
> this.numHMetrics?this.leftSideBearing[gid]:this.nonHorizontalLeftSideBearing[gid
>  - this.numHMetrics];
>     }
> ```
> In this function there could be a case where nonHorizontalLeftSideBearing is 
> null and you still ask for a GID in larger or equal to numHMetrics.
> First time I see this issue and so far only 4 characters in one PDF has this 
> issue so not critical.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to