You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Wolfgang Glas (JIRA)" <ji...@apache.org> on 2011/05/27 09:04:47 UTC

[jira] [Commented] (PDFBOX-976) ClassCastException in PDFont.getFontWidth(int)

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

Wolfgang Glas commented on PDFBOX-976:
--------------------------------------

Hi all,

  This issue is a real blocker, which prevents a fair amount of users from using pdfbox-1.5.0.

  Please consider releasing a pdfbox-1.5.1 version in order to provide these sers with a  possibility to use pdfbox-1.5 features.

    TIA, Wolfgang

> ClassCastException in PDFont.getFontWidth(int)
> ----------------------------------------------
>
>                 Key: PDFBOX-976
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-976
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 1.5.0
>         Environment: Sun JDK 6u24.
>            Reporter: Jan Normann Nielsen
>            Assignee: Andreas Lehmkühler
>             Fix For: 1.6.0
>
>
> Using PDFont.getFontWidth() on a TrueType font fails with ClassCastException in PDFBox 1.5.0:
> Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Float
> 	at org.apache.pdfbox.pdmodel.font.PDFont.getFontWidth(PDFont.java:786)
> 	at org.apache.pdfbox.pdmodel.font.PDSimpleFont.getFontWidth(PDSimpleFont.java:191)
> 	at org.apache.pdfbox.pdmodel.font.PDFont.getStringWidth(PDFont.java:283)
> 	at ...
> This is due to PDTrueTypeFont.loadDescriptorDictionary(...) loading a non-generic List of Integer instances (lines 342-355) and then calling setWidths() with that list in line 356. But the list has been declared as List<Float>. PDFont.getFontWidth(int) then fails in line 786 with that the exception.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira