pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1710508 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font: PDFont.java PDFontDescriptor.java
Date Mon, 26 Oct 2015 04:38:19 GMT
Author: tilman
Date: Mon Oct 26 04:38:19 2015
New Revision: 1710508

URL: http://svn.apache.org/viewvc?rev=1710508&view=rev
Log:
PDFBOX-3061: fd /MissingWidth entry could be 0, in that case, accept it

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontDescriptor.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java?rev=1710508&r1=1710507&r2=1710508&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java Mon Oct 26
04:38:19 2015
@@ -231,14 +231,10 @@ public abstract class PDFont implements
             }
 
             PDFontDescriptor fd = getFontDescriptor();
-            if (fd != null)
+            if (fd != null && fd.hasMissingWidth())
             {
                 // get entry from /MissingWidth entry
-                float missingWidth = fd.getMissingWidth();
-                if (missingWidth != 0)
-                {
-                    return missingWidth;
-                }
+                return fd.getMissingWidth();
             }
         }
 

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontDescriptor.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontDescriptor.java?rev=1710508&r1=1710507&r2=1710508&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontDescriptor.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontDescriptor.java
Mon Oct 26 04:38:19 2015
@@ -681,6 +681,14 @@ public final class PDFontDescriptor impl
     }
 
     /**
+     * Returns true if the missing widths entry is present in the font descriptor.
+     */
+    public boolean hasMissingWidth()
+    {
+        return dic.containsKey(COSName.MISSING_WIDTH);
+    }
+
+    /**
      * This will get the missing width for the font from the /MissingWidth dictionary entry.
      *
      * @return The missing width value, or 0 if there is no such dictionary entry.



Mime
View raw message