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 2016/09/27 22:07:21 UTC

[jira] [Commented] (PDFBOX-3515) Problems with CourierStd font

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

John Hewson commented on PDFBOX-3515:
-------------------------------------

OTFs contain a CFF font. CFF fonts come in two flavors, CID-keyed, and Type 1-Equivalent. The PDF contains a missing embedded font of type CIDFontType0, which means it's expecting a CID-keyed CFF font. However, the substitute font on your system is a Type 1-Equivalent CFF font, but PDFBox isn't expecting that and so there is an exception.

This is a bug in PDFBox, which should be able to handle this eventuality. As a workaround you could try and find another version of the CourierStd font which is either a CID-keyed OTF, or a TTF, as those should work. 

> Problems with CourierStd font
> -----------------------------
>
>                 Key: PDFBOX-3515
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3515
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.3, 2.0.4
>         Environment: windows
>            Reporter: Esteban Nicolas Ruiz
>            Priority: Minor
>         Attachments: out.pdf
>
>
> Pdf file using CourierStd font doesn't display properly with PDF Debugger (CourierStd font not installed, using substitute font). File is properly displayed in Adobe Reader. 
> PDF Debugger output:
> {code}
> ADVERTENCIA: Using fallback LiberationSans for CID-keyed font CourierStd
> sep 27, 2016 4:42:00 PM org.apache.pdfbox.pdmodel.font.PDType0Font toUnicode
> ADVERTENCIA: No Unicode mapping for CID+36 (36) in font CourierStd
> sep 27, 2016 4:42:00 PM org.apache.pdfbox.rendering.CIDType0Glyph2D getPathForCharacterCode
> ADVERTENCIA: No glyph for 36 (CID 0024) in font CourierStd
> {code}
> If I install CourierStd otf font from http://freeopentypefonts.com/fonts-beginning-with-c/courierstd-open-type-font-download-open-type-font then I get the following exception:
> {code}
> java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.ClassCastException: org.apache.fontbox.cff.CFFType1Font cannot be cast to org.apache.fontbox.cff.CFFCIDFont
>     org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.done(PagePane.java:258)
>     sun.swing.AccumulativeRunnable.run(Unknown Source)
>     java.security.AccessController.doPrivileged(Native Method)
>     java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
> Caused by: java.util.concurrent.ExecutionException: java.lang.ClassCastException: org.apache.fontbox.cff.CFFType1Font cannot be cast to org.apache.fontbox.cff.CFFCIDFont
>     org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.done(PagePane.java:247)
>     sun.swing.AccumulativeRunnable.run(Unknown Source)
>     java.security.AccessController.doPrivileged(Native Method)
>     java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
> Caused by: java.lang.ClassCastException: org.apache.fontbox.cff.CFFType1Font cannot be cast to org.apache.fontbox.cff.CFFCIDFont
>     org.apache.pdfbox.pdmodel.font.PDCIDFontType0.<init>(PDCIDFontType0.java:134)
>     org.apache.pdfbox.pdmodel.font.PDFontFactory.createDescendantFont(PDFontFactory.java:121)
>     org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:128)
>     org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:83)
>     org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:143)
> {code}
> Maybe similar to: https://issues.apache.org/jira/browse/PDFBOX-3344



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