org.apache.fop.fonts.apps
Class TTFReader
A tool which reads TTF files and generates
XML font metrics file for use in FOP.
static void | checkMetricsVersion(Attributes attr) - Bugzilla 40739, check that attr has a metrics-version attribute
compatible with ours.
|
Document | constructFontXML(TTFFile ttf, String fontName, String className, String resource, String file, boolean isCid, String ttcName) - Generates the font metrics file from the TTF/TTC file.
|
TTFFile | loadTTF(String fileName, String fontName) - Read a TTF file and returns it as an object.
|
static void | main(String[] args) - The main method for the TTFReader tool.
|
METRICS_VERSION
public static final int METRICS_VERSION
Current version number for the metrics file
METRICS_VERSION_ATTR
public static final String METRICS_VERSION_ATTR
Used to detect incompatible versions of the generated XML files
TTFReader
public TTFReader()
Main constructor.
checkMetricsVersion
public static void checkMetricsVersion(Attributes attr)
throws SAXException
Bugzilla 40739, check that attr has a metrics-version attribute
compatible with ours.
attr
- attributes read from the root element of a metrics XML file
constructFontXML
public Document constructFontXML(TTFFile ttf,
String fontName,
String className,
String resource,
String file,
boolean isCid,
String ttcName)
Generates the font metrics file from the TTF/TTC file.
ttf
- The PFM file to generate the font metrics from.fontName
- Name of the fontclassName
- Class name for the fontresource
- path to the font as embedded resourcefile
- path to the font as fileisCid
- True if the font is CID encodedttcName
- Name of the TrueType Collection
- The DOM document representing the font metrics file.
loadTTF
public TTFFile loadTTF(String fileName,
String fontName)
throws IOException
Read a TTF file and returns it as an object.
fileName
- The filename of the TTF file.fontName
- The name of the font
- The TTF as an object, null if the font is incompatible.
main
public static void main(String[] args)
The main method for the TTFReader tool.
args
- Command-line arguments: [options] fontfile.ttf xmlfile.xml
where options can be:
-fn
default is to use the fontname in the .ttf file, but you can override
that name to make sure that the embedded font is used instead of installed
fonts when viewing documents with Acrobat Reader.
-cn
default is to use the fontname
-ef
will add the possibility to embed the font. When running fop, fop will look
for this file to embed it
-er
you can also include the fontfile in the fop.jar file when building fop.
You can use both -ef and -er. The file specified in -ef will be searched first,
then the -er file.
Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.