Firebird Documentation Index → Using non-Western fonts → 3: Create metrics files |
For every non-standard font you use, a file with font metrics
information must be generated. Apache FOP needs this information while
performing the XSL-FO ->
PDF conversion. You can
create the metrics files with the t1Metrics
and
ttfMetrics
targets in our build system. At the command
prompt in the root of the firebird-documentation project, type (on one
line!):
gradlew ttfMetrics --fontFile=D:\Path\To\fontfile
.ttf --metricsFileName=filename
.xml
to build a TTF metrics file, or
gradlew t1Metrics --fontFile=D:\Path\To\fontfile
.pfm --metricsFileName=filename
.xml
for a Type 1 metrics file.
Please note:
You must provide the full path to the font file, but only a file
name for the metrics file. The metrics file will be placed in
build/font-metrics
. You will
need to manually copy it to the appropriate language directory or
directories in config
.
You are free in your choice of the metrics file's base name, but it's wise to make it indicative of the font.
For the t1Metrics
target, you must specify
the .pfm
file, not the
.pfb
.
The second character of t1Metrics
is the
digit 1
(one), not the letter
el
.
An additional parameter fontName
exists
to override the font name to use when embedding. For example the MS
Mincho font will default to use MS-Mincho as the embedded name, but we
override it to MSMincho.
Remember that you must repeat this step for every font you add. If the bold and/or italic variations reside in different files, you must also create a separate metrics file for each variation.
Metrics files created with older version of FOP (which was part of our build tools until March 2020) are not usable with our current FOP version (2.4). If you have such files in your tree, regenerate them with the latest tool set. Notice however that performing a git update may already bring you the current metrics files.
Some TrueType fonts are packed together in .ttc
files (TrueType collections). The
ttfMetrics
target allows you to build metrics files
for such fonts:
gradlew ttfMetrics --fontFile=D:\Path\To\collection
.ttc --ttcName=fontname
--metricsFileName=filename
.xml
There's an additional ttcName
(font name)
parameter. If the font name contains a space, make sure to enclose the
value in double quotes. To find out which fonts are in a collection,
call the ttfMetrics
target without the
ttcName
parameter and with an additional
info
parameter, like this:
gradlew ttfMetrics --fontFile=D:\Path\To\collection
.ttc --metricsFileName=filename
.xml --info
This will result in a build failure, but just before that you'll find a list of all the fonts contained in the collection.
Firebird Documentation Index → Using non-Western fonts → 3: Create metrics files |