]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
add support for font-size and font-weight, as per patch from Peter Herweg (mailto...
authorWilliam Victor Mote <vmote@apache.org>
Tue, 9 Sep 2003 14:31:08 +0000 (14:31 +0000)
committerWilliam Victor Mote <vmote@apache.org>
Tue, 9 Sep 2003 14:31:08 +0000 (14:31 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196893 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/rtf/renderer/RTFHandler.java

index 723bdddfb2929b05a870234281d886837942b90d..f602dc90f1d54b04124ac447a19752bdf509d490 100644 (file)
@@ -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;