fop 1.1

org.apache.fop.fonts
Class FontManager

java.lang.Object
  extended by org.apache.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.


Nested Class Summary
static class FontManager.MinimalFontResolver
          Minimum implemenation of FontResolver.
 
Field Summary
static boolean DEFAULT_USE_CACHE
          Use cache (record previously detected font triplet info)
 
Constructor Summary
FontManager()
          Main constructor
 
Method Summary
static FontResolver createMinimalFontResolver(boolean useComplexScriptFeatures)
          Create minimal font resolver.
 boolean deleteCache()
          Deletes the current FontCache file
 java.io.File getCacheFile()
          Returns the font cache file
 java.lang.String getFontBaseURL()
          Returns the font base URL.
 FontCache getFontCache()
          Returns the font cache instance used by this font manager.
protected  FontSubstitutions getFontSubstitutions()
          Returns the font substitution catalog
 FontTriplet.Matcher getReferencedFontsMatcher()
          Gets the FontTriplet.Matcher that can be used to identify the fonts that shall be referenced rather than embedded.
 boolean isBase14KerningEnabled()
           
 void saveCache()
          Saves the FontCache as necessary
 void setBase14KerningEnabled(boolean value)
          Controls whether kerning is activated on base 14 fonts.
 void setCacheFile(java.io.File cacheFile)
          Sets the font cache file
 void setFontBaseURL(java.lang.String fontBase)
          Sets the font base URL.
 void setFontSubstitutions(FontSubstitutions substitutions)
          Sets the font substitutions
 void setReferencedFontsMatcher(FontTriplet.Matcher matcher)
          Sets the FontTriplet.Matcher that can be used to identify the fonts that shall be referenced rather than embedded.
 void setup(FontInfo fontInfo, FontCollection[] fontCollections)
          Sets up the fonts on a given FontInfo object.
 void setUseCache(boolean useCache)
          Whether or not to cache results of font triplet detection/auto-config
 void updateReferencedFonts(java.util.List<EmbedFontInfo> fontInfoList)
          Updates the referenced font list using the FontManager's referenced fonts matcher (getReferencedFontsMatcher()).
 void updateReferencedFonts(java.util.List<EmbedFontInfo> fontInfoList, FontTriplet.Matcher matcher)
          Updates the referenced font list.
 boolean useCache()
          Cache results of font triplet detection/auto-config?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_USE_CACHE

public static final boolean DEFAULT_USE_CACHE
Use cache (record previously detected font triplet info)

See Also:
Constant Field Values
Constructor Detail

FontManager

public FontManager()
Main constructor

Method Detail

setFontBaseURL

public void setFontBaseURL(java.lang.String fontBase)
                    throws java.net.MalformedURLException
Sets 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

public void setFontSubstitutions(FontSubstitutions substitutions)
Sets the font substitutions

Parameters:
substitutions - font substitutions

getFontSubstitutions

protected FontSubstitutions getFontSubstitutions()
Returns the font substitution catalog

Returns:
the font substitution catalog

setCacheFile

public void setCacheFile(java.io.File cacheFile)
Sets the font cache file

Parameters:
cacheFile - the font cache file

getCacheFile

public java.io.File getCacheFile()
Returns the font cache file

Returns:
the font cache file

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

public FontCache getFontCache()
Returns the font cache instance used by this font manager.

Returns:
the font cache

saveCache

public void saveCache()
               throws FOPException
Saves the FontCache as necessary

Throws:
FOPException - fop exception

deleteCache

public boolean deleteCache()
Deletes the current FontCache file

Returns:
Returns true if the font cache file was successfully deleted.

setup

public void setup(FontInfo fontInfo,
                  FontCollection[] fontCollections)
Sets up the fonts on a given FontInfo object. The fonts to setup are defined by an array of FontCollection objects.

Parameters:
fontInfo - the FontInfo object to set up
fontCollections - the array of font collections/sources

createMinimalFontResolver

public static FontResolver createMinimalFontResolver(boolean useComplexScriptFeatures)
Create minimal font resolver.

Parameters:
useComplexScriptFeatures - true if complex script features enabled
Returns:
a new FontResolver to be used by the font subsystem

setReferencedFontsMatcher

public void setReferencedFontsMatcher(FontTriplet.Matcher matcher)
Sets the FontTriplet.Matcher that can be used to identify the fonts that shall be referenced rather than embedded.

Parameters:
matcher - the font triplet matcher

getReferencedFontsMatcher

public FontTriplet.Matcher getReferencedFontsMatcher()
Gets the FontTriplet.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

public void updateReferencedFonts(java.util.List<EmbedFontInfo> fontInfoList)
Updates the referenced font list using the FontManager's referenced fonts matcher (getReferencedFontsMatcher()).

Parameters:
fontInfoList - a font info list

updateReferencedFonts

public void updateReferencedFonts(java.util.List<EmbedFontInfo> fontInfoList,
                                  FontTriplet.Matcher matcher)
Updates the referenced font list.

Parameters:
fontInfoList - a font info list
matcher - the font triplet matcher to use

fop 1.1

Copyright 1999-2012 The Apache Software Foundation. All Rights Reserved.