Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jasper stops finding one font

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?

like image 804
pupeno Avatar asked Oct 21 '10 13:10

pupeno


People also ask

How do I add a font to Jasper report?

Installing a new fontClick on Tools -> Options. Click on Fonts tab and Install Font. Click on Browse to select your font path and click Next. If needed, check the option Embed this font in the PDF document.

What is not available to JVM font?

JRFontNotFoundException: Font "Arial" is not available to the JVM. It occurs because not all the Linux installations include Microsoft core fonts which are used in ReadyAPI reports. So, to fix the issue, you need to download the mscorefonts package.

How do I change font size in Jasper report?

Use the <style/> element instead. fontName The font name, which can be the name of a physical font, a logical one or the name of a font family from the registered JasperReports font extensions. size The size of the font measured in points. It defaults to 10.


1 Answers

Try adding the line

net.sf.jasperreports.awt.ignore.missing.font=true

to your jasperreports.properties file.

like image 58
Matjaž Tercelj Avatar answered Nov 05 '22 21:11

Matjaž Tercelj