fop 0.91beta

org.apache.fop.fonts.apps
Class TTFReader

java.lang.Object
  |
  +--org.apache.fop.fonts.apps.TTFReader

public class TTFReader
extends java.lang.Object

A tool which reads TTF files and generates XML font metrics file for use in FOP.


Field Summary
protected static org.apache.commons.logging.Log log
          logging instance
 
Constructor Summary
TTFReader()
          Main constructor.
 
Method Summary
 org.w3c.dom.Document constructFontXML(TTFFile ttf, java.lang.String fontName, java.lang.String className, java.lang.String resource, java.lang.String file, boolean isCid, java.lang.String ttcName)
          Generates the font metrics file from the TTF/TTC file.
 TTFFile loadTTF(java.lang.String fileName, java.lang.String fontName)
          Read a TTF file and returns it as an object.
static void main(java.lang.String[] args)
          The main method for the TTFReader tool.
 void writeFontXML(org.w3c.dom.Document doc, java.lang.String target)
          Writes the generated DOM Document to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
logging instance
Constructor Detail

TTFReader

public TTFReader()
Main constructor.
Method Detail

main

public static void main(java.lang.String[] args)
The main method for the TTFReader tool.
Parameters:
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.

loadTTF

public TTFFile loadTTF(java.lang.String fileName,
                       java.lang.String fontName)
                throws java.io.IOException
Read a TTF file and returns it as an object.
Parameters:
fileName - The filename of the TTF file.
fontName - The name of the font
Returns:
The TTF as an object, null if the font is incompatible.
Throws:
java.io.IOException - In case of an I/O problem

writeFontXML

public void writeFontXML(org.w3c.dom.Document doc,
                         java.lang.String target)
                  throws javax.xml.transform.TransformerException
Writes the generated DOM Document to a file.
Parameters:
doc - The DOM Document to save.
target - The target filename for the XML file.
Throws:
javax.xml.transform.TransformerException - if an error occurs during serialization

constructFontXML

public org.w3c.dom.Document constructFontXML(TTFFile ttf,
                                             java.lang.String fontName,
                                             java.lang.String className,
                                             java.lang.String resource,
                                             java.lang.String file,
                                             boolean isCid,
                                             java.lang.String ttcName)
Generates the font metrics file from the TTF/TTC file.
Parameters:
ttf - The PFM file to generate the font metrics from.
fontName - Name of the font
className - Class name for the font
resource - path to the font as embedded resource
file - path to the font as file
isCid - True if the font is CID encoded
ttcName - Name of the TrueType Collection
Returns:
The DOM document representing the font metrics file.

fop 0.91beta

Copyright 1999-2005 The Apache Software Foundation. All Rights Reserved.