Menu

Fonts-Report

Philippe Le Berre

Fonts in Reports

Where to find free fonts ?

Reports relies on common fonts like Helvetica or Arial or Verdana, therefore depending of the environment one might need to find free fonts. The former Microsoft's Core Fonts package is quite handy, it can still be downloaded from multiple web site like this one or rely on the CoreFonts project.

Installing these fonts on the system will ensure that the Java AWT can find them if needed.

Building and installing the CoreFonts from Sourceforge.net

The rpm-build and cabextract package are needed.

$ yum install cabextract rpm-build

The ttmkfdir[http://freshmeat.net/projects/ttmkfdir/] is also needed, it is usually presents.

Then download the RPM specification :

$ wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec

Now you're ready to build the RPM :

$ rpmbuild -ba msttcorefonts-2.0-1.spec

If everything went fine one can now install the package :

$ rpm -ivh /usr/src/redhat/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm
$ /sbin/service xfs reload

Building and installing a JasperReport compliant CoreFonts package

JasperReports relies on fonts packaged into specific jar, there is quite a lot of posts in the JasperReports forums on this topic. To make our life simpler a sample is provided in the ESIS source code, see the main/reports/fonts directory.

The first file, which must be at the root of the jar file, is jasper reports_extension.properties. This file basically points to the where the fonts.xml file is.

The directory net/sourceforge/corefonts contains the fonts.xml as well as some truetype fonts. All the magic is in the fonts.xml.

The script create_msttcorefonts_jar.sh create the jar file and copy it into the branch jars directory. This directory is in the ClassPath of the JasperReport compiler, thus it will find the fonts.


Related

Wiki: Build
Wiki: Home

MongoDB Logo MongoDB