EXCEPTION_ACCESS_VIOLATION in fontmanager.so/fontmanager.dll
------------------------------------------------------------

                 Key: PDFBOX-780
                 URL: https://issues.apache.org/jira/browse/PDFBOX-780
             Project: PDFBox
          Issue Type: Bug
         Environment: redhat linux rhel5 and windows xp
            Reporter: Matt Davis


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) {
                        log.warn("Changing fonts on <" + string + "> from <" + 
_awtFont.getName() + "> to default font");
                        _awtFont = null;
                }
                

                Graphics2D g2d = (Graphics2D) g;



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to