You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ca...@apache.org on 2009/02/18 22:13:35 UTC

svn commit: r745653 - /incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontDescriptorDictionary.java

Author: carrier
Date: Wed Feb 18 21:13:33 2009
New Revision: 745653

URL: http://svn.apache.org/viewvc?rev=745653&view=rev
Log:
Initial fix for PDFBOX-429 to fix negative height values. Patch by Ken Glidden <ken at basistech dot com>

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

Modified: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontDescriptorDictionary.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontDescriptorDictionary.java?rev=745653&r1=745652&r2=745653&view=diff
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontDescriptorDictionary.java (original)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontDescriptorDictionary.java Wed Feb 18 21:13:33 2009
@@ -334,7 +334,11 @@
      */
     public float getCapHeight()
     {
-        return dic.getFloat( "CapHeight", 0 );
+        /* We observed a negative value being returned with
+         * the Scheherazade font. PDFBOX-429 was logged for this. 
+         * We are not sure if returning the absolute value
+         * is the correct fix, but it seems to work.  */
+        return java.lang.Math.abs(dic.getFloat( "CapHeight", 0 ));
     }
 
     /**
@@ -354,7 +358,11 @@
      */
     public float getXHeight()
     {
-        return dic.getFloat( "XHeight", 0 );
+        /* We observed a negative value being returned with
+         * the Scheherazade font. PDFBOX-429 was logged for this. 
+         * We are not sure if returning the absolute value
+         * is the correct fix, but it seems to work.  */
+        return java.lang.Math.abs(dic.getFloat( "XHeight", 0 ));
     }
 
     /**