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

Nikolas Falco edited comment on PDFBOX-3018 at 10/16/15 6:12 PM:
-----------------------------------------------------------------

yes.
I have a uming.ttc font 
(http://www.freedesktop.org/wiki/Software/CJKUnifonts/Download/) that contains 
chinese variant for TW, HK and CN.
With beta 2.0 now handle parse file as Hausherr has done (or in alternative by 
FontMapper that load font in the system, but I prefer use directly to avoid 
installation in the server/develop enviroment).
After all I have a TrueTypeFont that can not be added to the document in 
creation or the filling form to embed it.


was (Author: nfalco79):
yes.
I have a uming.ttc font 
(http://www.freedesktop.org/wiki/Software/CJKUnifonts/Download/) that contains 
variant of chinese for TW, HK and CN.
With beta 2.0 now I can parse file as Hausherr has done or in alternative by 
FontMapper that load font in the system.
After all I have a TrueTypeFont that can not be added to the document in 
creation or the filling form to embed it.

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

Reply via email to