pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1855689 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java
Date Sun, 17 Mar 2019 10:52:15 GMT
Author: tilman
Date: Sun Mar 17 10:52:15 2019
New Revision: 1855689

URL: http://svn.apache.org/viewvc?rev=1855689&view=rev
Log:
PDFBOX-4480: SonarQube fix

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java?rev=1855689&r1=1855688&r2=1855689&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java
Sun Mar 17 10:52:15 2019
@@ -174,7 +174,8 @@ class LegacyPDFStreamEngine extends PDFS
         if (fontDescriptor != null)
         {
             float capHeight = fontDescriptor.getCapHeight();
-            if (capHeight != 0 && (capHeight < glyphHeight || glyphHeight == 0))
+            if (Float.compare(capHeight, 0) != 0 &&
+                (capHeight < glyphHeight || Float.compare(glyphHeight, 0) == 0))
             {
                 glyphHeight = capHeight;
             }
@@ -182,7 +183,8 @@ class LegacyPDFStreamEngine extends PDFS
             // sometimes even CapHeight has very high value, but Ascent and Descent are ok
             float ascent = fontDescriptor.getAscent();
             float descent = fontDescriptor.getDescent();
-            if (ascent > 0 && descent < 0 && ((ascent - descent) /
2 < glyphHeight || glyphHeight == 0))
+            if (ascent > 0 && descent < 0 &&
+                ((ascent - descent) / 2 < glyphHeight || Float.compare(glyphHeight, 0)
== 0))
             {
                 glyphHeight = (ascent - descent) / 2;
             }



Mime
View raw message