diff options
author | Andreas L. Delmelle <adelmelle@apache.org> | 2008-02-02 22:18:30 +0000 |
---|---|---|
committer | Andreas L. Delmelle <adelmelle@apache.org> | 2008-02-02 22:18:30 +0000 |
commit | 8e49549a9f59b5ee87a1c060fa9801916adf153d (patch) | |
tree | 122f195dc47b26192d1dd93aeac6a8d667ef7966 /src/java/org/apache/fop/fo/expr | |
parent | 9ed3838a87bc617a7119df4eee47ea6f6f27bc19 (diff) | |
download | xmlgraphics-fop-8e49549a9f59b5ee87a1c060fa9801916adf153d.tar.gz xmlgraphics-fop-8e49549a9f59b5ee87a1c060fa9801916adf153d.zip |
Slight correction for pixel-values: pass the ratio of pixels-per-point into FixedLength.getInstance()
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@617909 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo/expr')
-rw-r--r-- | src/java/org/apache/fop/fo/expr/PropertyParser.java | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/java/org/apache/fop/fo/expr/PropertyParser.java b/src/java/org/apache/fop/fo/expr/PropertyParser.java index 6dcbb0b0a..d8f45790e 100644 --- a/src/java/org/apache/fop/fo/expr/PropertyParser.java +++ b/src/java/org/apache/fop/fo/expr/PropertyParser.java @@ -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 @@ public final class PropertyParser extends PropertyTokenizer { * 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 @@ public final class PropertyParser extends PropertyTokenizer { // 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: |