Packaging fonts

According to official JasperReport documentation, it is very recommended to package your fonts with your reports to prevent exceptions like:

net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'Arial' is not available to the JVM. See the Javadoc for more details.

Unless you specify a physical font file (i.e. a .ttf file), for a given font name (like “Arial”) the JVM will ask the underlying S.O. for such font, if not present: Exception. But you can package your fonts in a jar file and JasperReports will look form them.

We already packaged 7 well known fonts in the following jar file that you can add to your project as a maven dependency (remember to add our maven repository)

<dependency>
  <groupId>ar.com.fdvs</groupId>
  <artifactId>DynamicJasper-core-fonts</artifactId>
  <version>1.0</version>
</dependency>

Such fonts are:

  • Arial
  • Times New Roman
  • Courier New
  • Comic Sans MS
  • Georgia
  • Verdana
  • Monospaced