jasperreports-5.6.1.jar包中新增字体
一:在使用iReport506生成yhjzddy.jrxml文件后,当字体与所需打印出来的PDF字体不一样时,需在jasperreports-fonts.jar包中新增字体,新增方法如下:
1.使用压缩工具直接打开jar包(不要解压缩)。
2.在jar包中的net\sf\jasperreports\fonts包下,修改jasperreports-fonts.xml文件(新增新字体配置):
<?xml version="1.0" encoding="UTF-8"?> <fontFamilies> <fontFamily name="Pictonic" visible="false"> <normal> <ttf>net/sf/jasperreports/fonts/pictonic/pictonic.ttf</ttf> <svg>net/sf/jasperreports/fonts/pictonic/pictonic.svg</svg> <eot>net/sf/jasperreports/fonts/pictonic/pictonic.eot</eot> <woff>net/sf/jasperreports/fonts/pictonic/pictonic.woff</woff> </normal> <pdfEncoding>Identity-H</pdfEncoding> <pdfEmbedded>true</pdfEmbedded> <!-- 生成的pdf字体与报表字体一致 --> </fontFamily> <fontFamily name="Microsoft YaHei UI"> <normal>net/sf/jasperreports/fonts/msyh/msyh.ttf</normal> <pdfEncoding>Identity-H</pdfEncoding> <pdfEmbedded>true</pdfEmbedded> </fontFamily> </fontFamilies>
3.在jasperreports-fonts.xml的同级目录下创建字体新增字体目录,将字体放在该文件目录下。