Skip to content

Working with fonts

The IFS Report Designer layout design tool comes with a limited set of base fonts. To be able to use additional fonts in your layouts and have them show in runtime as well, a couple of tasks needs to be performed. This page describes how to include and use other fonts than the ones shipped in standard with IFS Report Designer.

How fonts work in IFS Report Designer and the IFS Report Formatter

IFS Report Designer layouts are based on XSL-FO (Formatting Objects). The Apache tool (FOP) used to render the XSL-FO document to a PDF document doesn't use the system available fonts, all fonts that are to be used needs to be included (in a way described in this document) in the runtime for IFS Report Designer as well as in the runtime for the Report Formatter.

There are a couple of things one needs to be aware of concerning fonts, PDF and FOP. The main thing is the font license regulation. Since you will be needing the same font on the client and the server (where the Report Formatter is running), it's important that have a license for the font on both the development client and on the server. One other important thing regarding the licensing is that many fonts come with a restriction for embedding. A font used in a report layout needs will be embedded in the PDF if the font you are using has license restrictions for embedding you need to make sure you comply with these restrictions.

Important!
Many fonts come with license restrictions regarding embedding. Any font used in IFS Report Designer will be embedded in PDF documents. It's important that you verify that this is in accordance with the particular fonts license agreement.

Preparations

Download the following set of command scripts and unzip in a folder of your choice, this folder will be referred to as your <work folder> in the instructions below. It contains a number of files/tools that will help you perform the tasks below.

Download here.

Include and use new fonts in design time (IFS Report Designer)

First of all you need to be able to use the new font when designing your layout. Therefore we first need to add it to the IFS Report Designer tool. Below you find step by step instructions on how to add in new fonts to report designer tool. The easiest way is to use Add Font from Tools menu as mentioned below. However if you are concerned with license restrictions and manual configuration you may follow the steps in order.

  1. Locate your installation of IFS Report Designer. Normally this would be something like C:\Program Files\IFS\IFSReportDesigner, but this could vary depending on how it was installed. If you are uncertain of the location, check the path in the shortcut used to start the tool. In this folder you will find the following folder structure.

The font folder, which is selected in the above image, contains a userconfig.xml file in which there is an entry for each font. This file needs to be edited in a later step. The ttf subfolder contains the actual ttf (or ttc) font files and the xml folder contain an xml file matching the ttf/ttc. You'll see how to create the XML file in a later step. 2. Copy the TrueType Font (ttf) or TrueType Collection (ttc) file you want to include in Report Designer to your <work folder>. 3. Copy the fop.jar file from the lib folder (shown in the structure above) to the <work folder>. 4. Open up a command prompt from the <work folder> and run the Create_XML_from_TTF.cmd file supplying the name of your ttf file (without the .ttf file extension). I'll be using the LucidaSansRegular.ttf throughout this guide, in my case the command would look as follows.

You'll see that this font has license restrictions for embedding. I used this font on purpose, to show what the output would look when the font has restrictions. This font should not be used in Report Designer since the license obviously has restrictions when it comes to embedding the font.
Apart from this fact you'll see that a LucidaSansRegular.xml file have been created.

If you want to use a font from a TrueType collection file (ttc), use the Create_XML_from_TTC.cmd command file. The file takes the ttc name (without extension as first variable and the name of the font to create XML for as the second parameter. Just supplying the ttc name will list the available fonts. If the font name you want to use contains white spaces or you want to use several fonts from the same collection you will have to modify the command script slightly or run the TTFReader tool separately (sample: java -cp.\fop.jar org.apache.fop.fonts.apps.TTFReader -ttcname "MS Gothic" msgothic.ttc msgothic.xml) 5. The XML file just created contains a lot of font metric information, which isn't very interesting to us at the moment, but it's needed by FOP to perform the XSL-FO to PDF rendering. What is interesting to us though is the font name, this can be found right at the top of the file.

In this case the name of the font is LucidaSans. We will need this name when modifying the userconfig.xml file in step 7. 6. Copy the newly generated XML file to the com\ini\common\font\xml folder and the TTF (or TTC) file to the com\ini\common\font\ttf folder. 7. Finally the userconfig.xml needs to be updated with the new font. In this file you'll find a list of fonts defined in the following manner

Since we're adding a new font we need to add one of these entries. The easiest way is to copy an existing one and modify it. Adding you fonts in at the end of the list of fonts is good practice in this case. To include the Lucidia Sans font we need to add the following.

Three things needs to be modified. The metrics file needs to point to the correct XML file, the embed file attribute needs to point to the correct TTF file and finally the name of the font needs to match the name found in the font metrics file, shown in step 5. 8. Now you are done. You are set to use the newly added font in your layouts. You still need to follow the steps below to include the font in the Report Formatter, though. To update several Development clients you can simply copy the entire font folder to other machines, it's important that every machine has licenses for the fonts though.

There is yet another approach to adding fonts to the design time tool. To follow this approach select the Add Font menu option from the Tools menu.

You will be presented with a list of fonts fetched from the Windows font directory. Simply select the font of your choice and click Ok. You are now ready to use the newly added font in your layout.

All steps performed manually in the previous approach will be done automatically for you. These steps include:

  • Copying the font file (TTF or TTC)¬† to the com\ini\common\font\ttf folder. The font file will be fetched from your Windows font directory.
  • Generating font metrics XML file and copying it to com\ini\common\font\xml folder.
  • Altering the userconfig.xml file to include font definition.

If the font you wish to add is not present in the Windows Font directory, make sure to add the font file TTF (or TTC) to the C:\Windows\Fonts folder before using the Add Font feature. Also, if the font being added is of type bold or italic, you are required to manually alter the userconfig.xml and set the appropriate style and weight. By default the style and weight properties are written as "normal".

Include and use new fonts in runtime (Database)

To be able to print/preview a report using a Report Designer layout that includes added fonts, the new font files must be imported to the database so that the newly added fonts could be used at runtime.

You can use the Report Fonts page to import fonts.

  • You can use Add Fonts button on font browser window, this will open a file open dialog where you can select the font you want to import from any folder.

Note: When importing fonts with different versions, make sure the file name are same with the previous version.

Request a printout or a preview of a report using a layout with the added font to make sure it works as expected.

Fonts used as substitute  fonts which are not part of the standard released fonts should also be imported in to the database as described above.