在IReport中定义一个字体,名称如Chinese,其属性如下:pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H",所以中文的地方只需使用该字体即可。

解决方案 »

  1.   

    谢谢,请问 linux_china(Jacky)  一下
    1、ireport哪里可以设置字体?我才用,不熟悉,不知道可否帮助一下2、我指定了我的text的encoding为UniGB-UCS2-H,可是转换成pdf的时候提示,不支持。我查了一下itext的帮助,有如下说明
    --------------------------------------------------------------------------------
    Important:
    The cmap-files and properties for these CJK fonts are in a separate jar. YOU NEED THIS JAR IN YOUR CLASSPATH!!! You can download this jar here: http://itext.sourceforge.net/downloads/iTextAsian.jar.
    Remember that you can't embed these fonts in the PDF file using iText. Before trying to view a pdf with these Asian characters, you must download the Asian font pack from Adobe at: http://www.adobe.com/products/acrobat/acrrasianfontpack.html. or use a localized Windows. An alternative for this kind of fonts, is using a True Type Asian Font or Collection such as msgothic.ttc with the encoding BaseFont.IDENTITY_H or BaseFont.IDENTITY_V. You can use them exactly the same way as we did in the section about True Type Fonts and there will be no need to use the Asian font pack from Adobe because a subset of the font will be embedded in the document. 
    --------------------------------------------------------------------------------
    a,you must download the Asian font pack :要我下在adobe的pack,是不是一定要下载,并打上pack?
    b,An alternative for this kind of fonts, is using a True Type Asian Font ,我简单的设置了truetype字体为宋体,或其他字体,编码方式里我选择的cp1521,生成的pdf仍然是“???”3、有人发帖子说,对中文的修正需要改iText的java文件,但是我发现他改的时候,指定的BaseFont的字体文件是绝对路径,觉得不是很合适,而且,是否对pdf支持还不清楚,所以没有试。请各位高手给点意见吧,万分感谢了!!!!!!!!