pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msahy...@apache.org
Subject svn commit: r1696326 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form: AppearanceGeneratorHelper.java PDDefaultAppearanceString.java
Date Mon, 17 Aug 2015 18:44:47 GMT
Author: msahyoun
Date: Mon Aug 17 18:44:47 2015
New Revision: 1696326

URL: http://svn.apache.org/r1696326
Log:
PDFBOX-2852: properly declare constants

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDDefaultAppearanceString.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java?rev=1696326&r1=1696325&r2=1696326&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
Mon Aug 17 18:44:47 2015
@@ -47,7 +47,7 @@ class AppearanceGeneratorHelper
 {
     private static final Operator BMC = Operator.getOperator("BMC");
     private static final Operator EMC = Operator.getOperator("EMC");
-    
+ 
     private final PDVariableText field;
     private final PDDefaultAppearanceString defaultAppearance;
     private String value;
@@ -71,6 +71,10 @@ class AppearanceGeneratorHelper
      */
     private static final float DEFAULT_FONT_SIZE = 12;    
     
+    /**
+     * The default padding applied by Acrobat to the fields bbox.
+     */
+    private static final float DEFAULT_PADDING = 0.5f;
     
     /**
      * Constructs a COSAppearance from the given field.
@@ -179,7 +183,7 @@ class AppearanceGeneratorHelper
             {
                 contents.setLineWidth(lineWidth);
                 PDRectangle bbox = resolveBoundingBox(widget, appearanceStream);
-                PDRectangle clipRect = applyPadding(bbox, Math.max(0.5f, lineWidth/2)); 
+                PDRectangle clipRect = applyPadding(bbox, Math.max(DEFAULT_PADDING, lineWidth/2));

                 contents.addRect(clipRect.getLowerLeftX(),clipRect.getLowerLeftY(),clipRect.getWidth(),
clipRect.getHeight());
                 contents.closeAndStroke();
             }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDDefaultAppearanceString.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDDefaultAppearanceString.java?rev=1696326&r1=1696325&r2=1696326&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDDefaultAppearanceString.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDDefaultAppearanceString.java
Mon Aug 17 18:44:47 2015
@@ -40,6 +40,11 @@ import org.apache.pdfbox.pdmodel.interac
  */
 class PDDefaultAppearanceString
 {
+    /**
+     * The default font size used by Acrobat.
+     */
+    private static final float DEFAULT_FONT_SIZE = 12;
+    
     private final List<Object> tokens;
     private final PDResources defaultResources;
     
@@ -84,9 +89,8 @@ class PDDefaultAppearanceString
                 return ((COSNumber) tokens.get(fontIndex - 1)).floatValue();
             }
         }
-
-        // default font size is 12 in Acrobat
-        return 12;
+        
+        return DEFAULT_FONT_SIZE;
     }
     
     /**



Mime
View raw message