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/01 05:56:25 UTC

[jira] [Comment Edited] (PDFBOX-2170) java.lang.ClassCastException: org.apache.fontbox.cff.CharStringCommand cannot be cast to java.lang.Integer

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

John Hewson edited comment on PDFBOX-2170 at 7/1/14 3:55 AM:
-------------------------------------------------------------

This bug is caused by a fundamental flaw in Villu's original design of Type1CharStringParser which assumes that the subroutines can be expanded without executing their commands. That turned out not to be true some time ago due to the need to execute the built-in "othersubrs".

What we're seeing here is a continuation of that problem: the "othersubrs" actually require the "div" operator to be executed, so the entire notion of expanding the subrs and othersubrs into a single sequence breaks down. Rather than doing a ton of refactoring I've added a workaround: a removeInteger() method which can execute a "div" command during the processing of an "othersubr". Fixed in [r1606973|http://svn.apache.org/r1606973].


was (Author: jahewson):
This bug is caused by a fundamental flaw in Villu's original design of Type1CharStringParser which assumes that the subroutines can be expanded without executing their commands. That turned out not to be true some time ago due to the need to execute the built-in "othersubrs".

What we're seeing here is a continuation of that problem: the "othersubrs" actually require the "div" operator to be executed, so the entire notion of expanding the subrs and othersubrs into a single sequence breaks down. Rather than doing a ton of refactoring I've added a workaround: a removeInteger() method which can execute a "div" command during the processing of an "othersubr". Fixed in [r1606973|http://svn.apache.org/r1606973.].

> java.lang.ClassCastException: org.apache.fontbox.cff.CharStringCommand cannot be cast to java.lang.Integer
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-2170
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2170
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>            Reporter: Tilman Hausherr
>            Assignee: John Hewson
>              Labels: type1font
>         Attachments: 002-002166.pdf
>
>
> p.59 of the attached file fails with
> {code}
> java.lang.ClassCastException: org.apache.fontbox.cff.CharStringCommand cannot be cast to java.lang.Integer
> 	at org.apache.fontbox.cff.Type1CharStringParser.parse(Type1CharStringParser.java:110)
> 	at org.apache.fontbox.cff.Type1CharStringParser.parse(Type1CharStringParser.java:89)
> 	at org.apache.fontbox.cff.Type1CharStringParser.parse(Type1CharStringParser.java:72)
> 	at org.apache.fontbox.type1.Type1Font.getType1CharString(Type1Font.java:151)
> 	at org.apache.fontbox.type1.Type1Font$Mapping.getType1CharString(Type1Font.java:207)
> 	at org.apache.pdfbox.pdfviewer.font.Type1Glyph2D.<init>(Type1Glyph2D.java:93)
> 	at org.apache.pdfbox.pdfviewer.font.Type1Glyph2D.<init>(Type1Glyph2D.java:65)
> Start parsing '002.zip002167.pdf'
> 	at org.apache.pdfbox.rendering.PageDrawer.createGlyph2D(PageDrawer.java:556)
> {code}



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