I have a custom font (Rockwell) that I want to use in a PDF and ship with my application.
So I created a jasperreport_extension.properties and a fonts.xml file, which points to my rockwell ttf files.
Creating a pdf with my new font works fine as long as in my fonts.xml file, the path to the rockwell ttf fonts is absolute. E.g. "/home/misja/myProject/src/main/resources/rockwell-regular.ttf".
But having absolute file paths is a no-go when shipping my application, so I want to have classpath-relative paths in my fonts.xml. So just "rockwell-regular.ttf".
However when I do this, generating the pdf gives the following error:
Caused by: org.springframework.beans.PropertyBatchUpdateException: Failed properties: Property 'normal' threw exception; nested exception is net.sf.jasperreports.engine.JRRuntimeException: java.awt.FontFormatException: bad table, tag=90701824; Property 'bold' threw exception; nested exception is net.sf.jasperreports.engine.JRRuntimeException: java.awt.FontFormatException: bad table, tag=-1078132736
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102) ~[spring-beans-3.1.4.RELEASE.jar:3.1.4.RELEASE]
I have debugged JasperReports as far as I could, and I can see that the rockwell-regular.ttf file is found and read when it is read from the classpath. But then eventually an Exception is thrown when the Font is about to be created in FontManager.createFont2D
I attached my jasperreports_extension and my fonts file.