org.apache.fop.fonts

## Class XMLFontMetricsReader

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

- All Implemented Interfaces:
    ContentHandler, DTDHandler, EntityResolver, ErrorHandler

  Deprecated.

      @Deprecated
      public class XMLFontMetricsReader
      extends DefaultHandler

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

       XMLFontMetricsReader reader = new XMLFontMetricsReader(<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();

  N.B. This is deprecated functionality and is expected to be removed from a future version of FOP. New applications using FOP should not make direct or implied use of this mechanism.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMLFontMetricsReader(InputSource source, InternalResourceResolver resourceResolver)` Deprecated. Construct a XMLFontMetricsReader object from a path to a metric.xml file and read metric data

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `characters(char[] ch, int start, int length)` Deprecated.
    `void` | `endElement(String uri, String localName, String qName)` Deprecated.
    `Typeface` | `getFont()` Deprecated. Get the generated font object
    `void` | `setAdvancedEnabled(boolean enabled)` Deprecated. Enable/disable use of advanced typographic features for the font
    `void` | `setFontEmbedURI(URI path)` Deprecated. Sets the path to embed a font.
    `void` | `setKerningEnabled(boolean enabled)` Deprecated. Enable/disable use of kerning for the font
    `void` | `startDocument()` Deprecated.
    `void` | `startElement(String uri, String localName, String qName, Attributes attributes)` Deprecated.

    - ### Methods inherited from class org.xml.sax.helpers.DefaultHandler

      `endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XMLFontMetricsReader

          public XMLFontMetricsReader(InputSource source,
                                      InternalResourceResolver resourceResolver)
                               throws FOPException

      Deprecated.
      Construct a XMLFontMetricsReader 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

    - #### setFontEmbedURI

          public void setFontEmbedURI(URI path)

      Deprecated.
      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)

      Deprecated.
      Enable/disable use of kerning for the font
      Parameters:
        `enabled` - true to enable kerning, false to disable

    - #### setAdvancedEnabled

          public void setAdvancedEnabled(boolean enabled)

      Deprecated.
      Enable/disable use of advanced typographic features for the font
      Parameters:
        `enabled` - true to enable, false to disable

    - #### getFont

          public Typeface getFont()

      Deprecated.
      Get the generated font object
      Returns:
        the font

    - #### startDocument

          public void startDocument()

      Deprecated.
      Specified by:
        `startDocument` in interface `ContentHandler`
      Overrides:
        `startDocument` in class `DefaultHandler`

    - #### startElement

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

      Deprecated.
      Specified by:
        `startElement` in interface `ContentHandler`
      Overrides:
        `startElement` in class `DefaultHandler`
      Throws:
        `SAXException`

    - #### endElement

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

      Deprecated.
      Specified by:
        `endElement` in interface `ContentHandler`
      Overrides:
        `endElement` in class `DefaultHandler`
      Throws:
        `SAXException`

    - #### characters

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

      Deprecated.
      Specified by:
        `characters` in interface `ContentHandler`
      Overrides:
        `characters` in class `DefaultHandler`

Copyright © 2025 Apache Software Foundation. All rights reserved.