Hi, everyone
How can I use Chinese true type font in an exported rtf files? Here is
my code:

FontFactory.register("C:\\Windows\\fonts\\SIMHEI.TTF");//SIMHEI.TTF is a
Chinese common font
Font font1=new Font();
font1.setFamily("simhei");//simhei is the name of the font SIMHEI.TTF; I
use the FontFactory.getRegisteredFonts() get this name
font1.setSize(10.5f);

RtfWriter2 writer=RtfWriter2.getInstance(document, new
FileOutputStream("C:\\template.rtf"));
document.open();
Table table=new Table(6);

Cell cell1=new Cell();
Chunk chunk1=new Chunk("编号");
chunk1.setFont(font1);
cell1.addElement(chunk1);

table.addCell(cell1);
document.add(table);
document.close();

When I open the exported file, I find that chunk1's font is simsun which
is a Chinese default font

Thanks for your attention.

Xuyun Fu



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to