aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaren Lease <klease@apache.org>2001-10-14 20:38:25 +0000
committerKaren Lease <klease@apache.org>2001-10-14 20:38:25 +0000
commit29a6656aaf8b96c1adb8e83279c197aa445d9921 (patch)
tree2d848516f4de9c25eca550c29c48e222d433aa27
parentf0d925c5aae1482e715dd3874b2c5fe76df017f5 (diff)
downloadxmlgraphics-fop-29a6656aaf8b96c1adb8e83279c197aa445d9921.tar.gz
xmlgraphics-fop-29a6656aaf8b96c1adb8e83279c197aa445d9921.zip
Modify Length property parsing
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194507 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/org/apache/fop/fo/expr/Numeric.java23
-rw-r--r--src/org/apache/fop/fo/expr/PropertyParser.java4
2 files changed, 16 insertions, 11 deletions
diff --git a/src/org/apache/fop/fo/expr/Numeric.java b/src/org/apache/fop/fo/expr/Numeric.java
index 845327bff..68a8d15a7 100644
--- a/src/org/apache/fop/fo/expr/Numeric.java
+++ b/src/org/apache/fop/fo/expr/Numeric.java
@@ -7,9 +7,11 @@
package org.apache.fop.fo.expr;
+import java.util.Vector;
import org.apache.fop.fo.Property;
import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.FixedLength;
import org.apache.fop.datatypes.PercentLength;
import org.apache.fop.datatypes.LinearCombinationLength;
import org.apache.fop.datatypes.MixedLength;
@@ -91,7 +93,7 @@ public class Numeric {
* Construct a Numeric object from a Length.
* @param l The Length.
*/
- public Numeric(Length l) {
+ public Numeric(FixedLength l) {
this(ABS_LENGTH, (double)l.mvalue(), 0.0, 0.0, 1, null);
}
@@ -121,19 +123,22 @@ public class Numeric {
*/
public Length asLength() {
if (dim == 1) {
- if (valType == ABS_LENGTH) {
- return new Length((int)absValue);
+ Vector len = new Vector(3);
+ if ((valType & ABS_LENGTH) != 0) {
+ len.add(new FixedLength((int)absValue));
}
- PercentLength pclen = null;
if ((valType & PC_LENGTH) != 0) {
- pclen = new PercentLength(pcValue, pcBase);
- if (valType == PC_LENGTH)
- return pclen;
+ len.add(new PercentLength(pcValue, pcBase));
}
if ((valType & TCOL_LENGTH) != 0) {
- return new TableColLength((int)absValue, pclen, tcolValue);
+ len.add(new TableColLength(tcolValue));
}
- return new MixedLength((int)absValue, pclen);
+ if (len.size() == 1) {
+ return (Length)len.elementAt(0);
+ }
+ else {
+ return new MixedLength(len);
+ }
} else {
// or throw exception???
// can't make Length if dimension != 1
diff --git a/src/org/apache/fop/fo/expr/PropertyParser.java b/src/org/apache/fop/fo/expr/PropertyParser.java
index 2d5a89c61..f41cfc43a 100644
--- a/src/org/apache/fop/fo/expr/PropertyParser.java
+++ b/src/org/apache/fop/fo/expr/PropertyParser.java
@@ -270,10 +270,10 @@ public class PropertyParser extends PropertyTokenizer {
numLen));
Length length = null;
if (unitPart.equals(RELUNIT)) {
- length = new Length(numPart.doubleValue(),
+ length = new FixedLength(numPart.doubleValue(),
propInfo.currentFontSize());
} else
- length = new Length(numPart.doubleValue(), unitPart);
+ length = new FixedLength(numPart.doubleValue(), unitPart);
if (length == null) {
throw new PropertyException("unrecognized unit name: "
+ currentTokenValue);