From 9ace957bd04b125499ce2d8223998a28d86191b0 Mon Sep 17 00:00:00 2001 From: Simon Pepping Date: Mon, 9 Oct 2006 13:07:13 +0000 Subject: [PATCH] Create a dummy PercentBaseContext in FOPRtfAttributes, so that percentage font size properties are properly evaluated. Patch by Renaud Michel . Unfortunately, no regression test, because I have no RTF test framework. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@454369 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/render/rtf/FOPRtfAttributes.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/fop/render/rtf/FOPRtfAttributes.java b/src/java/org/apache/fop/render/rtf/FOPRtfAttributes.java index 9c8fe1cf5..56644d173 100755 --- a/src/java/org/apache/fop/render/rtf/FOPRtfAttributes.java +++ b/src/java/org/apache/fop/render/rtf/FOPRtfAttributes.java @@ -21,6 +21,8 @@ package org.apache.fop.render.rtf; import java.awt.Color; import org.apache.fop.datatypes.Length; +import org.apache.fop.datatypes.PercentBaseContext; +import org.apache.fop.fo.FObj; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfColorTable; @@ -59,7 +61,8 @@ public class FOPRtfAttributes extends RtfAttributes { * @return this (which now contains the new entry) */ public RtfAttributes setHalfPoints(String name, Length value) { - set(name, value.getValue() / (1000 / 2)); //Convert millipoints to half-points + //Convert millipoints to half-points + set(name, value.getValue(DummyPercentBaseContext.singleton) / (1000 / 2)); return this; } @@ -78,4 +81,18 @@ public class FOPRtfAttributes extends RtfAttributes { redComponent, greenComponent, blueComponent).intValue()); return this; } + + private static class DummyPercentBaseContext implements PercentBaseContext { + + static DummyPercentBaseContext singleton = new DummyPercentBaseContext(); + + private DummyPercentBaseContext() { + // noop + } + + public int getBaseLength(int lengthBase, FObj fobj) { + return 0; + } + } + } -- 2.39.5