The added code does not deal with Asian encodings directory. But with these change we can support Asian encoded font by specifying the encoding directly while using the itext api, otherwise we just can't set the charset except the several western charsets decided by iText code automatically. In the mean while, iText has a bug when creating a new RtfFont from RtfFont, which does not copy the charset. This could make the specified RtfFont useless.
Here is a RtfFont creation example:
RtfFont font11 = new RtfFont(
new String("宋体".getBytes("gb18030"), "iso-8859-1"),
11, RtfFont.NORMAL , Color.BLACK, 134);
which creates a RtfFont of Chinese font SimSun, setting the charset to 134.
Regards,
Liu
2006/9/24, Mark Hall <
[EMAIL PROTECTED]>:
On Thursday 21 September 2006 15:50, Lidong Liu wrote:
> 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:
I have looked at your code contribution, but unfortunately cannot comprehend
how it is supposed to work.
I see you setting the charset explicitly and for the default font, but where
is it used? Where are you using the charset to deal with Asian encodings
differently than normal?
Greetings,
Mark
>
> #######################
> # 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
> #######################
--
People are beginning to notice you. Try dressing before you leave the house.
My GPG public key is available at:
http://www.edu.uni-klu.ac.at/~mhall/data/security/MarkHall.asc
------------------------------------------------------------------------- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
