Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
redhat linux rhel5 and windows xp
Description
It seems when writing a PDF that has an invalid embedded font to an image there is a crash in the native function sun.font.FileFont.getGlyphImage(JI). It can be reproduced using the PDFToImage program on a pdf with an invalid embedded font.
Turing on -Dsun.java2d.debugfonts=true on a bad pdf will show some like the follow for the bad font
INFO: open TTF: C:\DOCUME~1\mdavis\LOCALS~1\Temp+~JF4968602841241472406.tmp
Jul 20, 2010 11:37:31 AM sun.font.TrueTypeGlyphMapper handleBadCMAP
SEVERE: Null Cmap for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp+~JF4968602841241472406.tmpsubstituting for this font
Jul 20, 2010 11:37:31 AM sun.font.FontManager deRegisterBadFont
SEVERE: Deregister bad font: ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp+~JF4968602841241472406.tmp
Jul 20, 2010 11:37:31 AM sun.font.FileFontStrike <init>
INFO: Strike for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp+~JF4968602841241472406.tmp at size = 19 use natives = false useJavaRasteriser = true AAHint = 2 Has Embedded bitmaps = false
The following code in PDSimpleFont.java seems to fix the crash although I am not sure if it is correct:
public void drawString(String string, Graphics g, float fontSize, AffineTransform at, float x, float y) throws IOException {
Font _awtFont = getawtFont();
//mdavis - fix fontmanager.so/dll on sun.font.FileFont.getGlyphImage for font with bad cmaps?
if (_awtFont.canDisplayUpTo(string) != -1)
Graphics2D g2d = (Graphics2D) g;
Attachments
Attachments
Issue Links
- relates to
-
PDFBOX-774 convertToImage causes JVM crash on certain PDFs
- Closed