Package org.docx4j.fonts.fop.fonts
Class FontManager
java.lang.Object
org.docx4j.fonts.fop.fonts.FontManager
public class FontManager
extends java.lang.Object
The manager of fonts. The class holds a reference to the font cache and information about
font substitution, referenced fonts and similar.
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_USE_CACHEUse cache (record previously detected font triplet info) -
Constructor Summary
Constructors Constructor Description FontManager()Main constructor -
Method Summary
Modifier and Type Method Description static FontResolvercreateMinimalFontResolver()java.lang.StringgetFontBaseURL()Returns the font base URL.FontCachegetFontCache()Returns the font cache instance used by this font manager.protected FontSubstitutionsgetFontSubstitutions()Returns the font substitution catalogFontTriplet.MatchergetReferencedFontsMatcher()Gets theFontTriplet.Matcherthat can be used to identify the fonts that shall be referenced rather than embedded.booleanisBase14KerningEnabled()voidsetBase14KerningEnabled(boolean value)Controls whether kerning is activated on base 14 fonts.voidsetFontBaseURL(java.lang.String fontBase)Sets the font base URL.voidsetFontSubstitutions(FontSubstitutions substitutions)Sets the font substitutionsvoidsetReferencedFontsMatcher(FontTriplet.Matcher matcher)Sets theFontTriplet.Matcherthat can be used to identify the fonts that shall be referenced rather than embedded.voidsetup(FontInfo fontInfo, FontCollection[] fontCollections)Sets up the fonts on a given FontInfo object.voidsetUseCache(boolean useCache)Whether or not to cache results of font triplet detection/auto-configbooleanuseCache()Cache results of font triplet detection/auto-config?
-
Field Details
-
DEFAULT_USE_CACHE
public static final boolean DEFAULT_USE_CACHEUse cache (record previously detected font triplet info)- See Also:
- Constant Field Values
-
-
Constructor Details
-
FontManager
public FontManager()Main constructor
-
-
Method Details
-
setFontBaseURL
public void setFontBaseURL(java.lang.String fontBase) throws java.net.MalformedURLExceptionSets the font base URL.- Parameters:
fontBase- font base URL- Throws:
java.net.MalformedURLException- if there's a problem with a URL
-
getFontBaseURL
public java.lang.String getFontBaseURL()Returns the font base URL.- Returns:
- the font base URL (or null if none was set)
-
isBase14KerningEnabled
public boolean isBase14KerningEnabled()- Returns:
- true if kerning on base 14 fonts is enabled
-
setBase14KerningEnabled
public void setBase14KerningEnabled(boolean value)Controls whether kerning is activated on base 14 fonts.- Parameters:
value- true if kerning should be activated
-
setFontSubstitutions
Sets the font substitutions- Parameters:
substitutions- font substitutions
-
getFontSubstitutions
Returns the font substitution catalog- Returns:
- the font substitution catalog
-
setUseCache
public void setUseCache(boolean useCache)Whether or not to cache results of font triplet detection/auto-config- Parameters:
useCache- use cache or not
-
useCache
public boolean useCache()Cache results of font triplet detection/auto-config?- Returns:
- true if this font manager uses the cache
-
getFontCache
Returns the font cache instance used by this font manager.- Returns:
- the font cache
-
setup
Sets up the fonts on a given FontInfo object. The fonts to setup are defined by an array ofFontCollectionobjects.- Parameters:
fontInfo- the FontInfo object to set upfontCollections- the array of font collections/sources
-
createMinimalFontResolver
- Returns:
- a new FontResolver to be used by the font subsystem
-
setReferencedFontsMatcher
Sets theFontTriplet.Matcherthat can be used to identify the fonts that shall be referenced rather than embedded.- Parameters:
matcher- the font triplet matcher
-
getReferencedFontsMatcher
Gets theFontTriplet.Matcherthat can be used to identify the fonts that shall be referenced rather than embedded.- Returns:
- the font triplet matcher (or null if none is set)
-