Hi, Am 10.10.2015 um 13:36 schrieb Tilman Hausherr:
I tried this to answer this question: http://stackoverflow.com/questions/33044069/pdfbox-2-0-and-ttc-fontsTrueTypeCollection 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); 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) Is this a bug, or is this a misunderstanding by me, i.e. that this isn't assumed to work this way? I am able to save these streams and display them with Windows font preview.
Looks like a bug. ttFont.getOriginalData() returns the data of the underlying ttc instead of the single ttf.
Tilman
BR Andreas --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

