pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1768738 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3CharProc.java
Date Tue, 08 Nov 2016 16:57:45 GMT
Author: tilman
Date: Tue Nov  8 16:57:45 2016
New Revision: 1768738

URL: http://svn.apache.org/viewvc?rev=1768738&view=rev
Log:
PDFBOX-2852: remove unneeded segment, as suggested by Lorenz Pahl; improve javadoc

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3CharProc.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3CharProc.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3CharProc.java?rev=1768738&r1=1768737&r2=1768738&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3CharProc.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3CharProc.java
Tue Nov  8 16:57:45 2016
@@ -140,10 +140,11 @@ public final class PDType3CharProc imple
     }
 
     /**
-     * todo.
-     * 
-     * @return
-     * @throws IOException
+     * Get the width from a type3 charproc stream.
+     *
+     * @return the glyph width.
+     * @throws IOException if the stream could not be read, or did not have d0 or d1 as first
+     * operator, or if their first argument was not a number.
      */
     public float getWidth() throws IOException
     {
@@ -173,19 +174,12 @@ public final class PDType3CharProc imple
     {
         if (operator.getName().equals("d0") || operator.getName().equals("d1"))
         {
-            Object obj = arguments.get(0);
-            if (obj instanceof Number)
-            {
-                return ((Number) obj).floatValue();
-            }
-            else if (obj instanceof COSNumber)
+            COSBase obj = arguments.get(0);
+            if (obj instanceof COSNumber)
             {
                 return ((COSNumber) obj).floatValue();
             }
-            else
-            {
-                throw new IOException("Unexpected argument type: " + obj.getClass().getName());
-            }
+            throw new IOException("Unexpected argument type: " + obj.getClass().getName());
         }
         else
         {



Mime
View raw message