fop 1.1

## org.apache.fop.fonts
Class FontLoader

    java.lang.Object
      org.apache.fop.fonts.FontLoader

Direct Known Subclasses:
  TTFFontLoader, Type1FontLoader

    public abstract class FontLoader

extends java.lang.Object

Base class for font loaders.

Field Summary
`protected boolean` `embedded` true if the font will be embedded, false if it will be referenced only.
`protected java.lang.String` `fontFileURI` URI representing the font file
`protected boolean` `loaded` true if the font has been loaded
`protected static org.apache.commons.logging.Log` `log` logging instance
`protected FontResolver` `resolver` the FontResolver to use for font URI resolution
`protected CustomFont` `returnFont` the loaded font
`protected boolean` `useAdvanced` true if advanced typographic information shall be loaded if available.
`protected boolean` `useKerning` true if kerning information false be loaded if available.

Constructor Summary
`FontLoader(java.lang.String fontFileURI, boolean embedded, boolean useKerning, boolean useAdvanced, FontResolver resolver)` Default constructor.

Method Summary
`CustomFont` `getFont()` Returns the custom font that was read using this instance of FontLoader.
`static CustomFont` `loadFont(java.io.File fontFile, java.lang.String subFontName, boolean embedded, EmbeddingMode embeddingMode, EncodingMode encodingMode, FontResolver resolver)` Loads a custom font from a File.
`static CustomFont` `loadFont(java.lang.String fontFileURI, java.lang.String subFontName, boolean embedded, EmbeddingMode embeddingMode, EncodingMode encodingMode, boolean useKerning, boolean useAdvanced, FontResolver resolver)` Loads a custom font from a URI.
`static CustomFont` `loadFont(java.net.URL fontUrl, java.lang.String subFontName, boolean embedded, EmbeddingMode embeddingMode, EncodingMode encodingMode, FontResolver resolver)` Loads a custom font from an URL.
`static java.io.InputStream` `openFontUri(FontResolver resolver, java.lang.String uri)` Opens a font URI and returns an input stream.
`protected abstract void` `read()` Reads/parses the font data.

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

Field Detail

### log

    protected static final org.apache.commons.logging.Log log

  logging instance

### fontFileURI

    protected java.lang.String fontFileURI

  URI representing the font file

### resolver

    protected FontResolver resolver

  the FontResolver to use for font URI resolution

### returnFont

    protected CustomFont returnFont

  the loaded font

### loaded

    protected boolean loaded

  true if the font has been loaded

### embedded

    protected boolean embedded

  true if the font will be embedded, false if it will be referenced only.

### useKerning

    protected boolean useKerning

  true if kerning information false be loaded if available.

### useAdvanced

    protected boolean useAdvanced

  true if advanced typographic information shall be loaded if available.

Constructor Detail

### FontLoader

    public FontLoader(java.lang.String fontFileURI,
                      boolean embedded,
                      boolean useKerning,
                      boolean useAdvanced,
                      FontResolver resolver)

  Default constructor.

  Parameters:
    `fontFileURI` - the URI to the PFB file of a Type 1 font
    `embedded` - indicates whether the font is embedded or referenced
    `useKerning` - indicates whether kerning information shall be loaded if available
    `useAdvanced` - indicates whether advanced typographic information shall be loaded if available
    `resolver` - the font resolver used to resolve URIs

Method Detail

### loadFont

    public static CustomFont loadFont(java.io.File fontFile,
                                      java.lang.String subFontName,
                                      boolean embedded,
                                      EmbeddingMode embeddingMode,
                                      EncodingMode encodingMode,
                                      FontResolver resolver)
                               throws java.io.IOException

  Loads a custom font from a File. In the case of Type 1 fonts, the PFB file must be specified.

  Parameters:
    `fontFile` - the File representation of the font
    `subFontName` - the sub-fontname of a font (for TrueType Collections, null otherwise)
    `embedded` - indicates whether the font is embedded or referenced
    `embeddingMode` - the embedding mode
    `encodingMode` - the requested encoding mode
    `resolver` - the font resolver to use when resolving URIs
  Returns:
    the newly loaded font
  Throws:
    `java.io.IOException` - In case of an I/O error

### loadFont

    public static CustomFont loadFont(java.net.URL fontUrl,
                                      java.lang.String subFontName,
                                      boolean embedded,
                                      EmbeddingMode embeddingMode,
                                      EncodingMode encodingMode,
                                      FontResolver resolver)
                               throws java.io.IOException

  Loads a custom font from an URL. In the case of Type 1 fonts, the PFB file must be specified.

  Parameters:
    `fontUrl` - the URL representation of the font
    `subFontName` - the sub-fontname of a font (for TrueType Collections, null otherwise)
    `embedded` - indicates whether the font is embedded or referenced
    `embeddingMode` - the embedding mode of the font
    `encodingMode` - the requested encoding mode
    `resolver` - the font resolver to use when resolving URIs
  Returns:
    the newly loaded font
  Throws:
    `java.io.IOException` - In case of an I/O error

### loadFont

    public static CustomFont loadFont(java.lang.String fontFileURI,
                                      java.lang.String subFontName,
                                      boolean embedded,
                                      EmbeddingMode embeddingMode,
                                      EncodingMode encodingMode,
                                      boolean useKerning,
                                      boolean useAdvanced,
                                      FontResolver resolver)
                               throws java.io.IOException

  Loads a custom font from a URI. In the case of Type 1 fonts, the PFB file must be specified.

  Parameters:
    `fontFileURI` - the URI to the font
    `subFontName` - the sub-fontname of a font (for TrueType Collections, null otherwise)
    `embedded` - indicates whether the font is embedded or referenced
    `embeddingMode` - the embedding mode of the font
    `encodingMode` - the requested encoding mode
    `useKerning` - indicates whether kerning information should be loaded if available
    `useAdvanced` - indicates whether advanced typographic information shall be loaded if available
    `resolver` - the font resolver to use when resolving URIs
  Returns:
    the newly loaded font
  Throws:
    `java.io.IOException` - In case of an I/O error

### openFontUri

    public static java.io.InputStream openFontUri(FontResolver resolver,
                                                  java.lang.String uri)
                                           throws java.io.IOException,
                                                  java.net.MalformedURLException

  Opens a font URI and returns an input stream.

  Parameters:
    `resolver` - the FontResolver to use for font URI resolution
    `uri` - the URI representing the font
  Returns:
    the InputStream to read the font from.
  Throws:
    `java.io.IOException` - In case of an I/O error
    `java.net.MalformedURLException` - If an invalid URL is built

### read

    protected abstract void read()
                          throws java.io.IOException

  Reads/parses the font data.

  Throws:
    `java.io.IOException` - In case of an I/O error

### getFont

    public CustomFont getFont()
                       throws java.io.IOException

  Returns the custom font that was read using this instance of FontLoader.

  Returns:
    the newly loaded font
  Throws:
    `java.io.IOException` - if an I/O error occurs

fop 1.1

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