fop 1.1

## org.apache.fop.fonts
Class FontReader

    java.lang.Object
      org.xml.sax.helpers.DefaultHandler
          org.apache.fop.fonts.FontReader

All Implemented Interfaces:
  org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

    public class FontReader

extends org.xml.sax.helpers.DefaultHandler

Class for reading a metric.xml file and creating a font object. Typical usage:

     FontReader reader = new FontReader(<path til metrics.xml>);
     reader.setFontEmbedPath(<path to a .ttf or .pfb file or null to diable embedding>);
     reader.useKerning(true);
     Font f = reader.getFont();

Constructor Summary
`FontReader(org.xml.sax.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(java.lang.String uri, java.lang.String localName, java.lang.String qName)`
`Typeface` `getFont()` Get the generated font object
`void` `setAdvancedEnabled(boolean enabled)` Enable/disable use of advanced typographic features for the font
`void` `setDocumentLocator(org.xml.sax.Locator locator)`
`void` `setFontEmbedPath(java.lang.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(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)`

Methods inherited from class org.xml.sax.helpers.DefaultHandler
`endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FontReader

    public FontReader(org.xml.sax.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 Detail

### setFontEmbedPath

    public void setFontEmbedPath(java.lang.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

### setAdvancedEnabled

    public void setAdvancedEnabled(boolean enabled)

  Enable/disable use of advanced typographic features for the font

  Parameters:
    `enabled` - true to enable, false to disable

### setResolver

    public void setResolver(FontResolver resolver)

  Sets the font resolver. Needed for URI resolution.

  Parameters:
    `resolver` - the font resolver

### getFont

    public Typeface getFont()

  Get the generated font object

  Returns:
    the font

### startDocument

    public void startDocument()

  Specified by:
    `startDocument` in interface `org.xml.sax.ContentHandler`
  Overrides:
    `startDocument` in class `org.xml.sax.helpers.DefaultHandler`

### setDocumentLocator

    public void setDocumentLocator(org.xml.sax.Locator locator)

  Specified by:
    `setDocumentLocator` in interface `org.xml.sax.ContentHandler`
  Overrides:
    `setDocumentLocator` in class `org.xml.sax.helpers.DefaultHandler`

### startElement

    public void startElement(java.lang.String uri,
                             java.lang.String localName,
                             java.lang.String qName,
                             org.xml.sax.Attributes attributes)
                      throws org.xml.sax.SAXException

  Specified by:
    `startElement` in interface `org.xml.sax.ContentHandler`
  Overrides:
    `startElement` in class `org.xml.sax.helpers.DefaultHandler`
  Throws:
    `org.xml.sax.SAXException`

### endElement

    public void endElement(java.lang.String uri,
                           java.lang.String localName,
                           java.lang.String qName)
                    throws org.xml.sax.SAXException

  Specified by:
    `endElement` in interface `org.xml.sax.ContentHandler`
  Overrides:
    `endElement` in class `org.xml.sax.helpers.DefaultHandler`
  Throws:
    `org.xml.sax.SAXException`

### characters

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

  Specified by:
    `characters` in interface `org.xml.sax.ContentHandler`
  Overrides:
    `characters` in class `org.xml.sax.helpers.DefaultHandler`

fop 1.1

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