pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danielwil...@apache.org
Subject svn commit: r908338 - /pdfbox/trunk/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java
Date Wed, 10 Feb 2010 03:27:44 GMT
Author: danielwilson
Date: Wed Feb 10 03:27:44 2010
New Revision: 908338

URL: http://svn.apache.org/viewvc?rev=908338&view=rev
Log:
re: PDFBOX-614 , log exception rather than crash.

Modified:
    pdfbox/trunk/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java

Modified: pdfbox/trunk/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java?rev=908338&r1=908337&r2=908338&view=diff
==============================================================================
--- pdfbox/trunk/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java (original)
+++ pdfbox/trunk/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java Wed Feb 10 03:27:44
2010
@@ -316,10 +316,16 @@
         //This will typically be 1000 but in the case of a type3 font
         //this might be a different number
         final float glyphSpaceToTextSpaceFactor = 1f/font.getFontMatrix().getValue( 0, 0
);
+        float spaceWidthText=0;
+        
+        try{ // to avoid crash as described in PDFBOX-614
+            // lets see what the space displacement should be
+            spaceWidthText = (font.getFontWidth( SPACE_BYTES, 0, 1 )/glyphSpaceToTextSpaceFactor);
+        }catch (Throwable exception)
+        {
+            log.warn( exception, exception);
+        }
         
-
-        // lets see what the space displacement should be
-        float spaceWidthText = (font.getFontWidth( SPACE_BYTES, 0, 1 )/glyphSpaceToTextSpaceFactor);
         if( spaceWidthText == 0 )
         {
             spaceWidthText = (font.getAverageFontWidth()/glyphSpaceToTextSpaceFactor);



Mime
View raw message