True Type Fonts

Users might find that well designed reports in JReport Designer become truncated when running in JReport Server on a different platform. The reason being that various platforms use different font systems, and by mapping the fonts to a different platform by JDK, the report result is shown with a discrepancy. To solve this problem, Java provides a True Type Font (TTF) administrative system, which allows the fonts to be published together with a report into the runtime environment independent of the platform fonts.

In addition, in cases where end users do not have the fonts used in a report, JReport provides a PDF embedded fonts solution. That is, the fonts are embedded in the PDF file, and end users do not need to install the fonts to their local machines.

Notes:

The following topics describe how to use TTF in your reports.

Designing reports with TTF

To design reports with TTF, follow the steps below:

  1. Copy True Type Font files *.ttf to the <install_root>\font subdirectory. You can find the TTF fonts in your system's Font directory or from the Internet.
  2. Running JReport Designer. In the design area, click on the drop-down arrow of the font list on the toolbar, and scroll down to the bottom part of the list. You will then find the fonts with an * before their name. These are the TTF fonts you have published.
  3. Preview the report result and save the report until you are satisfied with the report design.

Publishing TTF to the production environment

If you want to publish report files that use True Type Fonts to other operating systems, you will need to place the relevant font files (other files in the font path) in the <install_root>\font directory of the operating system of where you want to publish the report. Make sure that you copy or ftp (in binary mode) the .ttf files to the directory.

Delivering the result in Excel/RTF/HTML/TXT

For files of HTML/RTF/Excel formats, they will find the fonts from the system font directory. If you want to deliver the report result in the above formats to end users, you should choose the TTF fonts that are commonly used on Windows systems for your reports. If you have to use fonts that do not exist in a client system, you can choose the embedded TTF font solution for a good print result in PDF format.

Delivering the result in PDF

To view PDF reports with other character sets, for example, Chinese fonts, you will need to install special language packages. Also, if you design reports with fonts that are not within Acrobat's internal fonts, they will be mapped differently. The above two cases will cause trouble to end users when viewing or printing a report with Acrobat Reader. However, differing from HTML and RTF, PDF allows the embedding of the font description within a file. JReport therefore provides the embedded TTF font solution for a PDF result. You will find it extremely helpful in the following cases:

To take advantage of the PDF embedded TTF font feature, follow the steps below:

  1. Select the TTF to design reports as specified previously.
  2. Open the report, go to the Report Inspector, and in the node representing the report, find a property called Embedded Fonts. The drop-down list will show all the TTF fonts used by the report. You can select multiple fonts by holding down the Ctrl or Shift key.
  3. Save the report and export it to a PDF file. The selected fonts will be embedded in the exported PDF file.

By embedding TTF fonts, the file size will increase a little. However, it is still of reasonable size to be transferred over a network.

Applying Bold and Italic properties to TTF

JReport supports the Bold and Italic properties when you design report with TTF. When you select a TTF font and set the Bold/Italic property to true, JReport will first automatically search the <install_root>\font directory to check all the TTF files related with the TTF font you have selected previously. If there is such a TTF file holding the Bold/Italic property, JReport will use the font style defined in this file to match your setting and make the Bold/Italic function take effect; if not, JReport will find the specified font in your platform fonts and apply the Bold/Italic function directly.

Moreover, when you select an embedded font while using TTF to design reports, and set the Bold/Italic property to true, if JReport find the related TTF file to match your setting, the matched font with the Bold/Italic property will be embedded when you want to export the report result to a PDF file.