Font extensions does not work for JasperReports
I am trying to add Tahoma font to jasper report in my web app. I use font extension mechanism.
This exception was thrown: net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'TahomaFont' is not available to the JVM. See the Javadoc for more details.
Here is my font.xml file:
<fontFamiles>
<fontFamily name="TahomaFont">
<normal>export/fonts/BTahoma.ttf</normal>
<pdfEncoding>Identity-H</pdfEncoding>
<pdfEmbedded>true</pdfEmbedded>
</fontFamily>
<fontFamiles>
and here is my jasperreports.properties file :
net.sf.jasperreports.extension.registry.factory.simple.font.families=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
net.sf.jasperreports.extension.simple.font.families.TahomaFont=export/fonts/fonts.xml
Also i have put Tahoma.ttf font file in my classpath. Here is the style tag in jasper report:
<style fontName="TahomaFont" name="tahoma"/>
Please let me know where i am going wrong. Thanks in advance.
Putting the Tahoma.ttf font in your class path is not the way to go.
You are right to use font extensions, it's a good practice - but you need to package your fonts as font extension, into a jar and add that jar to your classpath.
More information documented here.
maybe you have to copy your jar file to your java_home/fonts directory. and if you are usinng maven project you have to package your jar file within a maven project with pom properties to add dependency to pom.xml
链接地址: http://www.djcxy.com/p/24686.html上一篇: 未能在设备的模拟器上安装apk