public abstract class FontLoader
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
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
|
Constructor and Description |
---|
FontLoader(java.lang.String fontFileURI,
FontResolver resolver)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
CustomFont |
getFont()
Returns the custom font that was read using this instance of FontLoader.
|
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.
|
static CustomFont |
loadFont(java.net.URL fontUrl,
FontResolver resolver)
Loads a custom font from an URL.
|
protected 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.
|
protected static org.apache.commons.logging.Log log
protected java.lang.String fontFileURI
protected FontResolver resolver
protected CustomFont returnFont
protected boolean loaded
public FontLoader(java.lang.String fontFileURI, FontResolver resolver)
fontFileURI
- the URI to the PFB file of a Type 1 fontresolver
- the font resolver used to resolve URIspublic static CustomFont loadFont(java.io.File fontFile, FontResolver resolver) throws java.io.IOException
fontFile
- the File representation of the fontresolver
- the font resolver to use when resolving URIsjava.io.IOException
- In case of an I/O errorpublic static CustomFont loadFont(java.net.URL fontUrl, FontResolver resolver) throws java.io.IOException
fontUrl
- the URL representation of the fontresolver
- the font resolver to use when resolving URIsjava.io.IOException
- In case of an I/O errorpublic static CustomFont loadFont(java.lang.String fontFileURI, FontResolver resolver) throws java.io.IOException
fontFileURI
- the URI to the fontresolver
- the font resolver to use when resolving URIsjava.io.IOException
- In case of an I/O errorprotected static java.io.InputStream openFontUri(FontResolver resolver, java.lang.String uri) throws java.io.IOException, java.net.MalformedURLException
resolver
- the FontResolver to use for font URI resolutionuri
- the URI representing the fontjava.io.IOException
- In case of an I/O errorjava.net.MalformedURLException
- If an invalid URL is builtprotected abstract void read() throws java.io.IOException
java.io.IOException
- In case of an I/O errorpublic CustomFont getFont() throws java.io.IOException
java.io.IOException
- if an I/O error occursCopyright 1999-2008 The Apache Software Foundation. All Rights Reserved.