Jump to content
We've recently updated our Privacy Statement, available here ×

TTF Fonts in Linux and Tomcat


markrgli

Recommended Posts

Hello everyone,

 

We are using JasperReports (3.1.4) on a Tomcat server (6.0.20) running on a Linux machine (Debian Lenny - Linux jp1 2.6.26-2-686 #1 SMP Sun Jun 21 04:57:38 UTC 2009 i686 GNU/Linux) and we're having problems generating reports that use TTF fonts (mostly Arial variants like Arial Narrow in bold). Text using this font are truncated, i.e. "Work Schedule Information" becomes "Work Schedule Informa." Our font files are inside the lib directory of Tomcat and they are referenced in our JRXML templates as in the example below.

 

This problem only happens when the reports are generated from the Linux machine. We have the same Tomcat configuration (including the location of fonts) running on Windows XP and report generation works fine.

 

Right now we are clueless as to what's happening so I hope you guys can shed some light on this one.
Thank you very much.

 

Regards,
Mark

 

 

Code:


Post Edited by markrgli at 09/30/2009 07:44
Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

Having the TTF files in the classpath is not enough.

They have to actually be available in the system or be registered with the JVM. You can do this by wrapping up these TTF files in a font extension JAR. By doing this, the JR will register them with the JVM and thus the JVM will no longer use some replacement font, that would cause the font metrics mismatch that you experience.

 

Also, if you use font extensions, you no longer need to deal with the pdfXXX attributes in your JRXML, as these settings are specified in the font extension config tile. Take a look at the /demo/fonts folder in the JR project to see what a font extension is made of. You can ZIP up such folder in a JAR and add it to your application classpath.

 

I hope this helps.
Teodor

 

Link to comment
Share on other sites

  • 1 year later...

Hello all

I created a report with iReport3.0.0 and I used some ttf fonts; when I run de report in IReport I have no problems but when I run it from and aplication running in tomcat 6 don't show me the fonts that I used in the report.

Please Help me! Thanks

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...