It appears to be finding the correct font, wherever that 
(org.apache.pdfbox.pdmodel.font.FontManager) gets it from.
If I can get it to compile I could just hack around this problem and remove the 
code creating the log messages.

Sep 13, 2011 11:20:54 AM org.apache.pdfbox.pdmodel.font.PDCIDFontType2Font 
getawtFont
INFO: Can't read the embedded font EAAAAD+LucidaSans-Typewriter
Sep 13, 2011 11:20:54 AM org.apache.pdfbox.pdmodel.font.PDCIDFontType2Font 
getawtFont
INFO: Using font Lucida Sans Typewriter Regular instead
Sep 13, 2011 11:20:54 AM org.apache.pdfbox.pdmodel.font.PDCIDFontType2Font 
getawtFont
INFO: Can't read the embedded font EAAAAE+LucidaSans-TypewriterBold
Sep 13, 2011 11:20:54 AM org.apache.pdfbox.pdmodel.font.PDCIDFontType2Font 
getawtFont
INFO: Using font Lucida Sans Typewriter Bold instead

The problem is the log messages are caused by pdfbox finding a font object on 
the text object and trying to use that to create a java.awt.Font but it's not a 
font.
To reduce the size of the PDF, that font object only contains the glyphs used 
in the text object rather than the entire font file.
I don't know if there's an easy way to replace that statement with one that 
reads it in as what it is, a set of glyphs.
                awtFont = Font.createFont( Font.TRUETYPE_FONT, 
ff2Stream.createInputStream() );
Wherever this gets it's values, it is working.
                awtFont = FontManager.getAwtFont(fd.getFontName());

Now to figure out what the next warning is doing.
Sep 13, 2011 11:20:54 AM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on < > from <Lucida Sans Typewriter Bold> to the default 
font


-----Original Message-----
From: Andreas Lehmkuehler [mailto:[email protected]] 
Sent: Tuesday, September 13, 2011 2:16 AM
To: [email protected]
Subject: Re: How to make embedded font readable?

Hi,

Am 12.09.2011 21:54, schrieb Eric Douglas:
> I'll look into that JIRA, thanks.
> The pdfbox error in the original message below shows the class and method 
> producing this message in the Java log.
>
> Digging a little deeper, this is caused by the pdfbox method:
> org.apache.pdfbox.pdmodel.font.PDFontDescriptorDictionary.getFontFile2
> ()
>
> This is trying to read the "FontFile2" key which was written by FOP.
> org.apache.fop.pdf.PDFFontDescriptor.setFontFile()
>
> One of these is missing something.
Ah, this confirmed my suspicion. That issue seemd to be related to PDFBOX-490.

> -----Original Message-----
> From: Andreas Lehmkuehler [mailto:[email protected]]
> Sent: Monday, September 12, 2011 3:30 PM
> To: [email protected]
> Cc: [email protected]
> Subject: Re: How to make embedded font readable?
>
> Hi,
>
> Am 12.09.2011 15:31, schrieb Eric Douglas:
>> FOP created the PDF.  Pdfbox is trying to read it.
>> I'm not sure which end is missing what.
>> I'm embedding fonts and pdfbox says there's something there it can't 
>> read.
> I guess it is an issue with PDFBox, but without a sample PDF it's only a 
> guess.
> Please create an issue on JIRA [1] and attach a sample pdf to it.
>
>> Sep 12, 2011 9:18:12 AM
>> org.apache.pdfbox.pdmodel.font.PDCIDFontType2Font getawtFont
>> INFO: Can't read the embedded font EAAAAD+LucidaSans-Typewriter
>
>
> BR
> Andreas Lehmkühler
>
> [1] https://issues.apache.org/jira/browse/PDFBOX

BR,
Andreas Lehmkühler

[1] https://issues.apche.org/jira/browse/PDFBOX-490

Reply via email to