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/07/03 02:22:24 UTC

[jira] [Commented] (PDFBOX-2177) IndexOutOfBoundsException reading embedded OpenType font

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

John Hewson commented on PDFBOX-2177:
-------------------------------------

This bug is due to incorrect handling of the local subroutines in the embedded CFF font. This font uses multiple font dictionaries via the FDSelect mechanism, however in CFFParser a call to CFFFont#setLocalSubrIndex() is made which ignores the fact that the Subrs are stored in the Private dictionary (or dictionaries, in this case). Instead setLocalSubrIndex stores the Subrs for _just the last_ Private dict in the CFFFont. I've fixed that problem in [r1607501|http://svn.apache.org/r1607501] by storing the Subrs in the relevant Private dictionary.

However, there are still problems and we're still getting an IndexOutOfBoundsException from Type2CharString#drawAlternatingCurve(). This is because the wrong subroutine is being called, due to CFFFont#getLocalSubrIndex() returning the wrong Private dictionary. As far as I can tell there is a fairly substantial problem with the way that this mechanism is implemented in FontBox: my understanding of the CFF spec is that the FDSelect mechanism uses GIDs, however in CFFFont it uses CIDs, so we're looking up the wrong value. So we need to first convert the CID to a GID, however I can't even begin to make sense of the code in the fontbox.cff package. The handling of CIDs/SIDs/GIDs is... confusing.

> IndexOutOfBoundsException reading embedded OpenType font
> --------------------------------------------------------
>
>                 Key: PDFBOX-2177
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2177
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.0
>            Reporter: simon steiner
>         Attachments: out.7z
>
>
> java -jar ~/pdf-box-svn/app/target/pdfbox-app-2.0.0-SNAPSHOT.jar PDFToImage opentype.pdf 
> PDFToImage failed with the following exception:
> java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
> 	at java.util.SubList.rangeCheck(AbstractList.java:755)
> 	at java.util.SubList.get(AbstractList.java:639)
> 	at java.util.Collections$SynchronizedList.get(Collections.java:2477)
> 	at org.apache.fontbox.cff.Type2CharString.drawCurve(Type2CharString.java:356)
> 7zip attachment



--
This message was sent by Atlassian JIRA
(v6.2#6252)