pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1781417 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font: PDSimpleFont.java PDTrueTypeFont.java PDType1Font.java PDType3Font.java
Date Thu, 02 Feb 2017 16:20:26 GMT
Author: tilman
Date: Thu Feb  2 16:20:26 2017
New Revision: 1781417

URL: http://svn.apache.org/viewvc?rev=1781417&view=rev
Log:
PDFBOX-2852: flip equals

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDSimpleFont.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java
    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/PDSimpleFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDSimpleFont.java?rev=1781417&r1=1781416&r2=1781417&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDSimpleFont.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDSimpleFont.java Thu
Feb  2 16:20:26 2017
@@ -234,7 +234,7 @@ public abstract class PDSimpleFont exten
                 // each name in Differences array must also be in the latin character set
                 for (String name : ((DictionaryEncoding)encoding).getDifferences().values())
                 {
-                    if (name.equals(".notdef"))
+                    if (".notdef".equals(name))
                     {
                         // skip
                     }
@@ -349,7 +349,7 @@ public abstract class PDSimpleFont exten
             String nameInAFM = getEncoding().getName(code);
 
             // the Adobe AFMs don't include .notdef, but Acrobat uses 250, test with PDFBOX-2334
-            if (nameInAFM.equals(".notdef"))
+            if (".notdef".equals(nameInAFM))
             {
                 return 250f;
             }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java?rev=1781417&r1=1781416&r2=1781417&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java Thu
Feb  2 16:20:26 2017
@@ -549,6 +549,7 @@ public class PDTrueTypeFont extends PDSi
      *
      * @param code character code
      * @return GID (glyph index)
+     * @throws java.io.IOException
      */
     public int codeToGID(int code) throws IOException
     {
@@ -558,7 +559,7 @@ public class PDTrueTypeFont extends PDSi
         if (!isSymbolic()) // non-symbolic
         {
             String name = encoding.getName(code);
-            if (name.equals(".notdef"))
+            if (".notdef".equals(name))
             {
                 return 0;
             }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java?rev=1781417&r1=1781416&r2=1781417&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java Thu
Feb  2 16:20:26 2017
@@ -411,7 +411,7 @@ public class PDType1Font extends PDSimpl
                         String.format("U+%04X ('%s') is not available in this font %s encoding:
%s",
                                 unicode, name, getName(), encoding.getEncodingName()));
             }
-            if (name.equals(".notdef"))
+            if (".notdef".equals(name))
             {
                 throw new IllegalArgumentException(
                         String.format("No glyph for U+%04X in font %s", unicode, getName()));
@@ -428,7 +428,7 @@ public class PDType1Font extends PDSimpl
 
             String nameInFont = getNameInFont(name);
 
-            if (nameInFont.equals(".notdef") || !genericFont.hasGlyph(nameInFont))
+            if (".notdef".equals(nameInFont) || !genericFont.hasGlyph(nameInFont))
             {
                 throw new IllegalArgumentException(
                         String.format("No glyph for U+%04X in font %s (generic: %s)", unicode,
getName(), genericFont.getName()));

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=1781417&r1=1781416&r2=1781417&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 Thu
Feb  2 16:20:26 2017
@@ -329,7 +329,7 @@ public class PDType3Font extends PDSimpl
     public PDType3CharProc getCharProc(int code)
     {
         String name = getEncoding().getName(code);
-        if (!name.equals(".notdef"))
+        if (!".notdef".equals(name))
         {
             COSStream stream;
             stream = (COSStream)getCharProcs().getDictionaryObject(COSName.getPDFName(name));



Mime
View raw message