After upgrading Jasper to the last version, it stopped finding one font: Symbol. The rest of the fonts seem to be fine. I have a bunch of ttfs in the same directory as where jasper is run, the program is just a small wrapper to generate PDFs, and it's throwing this error:
net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'Symbol' is not available to the JVM. See the Javadoc for more details.
at net.sf.jasperreports.engine.util.JRFontUtil.checkAwtFont(JRFontUtil.java:358)
at net.sf.jasperreports.engine.util.JRStyledText.getAwtAttributedString(JRStyledText.java:226)
at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:362)
at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:1129)
at net.sf.jasperreports.engine.fill.JRFillStaticText.prepare(JRFillStaticText.java:183)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:329)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:419)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:378)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2028)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:757)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:269)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:127)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:942)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:860)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)
at XmlJasperInterface.report(XmlJasperInterface.java:82)
at XmlJasperInterface.main(XmlJasperInterface.java:60)</pre>
The directory where the program is running:
# ls *.ttf
arial.ttf arialbd.ttf lsans.ttf lsansd.ttf lsansi.ttf symbol.ttf
All other fonts are found. Oh, in my laptop (macosx), it works fine, it only breaks on the server (Debian). I opened symbol.ttf and it opened fine on Mac OS X (just in case the file was corrupt).
Any ideas what may be going on?
The easy steps to solve this problem would be
The problem is solved.
On ubuntu I needed to uninstall the fonts and reinstall them:
Then, it works ok.
Update for year 2015:
Add this to (or uncomment in) /etc/apt/sources.list
Then run this:
I'm using JasperReports 6.3.1. I solved the problem by adding the following line in my
.jrxml
:This way our report will look something different, depending on the fonts that are preinstalled in the system. In my case it does not represent a problem, and I'm not interested in adding an extra font in my project, since I need to be as light as possible.
In case you want to use the original fonts of the report in all runtime environments, an easy solution is to add the necessary dependencies to the project.
An example, for Maven:
You can also download the libraries and add them manually to the project, however it will work.
I hope you find them useful.
Well the font must be installed in the OS where the report run.
Try adding the line
net.sf.jasperreports.awt.ignore.missing.font=true
to your jasperreports.properties file.