pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1608989 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/state/PDExtendedGraphicsState.java
Date Wed, 09 Jul 2014 02:23:00 GMT
Author: jahewson
Date: Wed Jul  9 02:22:59 2014
New Revision: 1608989

URL: http://svn.apache.org/r1608989
Log:
PDFBOX-2193: Handle invalid Font in ExtGState

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/state/PDExtendedGraphicsState.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/state/PDExtendedGraphicsState.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/state/PDExtendedGraphicsState.java?rev=1608989&r1=1608988&r2=1608989&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/state/PDExtendedGraphicsState.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/state/PDExtendedGraphicsState.java
Wed Jul  9 02:22:59 2014
@@ -119,8 +119,11 @@ public class PDExtendedGraphicsState imp
             else if( key.equals( COSName.FONT ) )
             {
                 PDFontSetting setting = getFontSetting();
-                gs.getTextState().setFont( setting.getFont() );
-                gs.getTextState().setFontSize( setting.getFontSize() );
+                if (setting != null)
+                {
+                    gs.getTextState().setFont( setting.getFont() );
+                    gs.getTextState().setFontSize( setting.getFontSize() );
+                }
             }
             else if( key.equals( COSName.FL ) )
             {
@@ -382,10 +385,14 @@ public class PDExtendedGraphicsState imp
     public PDFontSetting getFontSetting()
     {
         PDFontSetting setting = null;
-        COSArray font = (COSArray)graphicsState.getDictionaryObject( COSName.FONT );
-        if( font != null )
+        COSBase base = graphicsState.getDictionaryObject( COSName.FONT );
+        if (base instanceof COSArray)
         {
-            setting = new PDFontSetting( font );
+            COSArray font = (COSArray)base;
+            if( font != null )
+            {
+                setting = new PDFontSetting( font );
+            }
         }
         return setting;
     }



Mime
View raw message