From af652eedd409e376e54cea88b4545ddb21b30e0c Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Fri, 1 Feb 2008 23:30:13 +0000 Subject: 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 --- .../fop/fo/properties/FontSizePropertyMaker.java | 19 ++++++++++++++++--- status.xml | 4 ++++ 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 @@ + + Fixed a bug when using relative font-size (smaller/larger) in combination + with percentages. + Bugfix for handling of optional tables in subset TrueType fonts. This bug caused errors in various PDF viewers. -- cgit v1.2.3