In jasper report (.jrxml file) you can use several fonts for displaying labels/texts. These fonts may not be always available on different platforms/OS. (e.g. There are some MS fonts which are unavailable on linux machines unless you install them manually). So, we bundle the fonts used in jasper report into a jar and make them work irrespective of underlying platform. Additionally, you can include your own (custom created) fonts in fonts extension jar and ship them along with jasper reports. More information is here.
Also there are couple of ways to configure and use this jar. Have a look at this to know one of the easiest way.
Note that if the font used in jrxml is not available in the JVM, it will throw an error while exporting the report as follows:
net.sf.jasperreports.engine.util.JRFontNotFoundException:
Font 'Arial' is not available to the JVM.
This can be solved in 2 ways:
1. Use jasperreport-extension.jar OR
2. Set the property net.sf.jasperreports.awt.ignore.missing.font
to true
to ignore missing font.
e.g. In jrxml, you can set it as follows:
<property name="net.sf.jasperreports.awt.ignore.missing.font" value="true"/>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…