DIGIFORMS
Digiforms Designer Documentation
 
 
 
 
 
 
Help by samples
 
 
 
Capture or output data in a defined layout
 
Extensible Markup Language
Embedding additional Fonts
Creating font metrics-files and altering FOP configuration
If you wish to use other fonts than the default PDF fonts, FOP allows embedding font files into the final PDF document. The following steps are necessary to embed and use custom fonts with FOP:
  • Generate font metrics
  • Register fonts with FOP
  • Specify the modified userconfig.xml when rendering document from designer
Generate font Metrics
The FOP TTF Reader
Create a batch-file (createmetrics.bat) in the Digiforms Designer installation folder and set content as follows:
java -cp fop-0.20.05\fop.jar org.apache.fop.fonts.apps.TTFReader -ttcname "%1" "c:\windows\fonts\%2" "metrics\%3.xml"
BATCH file
You must create the "metrics" folder to receive generated font-metrics files. Start a comand-shell and change directory to the installation-folder of Digiforms Designer. Start the font-metrics generator by typing the following: C:\Program files\Metafocus\Digiforms Designer 5.0> createmetrics Verdana verdana.ttf Verdana
Some versions of Microsoft Windows will not allow the TTF reader class to load fonts directly from "windows/fonts". Copy the desired .ttf files to a different location and alter the createmetrics.bat file accordingly.
Copying font-files to a different location
When using "createmetrics.bat" parameters are as follows:
  • The font name ( as shown in font-selector of designer )
  • The font true type file name
  • The target metrics file name ( excluding .xml )
Figure shows output when generating metrics-file for the Verdana font
Note that several .ttf files and metrics-files must be embedded / generated to enable using a desired font with different font-styles like italic or bold. As en example, true type files for Verdana includes: verdana.ttf verdanab.ttf verdanai.ttf verdanaz.ttf To enable both normal and italics, metrics must be generated for verdana.ttf and verdanai.ttf createmetrics Verdana verdana.ttf Verdana createmetrics Verdana verdanai.ttf Verdanai
Register fonts with FOP
userconfig.xml
Depending on the version of FOP used, additional configuration resides either within the fop.jar, or as a separate file conf/userconfig.xml. We recommend downloading desired distribution of FOP from the Apache website for full flexibilty on configuration.
The configuration file of FOP 0.20.5 contains a section where additional / embeddable fonts should be configured. The following excerpt shows how to set up FOP to use Verdana:
<!-- ************************************************************************ Add fonts here ( Verdana ) ************************************************************************ --> <fonts> <font metrics-file="verdana.xml" kerning="yes" embed-file="c:\windows\fonts\verdana.ttf"> <font-triplet name="Verdana" style="normal" weight="normal"></font> </font> <font metrics-file="verdanab.xml" kerning="yes" embed-file="c:\windows\fonts\verdanab.ttf"> <font-triplet name="Verdana" style="normal" weight="bold"></font> </font> <font metrics-file="verdanai.xml" kerning="yes" embed-file="c:\windows\fonts\verdanai.ttf"> <font-triplet name="Verdana" style="italic" weight="normal"></font> </font> </fonts>
XML
Specify the modified userconfig.xml when rendering document from designer
The Print Document dialog
When userconfig.xml is updated, please open the print dialog by clicking the PRINTER ICON. In the Print Document dialog, specify path to the configuration file. FOP should now recognize and embed the Verdana font when encountered.
FOP Additional configuration ( userconfig.xml )