Package org.apache.fop.fonts
Class FontManager
java.lang.Object
org.apache.fop.fonts.FontManager
The manager of fonts. The class holds a reference to the font cache and information about
font substitution, referenced fonts and similar.
-
Constructor Summary
ConstructorsConstructorDescriptionFontManager
(InternalResourceResolver resourceResolver, FontDetector fontDetector, FontCacheManager fontCacheManager) Main constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
autoDetectFonts
(boolean autoDetectFonts, FontAdder fontAdder, boolean strict, FontEventListener listener, List<EmbedFontInfo> fontInfoList) Detect fonts from the operating system via FOPs autodetect mechanism.void
Deletes the current FontCache filevoid
Whether or not to cache results of font triplet detection/auto-configReturns the font cache instance used by this font manager.protected FontSubstitutions
Returns the font substitution catalogGets theFontTriplet.Matcher
that can be used to identify the fonts that shall be referenced rather than embedded.boolean
void
Saves the FontCache as necessaryvoid
setBase14KerningEnabled
(boolean value) Controls whether kerning is activated on base 14 fonts.void
setCacheFile
(URI cacheFileURI) Sets the font cache filevoid
setFontSubstitutions
(FontSubstitutions substitutions) Sets the font substitutionsvoid
Sets theFontTriplet.Matcher
that can be used to identify the fonts that shall be referenced rather than embedded.void
setResourceResolver
(InternalResourceResolver resourceResolver) Sets the font resource resolvervoid
setup
(FontInfo fontInfo, FontCollection[] fontCollections) Sets up the fonts on a given FontInfo object.void
updateReferencedFonts
(List<EmbedFontInfo> fontInfoList) Updates the referenced font list using the FontManager's referenced fonts matcher (getReferencedFontsMatcher()
).void
updateReferencedFonts
(List<EmbedFontInfo> fontInfoList, FontTriplet.Matcher matcher) Updates the referenced font list.
-
Constructor Details
-
FontManager
public FontManager(InternalResourceResolver resourceResolver, FontDetector fontDetector, FontCacheManager fontCacheManager) Main constructor- Parameters:
resourceResolver
- the URI resolverfontDetector
- the font detectorfontCacheManager
- the font cache manager
-
-
Method Details
-
setResourceResolver
Sets the font resource resolver- Parameters:
resourceResolver
- resource resolver
-
getResourceResolver
-
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
-
setCacheFile
Sets the font cache file- Parameters:
cacheFileURI
- the URI of the font cache file
-
disableFontCache
public void disableFontCache()Whether or not to cache results of font triplet detection/auto-config -
getFontCache
Returns the font cache instance used by this font manager.- Returns:
- the font cache
-
saveCache
Saves the FontCache as necessary- Throws:
FOPException
- fop exception
-
deleteCache
Deletes the current FontCache file- Throws:
FOPException
- if an error was thrown while deleting the cache
-
setup
Sets up the fonts on a given FontInfo object. The fonts to setup are defined by an array ofFontCollection
objects.- Parameters:
fontInfo
- the FontInfo object to set upfontCollections
- the array of font collections/sources
-
setReferencedFontsMatcher
Sets theFontTriplet.Matcher
that can be used to identify the fonts that shall be referenced rather than embedded.- Parameters:
matcher
- the font triplet matcher
-
getReferencedFontsMatcher
Gets theFontTriplet.Matcher
that 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)
-
updateReferencedFonts
Updates the referenced font list using the FontManager's referenced fonts matcher (getReferencedFontsMatcher()
).- Parameters:
fontInfoList
- a font info list
-
updateReferencedFonts
Updates the referenced font list.- Parameters:
fontInfoList
- a font info listmatcher
- the font triplet matcher to use
-
autoDetectFonts
public void autoDetectFonts(boolean autoDetectFonts, FontAdder fontAdder, boolean strict, FontEventListener listener, List<EmbedFontInfo> fontInfoList) throws FOPException Detect fonts from the operating system via FOPs autodetect mechanism.- Parameters:
autoDetectFonts
- if autodetect has been enabledfontAdder
- the font adding mechanismstrict
- whether to enforce strict validationlistener
- the listener for font related eventsfontInfoList
- a list of font info objects- Throws:
FOPException
- if an exception was thrown auto-detecting fonts
-