org.apache.fop.fonts

Class FontReader


public class FontReader
extends DefaultHandler

Class for reading a metric.xml file and creating a font object. Typical usage:
 FontReader reader = new FontReader();
 reader.setFontEmbedPath();
 reader.useKerning(true);
 Font f = reader.getFont();
 

Constructor Summary

FontReader(InputSource source)
Construct a FontReader object from a path to a metric.xml file and read metric data

Method Summary

void
characters(char[] ch, int start, int length)
void
endElement(String uri, String localName, String qName)
Typeface
getFont()
Get the generated font object
void
setDocumentLocator(Locator locator)
void
setFontEmbedPath(String path)
Sets the path to embed a font.
void
setKerningEnabled(boolean enabled)
Enable/disable use of kerning for the font
void
setResolver(FontResolver resolver)
Sets the font resolver.
void
startDocument()
void
startElement(String uri, String localName, String qName, Attributes attributes)

Constructor Details

FontReader

public FontReader(InputSource source)
            throws FOPException
Construct a FontReader object from a path to a metric.xml file and read metric data
Parameters:
source - Source of the font metric file
Throws:
FOPException - if loading the font fails

Method Details

characters

public void characters(char[] ch,
                       int start,
                       int length)

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
            throws SAXException

getFont

public Typeface getFont()
Get the generated font object
Returns:
the font

setDocumentLocator

public void setDocumentLocator(Locator locator)

setFontEmbedPath

public void setFontEmbedPath(String path)
Sets the path to embed a font. A null value disables font embedding.
Parameters:
path - URI for the embeddable file

setKerningEnabled

public void setKerningEnabled(boolean enabled)
Enable/disable use of kerning for the font
Parameters:
enabled - true to enable kerning, false to disable

setResolver

public void setResolver(FontResolver resolver)
Sets the font resolver. Needed for URI resolution.
Parameters:
resolver - the font resolver

startDocument

public void startDocument()

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attributes)
            throws SAXException

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