Jump to content
Changes to the Jaspersoft community edition download ×

Jasper stops finding one font


pupeno

Recommended Posts

 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)

The directory where the program is running:

# ls *.ttfarial.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?

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi,

 

You probably upgraded from an old version of JR which did not have support for what we now call JasperReports exceptions.

By default, recent versions of JR raise an exception when a font used in a report is not found.

This was made on purpose, so that users of the library be aware that fonts are a very important resource when you create your reports and that you should pay attention and ship your fonts together with your reports, just like you ship the images or any other resources.

Having said that, simply putting the TTF files in the classpath is not enough. You need to map them and thus make them available to JR as font extensions, ensuring that they will be found and used prooperly on all platforms and in all export formats (including PDF).

Note that nowadays iReport comes with a wizard for font extensions, which would help you package up your TTFs in font extension JAR files.

Take a look at the sample font extension that we have placed inside the /demo/fonts folder of the JR project source package. It is used to configure the open source DejaVu Sans fonts as a JR font extension. You can download this JAR from here, if you want to see how it works:

http://sourceforge.net/projects/jasperreports/files/jasperreports/JasperReports%203.7.5/jasperreports-fonts-3.7.5.jar/download

You would need to do something similar for all the TTF files you use. Basically, if you use the Symbol font, then you better make a font extension with it, because you see that this font does not actually exist on Linux.

 

If you don't want to do any of the above and simply want JR to work like it used to, then set the following property in a jasperreports.properties file that you place in the classpath root package:

http://jasperreports.sourceforge.net/config.reference.html#net.sf.jasperreports.awt.ignore.missing.font

 

I hope this helps.
Teodor

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...