CGI Advantage
®
Assembled Document:
Formatting Objects Processor
User Guide
Release 3.10
CGI Advantage
Assembled Document: Formatting Objects Processor User Guide
3.10 Release CGI Technologies and Solutions Inc. Proprietary and Confidential Page 2
This document contains information proprietary to CGI Technologies and Solutions Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is prohibited.
CGI Advantage
®
is a registered trademark of CGI Technologies and Solutions Inc.
Due to the nature of this material, numerous hardware and software products are mentioned by
name. In most, if not all, cases, the companies that manufacture the products claim these
product names as trademarks. It is not our intention to claim these names or trademarks as our
own.
Copyright © 2001, 2013, CGI Technologies and Solutions Inc. All Rights Reserved.
Also includes software developed by the Apache Software Foundation (http://www.apache.org).
Copyright (C) 1999, The Apache Software Foundation. All rights reserved.
CGI Advantage
Assembled Document: Formatting Objects Processor User Guide
3.10 Release CGI Technologies and Solutions Inc. Proprietary and Confidential Page 3
About this Guide ............................................................................................................................ 4
FOP: Overview ............................................................................................................................... 5
Adding Fonts Process .................................................................................................................. 6
CGI Advantage
Assembled Document: Formatting Objects Processor User Guide
3.10 Release CGI Technologies and Solutions Inc. Proprietary and Confidential Page 4
About this Guide
This user guide provides a basic knowledge and understanding of the FOP Fonts software.
Examples are provided on how to add fonts users may want to use in the terms and conditions
section of procurement documents that support the Assembly feature.
CGI Advantage
Assembled Document: Formatting Objects Processor User Guide
3.10 Release CGI Technologies and Solutions Inc. Proprietary and Confidential Page 5
FOP: Overview
CGI Advantage uses the FOP software developed by Apache to convert existing TrueType Fonts
(TTF) and Type 1 Font. This user guide covers examples of converting the TrueType Fonts to
the independent XSL-FO format used later to create a merged assembled PDF, which will contain
the TrueType font converted by the user. The complete introduction and description of the FOP
software can be found at http://xmlgraphics.apache.org/fop/ .
CGI Advantage
Assembled Document: Formatting Objects Processor User Guide
3.10 Release CGI Technologies and Solutions Inc. Proprietary and Confidential Page 6
Adding Fonts Process
Adding a font to the CGI Advantage application may be necessary when an existing template for
the desired font does not exist in the application’s font library, which can be found in
\ADV34_35\Utils\fop-0.20.5\conf. The application comes packaged with the normal, bold, italic,
and italic-bold templates for Times New Roman, Courier New, and Arial and the normal and
bold for Tahoma. A font template (.TTF file) is required for each style and weight of the font that
the user wishes to display. In the templates provided, the Tahoma font only has a template for
normal and bold, so they can only use these types. Another example is if the user wants to
display italic Century Gothic text, they would need to follow the steps below to render this font into
their Assembled document.
Locate the TTF file for the desired font. The first major step for adding a font is to locate the
TTF file for the font you wish to add. This may vary from operating system to operating system,
or if it is a custom-built font, you may already know the location of this file. On the Windows XP
system, the font TTF files may be found in your /WINDOWS/Fonts directory (for Windows NT you
may find them in /WINNT/FONTS). Please note that there may be more than one file description
that says Century Gothic.
CGI Advantage
Assembled Document: Formatting Objects Processor User Guide
3.10 Release CGI Technologies and Solutions Inc. Proprietary and Confidential Page 7
Copy the desired TTF file. The next major step is to copy the located TTF file to the
application’s font library that is \ADV34_35\Utils\fop-0.20.5\conf\. Since we only wanted Century
Gothic italic, we will copy this file from the located font directory.
CGI Advantage
Assembled Document: Formatting Objects Processor User Guide
3.10 Release CGI Technologies and Solutions Inc. Proprietary and Confidential Page 8
Notice the name of the TTF file, GOTHICI.TTF, the particular prefixes for fonts are normal
none, bold bd, italic i, and bold-talic bi, for our GOTHIC font, that would be GOTHIC.TTF,
GOTHICBD.TTF, GOTHICI.TTF, GOTHICBI.TTF respectively.
Convert TTF to XML. In order to convert the TTF to XML, you must run the FOP application’s
correct interpreter on the TTF file. From a command line you will have to run the java interpreter
they have created, which can be done by creating a batch file with the following lines (which will
need to be modified to your environment where there’s bold).
----------------------------------BEGIN BATCH FILE BELOW THIS LINE-----------------------------------------
-
@echo off
Rem *******************FOP base directory **********
set FOP_BASE=<Advantage installation base directory>\ADV34_35\Utils\fop-0.20.5
set INPUT_FONT_FILE=%FOP_BASE%\conf\GOTHICI.TTF
set OUTPUT_FONT_FILE=%FOP_BASE%\conf\GOTHICI.xml
Rem *******************JDK**********
set JAVA_HOME=<WebSphere installation base directory>\WebSphere5113\AppServer\java\
rem ** jars libraries *********
set CLASSPATH=%CLASSPATH%;%FOP_BASE%\lib\avalon-framework-cvs-20020806.jar
set CLASSPATH=%CLASSPATH%;%FOP_BASE%\lib\batik.jar
set CLASSPATH=%CLASSPATH%;%FOP_BASE%\build\fop.jar
CGI Advantage
Assembled Document: Formatting Objects Processor User Guide
3.10 Release CGI Technologies and Solutions Inc. Proprietary and Confidential Page 9
%JAVA_HOME%\bin\java -classpath %CLASSPATH% org.apache.fop.fonts.apps.TTFReader -
enc ansi %INPUT_FONT_FILE% %OUTPUT_FONT_FILE%
echo Format Return Code is %errorlevel%
-----------------------------END BATCH FILE ABOVE THIS LINE-------------------------------------------------
-
Take the above batch parameters and paste them into a text editor and make the modifications to
the two installation directories to reflect your current environment. Also notice how the
INPUT_FONT_FILE is GOTHICI.TTF (which is the file we copied). Also notice the
OUTPUT_FONT_FILE is GOTHICI.xml, which will be the resulting output file. The
INPUT/OUTPUT_FONT_FILE will have to be changed for each subtype of font, as this process is
repeated.
CGI Advantage
Assembled Document: Formatting Objects Processor User Guide
3.10 Release CGI Technologies and Solutions Inc. Proprietary and Confidential Page 10
Save this text file as a .bat file.
From a command line, execute the batch file from the location you saved it to.
CGI Advantage
Assembled Document: Formatting Objects Processor User Guide
3.10 Release CGI Technologies and Solutions Inc. Proprietary and Confidential Page 11
Verify the presence of the new xml font file. The next step is to verify that the xml file is
present in the application’s font library.
CGI Advantage
Assembled Document: Formatting Objects Processor User Guide
3.10 Release CGI Technologies and Solutions Inc. Proprietary and Confidential Page 12
Modify the userconfig.xml. The final step to adding a font is to modify the userconfig.xml so
that the application knows where to find the templates for each given font type and sub-type. You
can find this file under \ADV34_35\Utils\fop-0.20.5\conf. To modify the userconfig.xml, open the
file using a text editor:
You will then need to scroll down to the <fonts> section of the file. The following template can be
used for adding a font within the <fonts> section after modifying the bolded sections. Be sure to
check for the font before inserting it. If it is an addition to an existing font, which doesn’t have that
particular style and weight, place the section in it’s properly commented area:
<fonts>
<!-- Font Name if first entry of this font name type -->
-------------------------BEGIN FONT TEMPLATE BELOW THIS LINE------------------------------------------
--
<font metrics-file="./conf/GOTHICI.xml" kerning="yes"
embed-file="./conf/GOTHICI.TTF">
<font-triplet name="Century Gothic" style="italic" weight="normal"/>
</font>
-----------------------END FONT TEMPLATE ABOVE THIS LINE------------------------------------------------
-
</fonts>
In this example, if the font name happens to be multiple words, you should add 2 sets of entries
one with a space and one without.
For example:
<!-- Century Gothic Fonts -->
CGI Advantage
Assembled Document: Formatting Objects Processor User Guide
3.10 Release CGI Technologies and Solutions Inc. Proprietary and Confidential Page 13
<font metrics-file="./conf/GOTHICI.xml" kerning="yes"
embed-file="./conf/GOTHICI.TTF">
<font-triplet name="Century Gothic" style="italic" weight="normal"/>
</font>
<!-- CenturyGothic Fonts (no space) -->
<font metrics-file="./conf/GOTHICI.xml" kerning="yes"
embed-file="./conf/GOTHICI.TTF">
<font-triplet name="CenturyGothic" style="italic" weight="normal"/>
</font>
As a final reminder, each font will have a style of two possibilities “normal” or “italic” and weight
will have two possibilities “normal” or “bold”.
Repeat as Needed. For each subtype to a font, normal, italic, bold, and bold-italic, this process
will have to be repeated. You will need to locate the TTF file, copy the TTF file, modify the bat file
created, run the bat file, and modify the userconfig.xml for each font type and sub-type.