You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2016/12/18 16:41:26 UTC

svn commit: r1774904 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3Font.java

Author: tilman
Date: Sun Dec 18 16:41:26 2016
New Revision: 1774904

URL: http://svn.apache.org/viewvc?rev=1774904&view=rev
Log:
PDFBOX-2852: Sonar fixes

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3Font.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3Font.java?rev=1774904&r1=1774903&r2=1774904&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3Font.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3Font.java Sun Dec 18 16:41:26 2016
@@ -116,7 +116,7 @@ public class PDType3Font extends PDSimpl
     {
         int firstChar = dict.getInt(COSName.FIRST_CHAR, -1);
         int lastChar = dict.getInt(COSName.LAST_CHAR, -1);
-        if (getWidths().size() > 0 && code >= firstChar && code <= lastChar)
+        if (!getWidths().isEmpty() && code >= firstChar && code <= lastChar)
         {
             Float w = getWidths().get(code - firstChar);
             return w == null ? 0 : w;
@@ -161,11 +161,11 @@ public class PDType3Font extends PDSimpl
             // the following values are all more or less accurate at least all are average
             // values. Maybe we'll find another way to get those value for every single glyph
             // in the future if needed
-            PDRectangle fontBBox = desc.getFontBoundingBox();
+            PDRectangle bbox = desc.getFontBoundingBox();
             float retval = 0;
-            if (fontBBox != null)
+            if (bbox != null)
             {
-                retval = fontBBox.getHeight() / 2;
+                retval = bbox.getHeight() / 2;
             }
             if (retval == 0)
             {
@@ -234,10 +234,10 @@ public class PDType3Font extends PDSimpl
     {
         if (resources == null)
         {
-            COSDictionary resources = (COSDictionary) dict.getDictionaryObject(COSName.RESOURCES);
-            if (resources != null)
+            COSDictionary resourcesDict = (COSDictionary) dict.getDictionaryObject(COSName.RESOURCES);
+            if (resourcesDict != null)
             {
-                this.resources = new PDResources(resources);
+                this.resources = new PDResources(resourcesDict);
             }
         }
         return resources;