View source | View content page | Page history | Printable version   
Main Page
Upload file
What links here
Recent changes

PDF Books
Show collection (0 pages)
Collections help


Projects:Unicode Fonts in iReports/Technical Specification



Currently in Jasper Reports 2.40 the font being used does not support Unicode characters. This document outlines how this will be replaced.

The current fonts in use in the Jasper Reports in Openbravo ERP include:


The scope of this specification does require further clarification to ensure that it meets the required outcomes. Some questions relating to this can be found in the discussion section at the bottom of the page.

In order to fulfill this specification it is important to clarify and understand the impact of terms like font, encoding, unicode, and how they work within the Jasper framework.


Global Test Fonts

Ubiquitous Language

Technical Implementation

The issue with displaying non western characters inside of Jasper reports and iReports is to do with encoding and ensuring that the font and encoding are compatible. Jasper Reports uses iText for creation of PDF documents, further information on this can be found in the link in the references section below.

While it is nice to ensure that the solution is complete and covers all possible languages this is not realistically going to be possible. The solution should be to find the simplest solution for configuring each installation.

In line with this the solution being proposed is to define the output font and encoding in a language specific format. This can be integrated into the language-country implementation within the application and as such bears a direct relationship with the translation process. This process proposes including font characteristics in the language object that would cover:

To ensure that this work is functioning there is a test jrxml file available that includes various languages that can be used to check the rendering of non western characters.


The language object for a translation will include font objects. This relationship is outline in the diagram below.


A specific font object will be set as the default and this will be used for the rendering of Jasper reports with Openbravo ERP, if there is no default value set then the application will use the default font for the entire application. The attributes within the font object can then be passed through to the relevant report object being created to set the encoding and font required for rendering that language.


Inside the iReports tool there is a setting that allows the user to set the encoding and font for PDF rendering. This should be set to a unicode compliant encoding setting (settings contained here are Java naming conventions) and the font should be capable of displaying non western characters.

PDF Font Handling

Within Jasper Reports there is a specific method to define the font and encoding to be used in a PDF document produced from the application. There is also a third attribute that can be defined which embeds the font in the pdf document thereby not requiring the view to have the font enabled within their system. This seems a far more reliable option when it comes to correctly rendering the correct text.

There is a clear benefit to embedding the font in the document as it will ensure the document renders properly irrespective of whether the viewer has the font installed or not, the overhead to embedding the font is not significant enough to outweigh the benefit.

Jasper Reports Font definition


Defines the font to use with the text element.



	Name of the font.

HTTPSecureAppServlet - renderJR method

The above settings will be implemented within the renderJR() method in the org.openbravo.base.secureapp.HttpSecureAppServlet class. This should be implemented in a separate private method that is called should the language include font attributes, if attributes are not available then the application will use the attributes defined in the jasper report.


Appendix A. UML Diagrams

Appendix B. Test Cases

The following code is a test jrxml file that can be used to display non western characters.

<?xml version="1.0" encoding="UTF-8"  ?>
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "">
		 name="Test Report"
	<property name="ireport.scriptlethandling" value="0" />
	<property name="ireport.encoding" value="UTF-8" />
	<import value="java.util.*" />
	<import value="net.sf.jasperreports.engine.*" />
	<import value="*" />

			<band height="0"  isSplitAllowed="true" >
			<band height="50"  isSplitAllowed="true" >
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="18" isBold="true" isUnderline="true"/>
				<text><![CDATA[Font Test Report]]></text>
			<band height="50"  isSplitAllowed="true" >
			<band height="30"  isSplitAllowed="true" >
			<band height="133"  isSplitAllowed="true" >
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
						<font pdfFontName="Times-Roman" pdfEncoding ="Identity-H"/>
				<text><![CDATA[Test Chinese characters - 甲 骨 文 章 草 新 隸 體 書
Test Arabic characters - ﺀ ﻻ للها لله ﻼ ﷲ گ ﭪﭖ
Test Hindi characters - अ आ इ ई उ ऊ ऋ ऌ ऍ ऎ ए ऐ
Test Russian characters - И з м е н и т ь з а д а ч и
Test Farsi characters - ماموریت نگهداری نرخ تبدیل ارز
Test Hungarian characters - Üzenet szöveg
Test Turkish characters - Açıklama
Test Spanish characters - Descripción
Test English characters - Description ]]></text>
			<band height="4"  isSplitAllowed="true" >
			<band height="50"  isSplitAllowed="true" >
			<band height="50"  isSplitAllowed="true" >
			<band height="50"  isSplitAllowed="true" >


  1. Jasper Reports quick reference - Font definition -
  2. Jasper Reports quick reference - ReportFont definition -
  3. FAQ -
  4. Jasper Forum post -
  5. Lowagie tutorial on iText and font usage -

Discussion Items

What is the scope of this project?

Is the objective to cover producing output documents from Openbravo ERP that are readable in all languages including non-western languages? Should this be out-of-the-box implementation or a configuration task? Does it only cover how to implement non western characters in the iReport tool?

Retrieved from ""

This page has been accessed 32,543 times. This page was last modified on 8 June 2012, at 05:31. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.