Locale and Fonts - Unix

Locale

The reports and documents in the release package make use of the system's locale to get the appropriate date and currency formats and to select the appropriate resource bundle. Many unix systems use the standard en_US.UTF-8 locale. To change the locale on a ubuntu system you can use:

sudo apt-get install language-pack-en-base
sudo nano /etc/default/locale   to set the required locale

then log out and in again (and restart Tomcat if necessary using sudo service tomcat7 restart).

The locale being used is shown on the Help screen.

Fonts

NOTE: the following discussion applies ONLY to reports and documents that use jrxml content. For Forms and Letters that use Open Office odt (and Microsoft Word .doc) based content, you can happily use any font installed on the system. However, if you are creating odt/doc content on a Windows system but your OpenVPMS server is running on a unix system, then the fonts you use may get remapped. For example 'Bradley Hand ITC' will be mapped to 'URW Chancery L'. If you need specific fonts installed on your unbuntu server, see here.

***UPDATE for 1.9.1***

In the 1.9.1 release all standard reports have been converted to use the DejaVu fonts. Because these are built into JasperSoft Reports, all will work with no problems. If you build or use custom reports you should ensure that these use the DejaVu fonts rather than the default San Serif. (Look at the Style|Base section with JaspersoftStudio in any standard report to see how this is done.)

***End 1.9.1 - keep reading for 1.9 and prior ***

The reports and documents in the release package have all been developed in a Windows system. The fonts are almost without exception set to Sans Serif.  In a Windows system this maps to the Arial font.

However on unix systems it normally maps to the DejaVu fonts. Although these look like Arial, they have slightly bigger font width metrics, and as a result sometimes the text does not fit in the allowed space.

That is, you get effects like the following where the words 'From Date' and 'Method' have been truncated - and also 'Report' is missing from the title.

instead of:

The fix is to replace the DejaVu fonts with the Liberation fonts. These are a set of Sans Serif, Serif and Monospaced fonts designed to have the same font metrics as the Microsoft Arial, Time Roman and Courier New fonts.

Since JasperReports uses the Java fonts we need to do two things:

  1. install the Liberation fonts
  2. change Java's fontconfig to map the Sans Serif, Serif and Monospaced fonts to the Liberation ones rather than the DejaVu ones

On a Ubuntu systems you can install the Liberation fonts using:
  sudo apt-get install fonts-liberation

To change the font mapping, you need to edit the appropriate fontconfig file. In the <JAVA_HOME>/jre/lib directory you will find the following fontconfig files:

fontconfig.RedHat.5.bfc
fontconfig.RedHat.5.properties.src
fontconfig.RedHat.6.bfc
fontconfig.RedHat.6.properties.src
fontconfig.SuSE.10.bfc
fontconfig.SuSE.10.properties.src
fontconfig.SuSE.11.bfc
fontconfig.SuSE.11.properties.src
fontconfig.Turbo.bfc
fontconfig.Turbo.properties.src
fontconfig.Ubuntu.properties
fontconfig.bfc
fontconfig.properties.src

For a Ubuntu system, the one to edit is fontconfig.Ubuntu.properties.

To make things easier, the modified file is attached to this post named fontconfig.Ubuntu.properties.txt

After you modify the file, you will need to restart Tomcat to have it take effect.

Syndicate content