fop 0.94

org.apache.fop.fonts
Class FontLoader

java.lang.Object
  extended by 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  java.lang.String fontFileURI
          URI representing the font file
protected  java.io.InputStream in
          the InputStream to load the font from
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
 
Constructor Summary
FontLoader(java.lang.String fontFileURI, java.io.InputStream in, FontResolver resolver)
          Default constructor.
 
Method Summary
 CustomFont getFont()
           
static CustomFont loadFont(java.io.File fontFile, FontResolver resolver)
          Loads a custom font from a File.
static CustomFont loadFont(java.lang.String fontFileURI, FontResolver resolver)
          Loads a custom font from a URI.
protected static CustomFont loadFontFromInputStream(java.lang.String fontFileURI, FontResolver resolver, boolean isType1, java.io.InputStream in)
          Loads and returns a font given 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 org.apache.commons.logging.Log log
logging instance


fontFileURI

protected java.lang.String fontFileURI
URI representing the font file


in

protected java.io.InputStream in
the InputStream to load the font from


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

Constructor Detail

FontLoader

public FontLoader(java.lang.String fontFileURI,
                  java.io.InputStream in,
                  FontResolver resolver)
Default constructor.

Parameters:
fontFileURI - the URI to the PFB file of a Type 1 font
in - the InputStream reading the PFM file of a Type 1 font
resolver - the font resolver used to resolve URIs
Method Detail

loadFont

public static CustomFont loadFont(java.io.File fontFile,
                                  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
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,
                                  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
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

loadFontFromInputStream

protected static CustomFont loadFontFromInputStream(java.lang.String fontFileURI,
                                                    FontResolver resolver,
                                                    boolean isType1,
                                                    java.io.InputStream in)
                                             throws java.io.IOException
Loads and returns a font given an input stream.

Parameters:
fontFileURI - font file uri
resolver - font resolver
isType1 - is it a type1 font?
in - input stream
Returns:
the loaded font.
Throws:
java.io.IOException - In case of an I/O error

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
Throws:
java.io.IOException
See Also:
getFont()

fop 0.94

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