[
https://issues.apache.org/jira/browse/PDFBOX-3018?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andreas Lehmkühler reassigned PDFBOX-3018:
------------------------------------------
Assignee: Andreas Lehmkühler
> IOException "head is mandatory" when using getOriginalData() of TT font from
> TTC file
> -------------------------------------------------------------------------------------
>
> Key: PDFBOX-3018
> URL: https://issues.apache.org/jira/browse/PDFBOX-3018
> Project: PDFBox
> Issue Type: Bug
> Components: FontBox
> Affects Versions: 2.0.0
> Reporter: Tilman Hausherr
> Assignee: Andreas Lehmkühler
> Attachments: ttctest.pdf
>
>
> I tried this to answer this question:
> http://stackoverflow.com/questions/33044069/pdfbox-2-0-and-ttc-fonts
> {code}
> TrueTypeCollection trueTypeCollection = new TrueTypeCollection(new
> File("c:/windows/fonts/MSGothic.ttc"));
> TrueTypeFont ttFont = null;
> for (TrueTypeFont font : trueTypeCollection.getFonts())
> {
> if ("MS-Gothic".equals(font.getName()))
> {
> ttFont = font;
> }
> }
> if (ttFont == null)
> {
> return;
> }
> PDType0Font font = PDType0Font.load(document,
> ttFont.getOriginalData(), true);
> {code}
> However this doesn't work:
> {code}
> Exception in thread "main" java.io.IOException: head is mandatory
> at org.apache.fontbox.ttf.TTFParser.parseTables(TTFParser.java:176)
> at org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:145)
> at org.apache.fontbox.ttf.TTFParser.parseEmbedded(TTFParser.java:119)
> at
> org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.buildFontFile2(TrueTypeEmbedder.java:89)
> at
> org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.<init>(TrueTypeEmbedder.java:72)
> at
> org.apache.pdfbox.pdmodel.font.PDCIDFontType2Embedder.<init>(PDCIDFontType2Embedder.java:61)
> at org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:120)
> at org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:89)
> {code}
> From Andreas:
> {quote}
> Looks like a bug. ttFont.getOriginalData() returns the data of the underlying
> ttc instead of the single ttf.
> {quote}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]