]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Added FONode arg to constructor and to makeEms method.
authorPeter Bernard West <pbwest@apache.org>
Tue, 12 Nov 2002 02:29:19 +0000 (02:29 +0000)
committerPeter Bernard West <pbwest@apache.org>
Tue, 12 Nov 2002 02:29:19 +0000 (02:29 +0000)
Expand EMs on creation in makeEms method.  If node argument is null,
assume an initial value environment, and use font-size initial value
for expansion.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@195505 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/datatypes/Ems.java

index 7539e6330ba3724226f253fea6dfdd8c1b94cbdc..238c0de5cfe5a1d05ce9ec54607b99ccbb6322c2 100644 (file)
@@ -3,6 +3,7 @@ package org.apache.fop.datatypes;
 
 import org.apache.fop.fo.expr.PropertyException;
 import org.apache.fop.fo.PropNames;
+import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.PropertyConsts;
 
 /*
@@ -33,29 +34,43 @@ public class Ems {
     /**
      * Construct a <tt>Numeric</tt> with a given unit and quantity.
      * The unit power is assumed as 1.  The base unit is millipoints.
+     * @param node - the <tt>FONode</tt> with reference to which this
+     * <i>EM</i> value is being consructed.  A null value imples the
+     * construction of an <i>initial value</i>.
      * @param property the index of the property with which this value
      * is associated.
      * @param value the number of units.
      * @return a <tt>Numeric</tt> representing this <i>Ems</i>.
      */
-    public static Numeric makeEms(int property, double value)
+    public static Numeric makeEms(FONode node, int property, double value)
         throws PropertyException
     {
-        return new Numeric(property, value, Numeric.EMS, 0, 0);
+        Numeric numeric = new Numeric(property, value, Numeric.EMS, 0, 0);
+        if (node == null)
+            numeric.expandEms((Numeric)
+            (PropertyConsts.pconsts.getInitialValue(PropNames.FONT_SIZE)));
+        else
+            numeric.expandEms(node.currentFontSize());
+        return numeric;
     }
 
     /**
      * Construct a <tt>Numeric</tt> with a given unit and quantity.
      * The unit power is assumed as 1.  The base unit is millipoints.
+     * @param node - the <tt>FONode</tt> with reference to which this
+     * <i>EM</i> value is being consructed.  A null value imples the
+     * construction of an <i>initial value</i>.
+     * @param property the index of the property with which this value
      * @param propertyName the name of the property with which this value
      * is associated.
      * @param value the number of units.
      * @return a <tt>Numeric</tt> representing this <i>Ems</i>.
      */
-    public static Numeric makeEms (String propertyName, double value)
+    public static Numeric makeEms
+                            (FONode node, String propertyName, double value)
         throws PropertyException
     {
-        return makeEms(PropNames.getPropertyIndex(propertyName), value);
+        return makeEms(node, PropNames.getPropertyIndex(propertyName), value);
     }
 
 }