[
https://issues.apache.org/jira/browse/PDFBOX-3344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15278830#comment-15278830
]
John Hewson commented on PDFBOX-3344:
-------------------------------------
As Tilman noted, the problem with the etichette.pdf file is that it contains a
CIDFontType2 with a FontFile2 which contains an OTF instead of a TTF. We've
seen these kinds of mix-ups before, and Acrobat tends to resolve them.
OpenType fonts are special, because OTFs technically come in two flavours,
PostScript and TrueType. The PostScript flavour begins with the ASCII sequence
OTTO and is generally referred to as an "OTF" and given the extension .otf,
while the TrueType flavour begins with a fixed-point version number and is
given the extension .ttf. In PDFBox the OpenTypeFont class reflects this dual
purpose, behaving as both a TrueTypeFont, and providing the ability to access
the embedded CFF. If you try to parse TTF outlines from a CFF-flavoured font,
you're going to get errors about the local and glyf tables being missing,
likewise if you try to extract the CFF table form a TTF-flavored font.
Most of PDFBox was built around CFFFont and TrueTypeFont, with OpenTypeFont
being added more recently to accommodate exactly this kind of "wrong FontFile"
problem, where we have to second-guess the PDF file. Note that it's sometimes
necessary to treat fonts as both - to using the cmap table for encoding, but
the CFF for rendering glyphs.
> Caused by: java.lang.ClassCastException: org.apache.fontbox.ttf.OpenTypeFont
> can not be cast to org.apache.fontbox.cff.CFFFont
> ------------------------------------------------------------------------------------------------------------------------------
>
> Key: PDFBOX-3344
> URL: https://issues.apache.org/jira/browse/PDFBOX-3344
> Project: PDFBox
> Issue Type: Bug
> Components: FontBox
> Affects Versions: 2.0.1
> Reporter: 373 mch
> Attachments: .pdfbox.cache, etichette.pdf, fontfile2.ttf,
> helvetica.pdf, screenshot_1.png, screenshot_2_pdfdebugger.png,
> screenshot_3_chrome.png, screenshot_4_acrobat.png, screenshot_5_ansi.png
>
>
> I'm getting this error opening a specific pdf
> {noformat}
> Caused by: java.lang.ClassCastException: org.apache.fontbox.ttf.OpenTypeFont
> can not be cast to org.apache.fontbox.cff.CFFFont
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]