Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] iText rtf font

Lidong Liu

2006-09-21

Replies:

Hi iText developer,

Thank you very much for your excellent work on iText, which gives me a lot of help!

Here is a work around to use fonts with names in Asian encodings in RTF documents. Wish it can be merged in to main source:

#######################
# DIFF START
#######################
Index: D:/Devt/itext/src/com/lowagie/text/rtf/style/RtfFont.java
===================================================================
--- D:/Devt/itext/src/com/lowagie/text/rtf/style/RtfFont.java    (revision 2)
+++ D:/Devt/itext/src/com/lowagie/text/rtf/style/RtfFont.java    (revision 4)
@@ -248,6 +248,11 @@
         this.fontName = fontName;
     }
    
+    public RtfFont(String fontName, float size, int style, Color color, int charset) {
+        this(fontName, size, style, color);
+        this.charset = charset;
+    }
+   
     /**
      * Special constructor for the default font
      *
@@ -270,6 +275,7 @@
         if(font != null) {
             if(font instanceof RtfFont) {
                 this.fontName = ((RtfFont) font).getFontName();
+                this.charset = ((RtfFont) font).getCharset();
             } else {
                 setToDefaultFamily( font.getFamilyname());
             }
@@ -574,6 +580,14 @@
         super.setStyle(style);
         fontStyle = style();
     }
+   
+    public int getCharset() {
+        return charset;
+    }
+   
+    public void setCharset(int charset) {
+        this.charset = charset;
+    }
 
     /**
      * Gets the font number of this RtfFont
#######################
# DIFF END
#######################

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
©2008 junlu.com - Jax Systems, LLC, U.S.A.