I was using custom font in a customer report embedded in the web application. The font (available in the operating system) was displayed correctly in HTML, RTF and Excel export. However, in the generated PDF text elements were displayed using Arial font.
The solution is to wrap required fonts as JasperReports Font Extensions. Font TTF files can be included in the same project generating Jasper reports or, a more elegant solution, in a separate JAR file.
I found an interesting blog post Fonts in JasperServer about providing custom fonts. The author is configuring the font extensions using Spring. However, you can do it in a simpler way.
First, install fonts in iReport and let create it the required configuration. In iReport, go to Tools -> Options, click on iReport group and go to Fonts tab. Here are some screenshots from the installation wizard:
iReport creates font extensions configuration and copies the recently installed font into the iReport installation directory/ireport/fonts directory (C:\Program Files (x86)\iReport-3.7.2\ireport\fonts in my case). You should find the following files there:
jasperreports_extension.properties – it configures net.sf.jasperreports.extensions.ExtensionsRegistryFactory as net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory and points to the font family configuration:
After that, the fonts contained it JAR will be available to JasperReports when generating a PDF report.
Just before publishing my post, Matt Dahlmann, author of the published an update of his previous article mentioned in this post. Check Jaspersoft v3 Font Extensions for the more actual version.