aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Herweg <pherweg@apache.org>2005-08-30 21:00:41 +0000
committerPeter Herweg <pherweg@apache.org>2005-08-30 21:00:41 +0000
commitf80c74dd16aeb6fdf15615beecf2803e64efbe13 (patch)
treef0d8533a4382286d2326cc2281308163acb6b5ef
parent302218f9cba73f4a5e52dd37b026bf6dddddbf40 (diff)
downloadxmlgraphics-fop-f80c74dd16aeb6fdf15615beecf2803e64efbe13.tar.gz
xmlgraphics-fop-f80c74dd16aeb6fdf15615beecf2803e64efbe13.zip
added support for superscript and subscript
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@264856 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/render/rtf/TextAttributesConverter.java15
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java4
2 files changed, 17 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
index 319059d4a..f0b8120ac 100644
--- a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
+++ b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
@@ -28,7 +28,6 @@ import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FOText;
import org.apache.fop.fo.flow.Block;
import org.apache.fop.fo.flow.BlockContainer;
-import org.apache.fop.fo.flow.Character;
import org.apache.fop.fo.flow.Inline;
import org.apache.fop.fo.flow.PageNumber;
import org.apache.fop.fo.properties.ColorTypeProperty;
@@ -36,6 +35,7 @@ import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonFont;
import org.apache.fop.fo.properties.CommonTextDecoration;
import org.apache.fop.fo.properties.CommonMarginBlock;
+import org.apache.fop.fo.properties.EnumLength;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfColorTable;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFontManager;
@@ -97,6 +97,7 @@ class TextAttributesConverter {
attrFont(fobj.getCommonFont(), attrib);
attrFontColor(fobj.getColor(), attrib);
attrTextDecoration(fobj.getTextDecoration(), attrib);
+ attrBaseLineShift(fobj.getBaseLineShift(), attrib);
return attrib;
}
@@ -252,6 +253,17 @@ class TextAttributesConverter {
rtfAttr.set(RtfText.ATTR_BACKGROUND_COLOR, rtfColor);
}
+
+ private static void attrBaseLineShift(EnumLength baselineShift, RtfAttributes rtfAttr) {
+
+ String s = baselineShift.getString();
+
+ if (s=="SUPER") {
+ rtfAttr.set(RtfText.ATTR_SUPERSCRIPT);
+ } else if (s=="SUB") {
+ rtfAttr.set(RtfText.ATTR_SUBSCRIPT);
+ }
+ }
/**
* Converts a FOP ColorType to the integer pointing into the RTF color table
@@ -265,5 +277,4 @@ class TextAttributesConverter {
return RtfColorTable.getInstance().getColorNumber(redComponent,
greenComponent, blueComponent).intValue();
}
-
}
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java
index ae17d849f..9ef08f1e4 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java
@@ -70,6 +70,10 @@ public class RtfText extends RtfElement {
public static final String ATTR_FONT_COLOR = "cf";
/** constant for background color */
public static final String ATTR_BACKGROUND_COLOR = "chcbpat"; // Added by Boris on 06/25//02
+ /** constant for superscript */
+ public static final String ATTR_SUPERSCRIPT = "super";
+ /** constant for subscript */
+ public static final String ATTR_SUBSCRIPT = "sub";
/** RtfText attributes: alignment attributes */
/** constant for align center */