Author: adelmelle
Date: Sat Feb  2 14:18:30 2008
New Revision: 617909

URL: http://svn.apache.org/viewvc?rev=617909&view=rev
Log:
Slight correction for pixel-values: pass the ratio of pixels-per-point into 
FixedLength.getInstance()

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthProperty.java

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java?rev=617909&r1=617908&r2=617909&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java 
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java 
Sat Feb  2 14:18:30 2008
@@ -19,7 +19,6 @@
 
 package org.apache.fop.fo.expr;
 
-import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.datatypes.Numeric;
 import org.apache.fop.datatypes.PercentBase;
 import org.apache.fop.fo.properties.ColorProperty;
@@ -266,8 +265,8 @@
              * Get the length base value object from the Maker. If null, then
              * this property can't have % values. Treat it as a real number.
              */
-            double pcval = new Double(currentTokenValue.substring(0,
-                        currentTokenValue.length() - 1)).doubleValue() / 100.0;
+            double pcval = Double.parseDouble(
+                    currentTokenValue.substring(0, currentTokenValue.length() 
- 1)) / 100.0;
             PercentBase pcBase = this.propInfo.getPercentBase();
             if (pcBase != null) {
                 if (pcBase.getDimension() == 0) {
@@ -287,22 +286,30 @@
             // A number plus a valid unit name.
             int numLen = currentTokenValue.length() - currentUnitLength;
             String unitPart = currentTokenValue.substring(numLen);
-            Double numPart = new Double(currentTokenValue.substring(0,
-                    numLen));
-            if (unitPart.equals(RELUNIT)) {
+            double numPart = Double.parseDouble(currentTokenValue.substring(0, 
numLen));
+            if (RELUNIT.equals(unitPart)) {
                 prop = (Property) NumericOp.multiply(
-                                    
NumberProperty.getInstance(numPart.doubleValue()),
+                                    NumberProperty.getInstance(numPart),
                                     propInfo.currentFontSize());
             } else {
-                prop = FixedLength.getInstance(numPart.doubleValue(), 
unitPart);
+                if ("px".equals(unitPart)) {
+                    //pass the ratio between source-resolution and 
+                    //the default resolution of 72dpi
+                    prop = FixedLength.getInstance(
+                            numPart, unitPart, 
+                            propInfo.getPropertyList().getFObj()
+                                    .getUserAgent().getSourceResolution() / 
72.0f);
+                } else {
+                    //use default resolution of 72dpi
+                    prop = FixedLength.getInstance(numPart, unitPart);
+                }
             }
             break;
 
         case TOK_COLORSPEC:
-            FOUserAgent ua = (propInfo == null) 
-                ? null
-                : (propInfo.getFO() == null ? null : 
propInfo.getFO().getUserAgent());
-            prop = ColorProperty.getInstance(ua, currentTokenValue);
+            prop = ColorProperty.getInstance(
+                    propInfo.getPropertyList().getFObj().getUserAgent(), 
+                    currentTokenValue);
             break;
 
         case TOK_FUNCTION_LPAR:

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthProperty.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthProperty.java?rev=617909&r1=617908&r2=617909&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthProperty.java 
(original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthProperty.java 
Sat Feb  2 14:18:30 2008
@@ -45,9 +45,7 @@
             super(propId);
         }
 
-        /**
-         * [EMAIL PROTECTED]
-         */
+        /** [EMAIL PROTECTED] */
         public Property convertProperty(Property p,
                                         PropertyList propertyList,
                                         FObj fo) throws PropertyException {
@@ -59,7 +57,9 @@
             }
             if (p instanceof NumberProperty) {
                 //Assume pixels (like in HTML) when there's no unit
-                return 
FixedLength.getInstance(p.getNumeric().getNumericValue(), "px");
+                return FixedLength.getInstance(
+                        p.getNumeric().getNumericValue(), "px",
+                        
propertyList.getFObj().getUserAgent().getSourceResolution() / 72.0f);
             }
             Length val = p.getLength();
             if (val != null) {
@@ -87,30 +87,22 @@
         return 0.0;
     }
 
-    /**
-     * @return the numeric dimension. Length always a dimension of 1.
-     */
+    /** @return the numeric dimension. Length always a dimension of 1 */
     public int getDimension() {
         return 1;
     }
 
-    /**
-     * @return this.length cast as a Numeric
-     */
+    /** @return this.length cast as a Numeric */
     public Numeric getNumeric() {
         return this;
     }
 
-    /**
-     * @return this.length
-     */
+    /** @return this.length */
     public Length getLength() {
         return this;
     }
 
-    /**
-     * @return this.length cast as an Object
-     */
+    /** @return this.length cast as an Object */
     public Object getObject() {
         return this;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to