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

Ralf Hauser commented on PDFBOX-3604:
-------------------------------------

I guess the underlying problem is that PDFBOX asks the programmer to declare 
the font twice:

1) first when loading to the PDDocument  and
2) and possibly multiple times again when setting the font to the 
PDPageContentStream which itself was instantiated with a reference to 
PDDocument too

so instead of throwing an exception - *programmer friendly* would probably be 
that if "setFont()" is used without the font already being present in the doc, 
just automatically do a "late addition to doc" ?

> The TrueType font does not contain a 'cmap' table
> -------------------------------------------------
>
>                 Key: PDFBOX-3604
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3604
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.3
>         Environment: debian stable, java8
>            Reporter: Ralf Hauser
>
> http://www.fonts2u.com/code2000.font is read in an inputstream and then made 
> to a PDFont.
> If I make this a static PDFont variable to only once read it from disk and 
> use it more than once, it only works with the first document I create and 
> thereafter I get the below error.
> Wouldn't it be nice to have this idempotent or at least with a reset() method?
> java.io.IOException: The TrueType font does not contain a 'cmap' table
>       at 
> org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmap(TrueTypeFont.java:477)
>       at 
> org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmap(TrueTypeFont.java:460)
>       at org.apache.fontbox.ttf.TTFSubsetter.<init>(TTFSubsetter.java:89)
>       at 
> org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.subset(TrueTypeEmbedder.java:302)
>       at 
> org.apache.pdfbox.pdmodel.font.PDType0Font.subset(PDType0Font.java:162)
>       at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1138)
>       at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1118)
>       at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1106)
> see also PDFBOX-3162



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to