aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas L. Delmelle <adelmelle@apache.org>2008-02-01 23:30:13 +0000
committerAndreas L. Delmelle <adelmelle@apache.org>2008-02-01 23:30:13 +0000
commitaf652eedd409e376e54cea88b4545ddb21b30e0c (patch)
tree43359e5eb1762ed9d5ddd7b6fae38ddebdb67600
parent1b95627f0d5a7c91aa9eca17f9edbef78c94be2a (diff)
downloadxmlgraphics-fop-af652eedd409e376e54cea88b4545ddb21b30e0c.tar.gz
xmlgraphics-fop-af652eedd409e376e54cea88b4545ddb21b30e0c.zip
Bugzilla 44343:
Fixed a bug when using relative (smaller/larger) font-sizes in combination with percentages. Percentages now resolved as per the spec (XSL-FO 1.1 7.9.4): "A percentage value specifies an absolute font size relative to the parent element's font-size." git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@617708 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java19
-rw-r--r--status.xml4
2 files changed, 20 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java b/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java
index 012a80b1a..c7124cc5f 100644
--- a/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java
+++ b/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java
@@ -43,6 +43,19 @@ public class FontSizePropertyMaker
super(propId);
}
+
+ /** {@inheritDoc} */
+ public Property make(PropertyList propertyList, String value, FObj fo) throws PropertyException {
+ Property p = super.make(propertyList, value, fo);
+ if (p instanceof PercentLength) {
+ Property pp = propertyList.getFromParent(this.propId);
+ p = FixedLength.getInstance(
+ pp.getLength().getValue() * ((PercentLength)p).getPercentage() / 100, "mpt");
+ }
+ return p;
+ }
+
+
/**
* {@inheritDoc}
* Implements the parts of 7.8.4 relevant to relative font sizes
@@ -52,12 +65,12 @@ public class FontSizePropertyMaker
FObj fo) throws PropertyException {
if (p.getEnum() == EN_LARGER || p.getEnum() == EN_SMALLER) {
// get the corresponding property from parent
- Property pp = propertyList.getFromParent(this.getPropId());
+ Property pp = propertyList.getFromParent(this.propId);
int baseFontSize = computeClosestAbsoluteFontSize(pp.getLength().getValue());
if (p.getEnum() == EN_LARGER) {
- return new FixedLength((int)Math.round((baseFontSize * FONT_SIZE_GROWTH_FACTOR)));
+ return FixedLength.getInstance((int)Math.round((baseFontSize * FONT_SIZE_GROWTH_FACTOR)), "mpt");
} else {
- return new FixedLength((int)Math.round((baseFontSize / FONT_SIZE_GROWTH_FACTOR)));
+ return FixedLength.getInstance((int)Math.round((baseFontSize / FONT_SIZE_GROWTH_FACTOR)), "mpt");
}
}
return super.convertProperty(p, propertyList, fo);
diff --git a/status.xml b/status.xml
index f8f8ace5a..e03893424 100644
--- a/status.xml
+++ b/status.xml
@@ -28,6 +28,10 @@
<changes>
<release version="FOP Trunk">
+ <action context="Code" dev="AD" type="fix" fixes-bug="44343">
+ Fixed a bug when using relative font-size (smaller/larger) in combination
+ with percentages.
+ </action>
<action context="Fonts" dev="JM" type="fix">
Bugfix for handling of optional tables in subset TrueType fonts. This bug caused errors
in various PDF viewers.