From: William Victor Mote Date: Tue, 9 Sep 2003 14:31:08 +0000 (+0000) Subject: add support for font-size and font-weight, as per patch from Peter Herweg (mailto... X-Git-Tag: Root_Temp_KnuthStylePageBreaking~1111 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7c2cd19efe004eb69bd6f67bf1583edf87621bf3;p=xmlgraphics-fop.git add support for font-size and font-weight, as per patch from Peter Herweg (mailto:pherweg@web.de) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196893 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/rtf/renderer/RTFHandler.java b/src/java/org/apache/fop/rtf/renderer/RTFHandler.java index 723bdddfb..f602dc90f 100644 --- a/src/java/org/apache/fop/rtf/renderer/RTFHandler.java +++ b/src/java/org/apache/fop/rtf/renderer/RTFHandler.java @@ -186,6 +186,9 @@ public class RTFHandler extends FOInputHandler { RtfAttributes rtfAttr = new RtfAttributes(); attrBlockTextAlign(bl, rtfAttr); attrBlockBackgroundColor(bl, rtfAttr); + attrBlockFontSize(bl, rtfAttr); + attrBlockFontWeight(bl, rtfAttr); + para = sect.newParagraph(rtfAttr); } catch (IOException ioe) { // FIXME could we throw Exception in all FOInputHandler events? @@ -400,6 +403,21 @@ public class RTFHandler extends FOInputHandler { } } + private void attrBlockFontSize(Block bl, RtfAttributes rtfAttr){ + int fopValue = bl.properties.get("font-size").getLength().getValue()/500; + rtfAttr.set("fs",fopValue); + } + + private void attrBlockFontWeight(Block bl, RtfAttributes rtfAttr){ + String fopValue = bl.properties.get("font-weight").getString(); + if(fopValue=="bold" || fopValue=="700"){ + rtfAttr.set("b",1); + } + else{ + rtfAttr.set("b",0); + } + } + private void attrBlockTextAlign(Block bl, RtfAttributes rtfAttr) { int fopValue = bl.properties.get("text-align").getEnum(); String rtfValue = null;