Package org.apache.fop.fonts
Class FontLoader
java.lang.Object
org.apache.fop.fonts.FontLoader
- Direct Known Subclasses:
OFFontLoader
,Type1FontLoader
Base class for font loaders.
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
true if the font will be embedded, false if it will be referenced only.protected final URI
URI representing the font fileprotected boolean
true if the font has been loadedprotected static final org.apache.commons.logging.Log
logging instanceprotected final InternalResourceResolver
the resource resolver to use for font URI resolutionprotected CustomFont
the loaded fontprotected boolean
true if advanced typographic information shall be loaded if available.protected boolean
true if kerning information false be loaded if available. -
Constructor Summary
ConstructorDescriptionFontLoader
(URI fontFileURI, boolean embedded, boolean useKerning, boolean useAdvanced, InternalResourceResolver resourceResolver) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptiongetFont()
Returns the custom font that was read using this instance of FontLoader.static CustomFont
loadFont
(FontUris fontUris, String subFontName, boolean embedded, EmbeddingMode embeddingMode, EncodingMode encodingMode, boolean useKerning, boolean useAdvanced, InternalResourceResolver resourceResolver, boolean simulateStyle, boolean embedAsType1, boolean useSVG) Loads a custom font from a URI.protected abstract void
read()
Reads/parses the font data.
-
Field Details
-
log
protected static final org.apache.commons.logging.Log loglogging instance -
fontFileURI
URI representing the font file -
resourceResolver
the resource resolver to use for font URI resolution -
returnFont
the loaded font -
loaded
protected boolean loadedtrue if the font has been loaded -
embedded
protected boolean embeddedtrue if the font will be embedded, false if it will be referenced only. -
useKerning
protected boolean useKerningtrue if kerning information false be loaded if available. -
useAdvanced
protected boolean useAdvancedtrue if advanced typographic information shall be loaded if available.
-
-
Constructor Details
-
FontLoader
public FontLoader(URI fontFileURI, boolean embedded, boolean useKerning, boolean useAdvanced, InternalResourceResolver resourceResolver) Default constructor.- Parameters:
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 availableuseAdvanced
- indicates whether advanced typographic information shall be loaded if availableresourceResolver
- the font resolver used to resolve URIs
-
-
Method Details
-
loadFont
public static CustomFont loadFont(FontUris fontUris, String subFontName, boolean embedded, EmbeddingMode embeddingMode, EncodingMode encodingMode, boolean useKerning, boolean useAdvanced, InternalResourceResolver resourceResolver, boolean simulateStyle, boolean embedAsType1, boolean useSVG) throws IOException Loads a custom font from a URI. In the case of Type 1 fonts, the PFB file must be specified.- Parameters:
fontUris
- the URI to the fontsubFontName
- the sub-fontname of a font (for TrueType Collections, null otherwise)embedded
- indicates whether the font is embedded or referencedembeddingMode
- the embedding mode of the fontencodingMode
- the requested encoding modeuseKerning
- indicates whether kerning information should be loaded if availableuseAdvanced
- indicates whether advanced typographic information shall be loaded if availableresourceResolver
- the font resolver to use when resolving URIs- Returns:
- the newly loaded font
- Throws:
IOException
- In case of an I/O error
-
read
Reads/parses the font data.- Throws:
IOException
- In case of an I/O error
-
getFont
Returns the custom font that was read using this instance of FontLoader.- Returns:
- the newly loaded font
- Throws:
IOException
- if an I/O error occurs
-