public abstract class FontLoader extends Object
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
embedded
true if the font will be embedded, false if it will be referenced only.
|
protected String |
fontFileURI
URI representing the font file
|
protected boolean |
loaded
true if the font has been loaded
|
protected static org.slf4j.Logger |
log
logging instance
|
protected FontResolver |
resolver
the FontResolver to use for font URI resolution
|
protected CustomFont |
returnFont
the loaded font
|
protected boolean |
useKerning
true if kerning information shall be loaded if available.
|
| Constructor and Description |
|---|
FontLoader(String fontFileURI,
boolean embedded,
boolean useKerning,
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(File fontFile,
String subFontName,
boolean embedded,
EncodingMode encodingMode,
FontResolver resolver)
Loads a custom font from a File.
|
static CustomFont |
loadFont(String fontFileURI,
String subFontName,
boolean embedded,
EncodingMode encodingMode,
boolean useKerning,
FontResolver resolver)
Loads a custom font from a URI.
|
static CustomFont |
loadFont(URL fontUrl,
String subFontName,
boolean embedded,
EncodingMode encodingMode,
FontResolver resolver)
Loads a custom font from an URL.
|
static InputStream |
openFontUri(FontResolver resolver,
String uri)
Opens a font URI and returns an input stream.
|
protected abstract void |
read()
Reads/parses the font data.
|
protected static org.slf4j.Logger log
protected String fontFileURI
protected FontResolver resolver
protected CustomFont returnFont
protected boolean loaded
protected boolean embedded
protected boolean useKerning
public FontLoader(String fontFileURI, boolean embedded, boolean useKerning, FontResolver resolver)
fontFileURI - the URI to the PFB file of a Type 1 fontembedded - indicates whether the font is embedded or referenceduseKerning - indicates whether kerning information shall be loaded if availableresolver - the font resolver used to resolve URIspublic static CustomFont loadFont(File fontFile, String subFontName, boolean embedded, EncodingMode encodingMode, FontResolver resolver) throws IOException
fontFile - the File representation of the fontsubFontName - the sub-fontname of a font (for TrueType Collections, null otherwise)embedded - indicates whether the font is embedded or referencedencodingMode - the requested encoding moderesolver - the font resolver to use when resolving URIsIOException - In case of an I/O errorpublic static CustomFont loadFont(URL fontUrl, String subFontName, boolean embedded, EncodingMode encodingMode, FontResolver resolver) throws IOException
fontUrl - the URL representation of the fontsubFontName - the sub-fontname of a font (for TrueType Collections, null otherwise)embedded - indicates whether the font is embedded or referencedencodingMode - the requested encoding moderesolver - the font resolver to use when resolving URIsIOException - In case of an I/O errorpublic static CustomFont loadFont(String fontFileURI, String subFontName, boolean embedded, EncodingMode encodingMode, boolean useKerning, FontResolver resolver) throws IOException
fontFileURI - the URI to the fontsubFontName - the sub-fontname of a font (for TrueType Collections, null otherwise)embedded - indicates whether the font is embedded or referencedencodingMode - the requested encoding modeuseKerning - indicates whether kerning information should be loaded if availableresolver - the font resolver to use when resolving URIsIOException - In case of an I/O errorpublic static InputStream openFontUri(FontResolver resolver, String uri) throws IOException, MalformedURLException
resolver - the FontResolver to use for font URI resolutionuri - the URI representing the fontIOException - In case of an I/O errorMalformedURLException - If an invalid URL is builtprotected abstract void read()
throws IOException
IOException - In case of an I/O errorpublic CustomFont getFont() throws IOException
IOException - if an I/O error occursCopyright © 2007-2020. All Rights Reserved.