org.apache.fop.fonts
Class FontCache
java.lang.Object
org.apache.fop.fonts.FontCache
- Serializable
public final class FontCache
extends java.lang.Object
implements Serializable
Fop cache (currently only used for font info caching)
void | addFont(EmbedFontInfo fontInfo) - adds a font info to cache
|
void | clear() - Clears font cache
|
boolean | containsFont(String embedUrl) - is this font in the cache?
|
boolean | containsFont(EmbedFontInfo fontInfo) - is this font info in the cache?
|
protected static String | getCacheKey(EmbedFontInfo fontInfo) - creates a key given a font info for the font mapping
|
static File | getDefaultCacheFile(boolean forWriting) - Returns the default font cache file.
|
CachedFontInfo | getFont(String embedUrl) - returns a font from the cache
|
boolean | hasChanged() - cache has been updated since it was read
|
boolean | isFailedFont(String embedUrl, long lastModified) - has this font previously failed to load?
|
static FontCache | load() - Reads the default font cache file and returns its contents.
|
static FontCache | loadFrom(File cacheFile) - Reads a font cache file and returns its contents.
|
void | registerFailedFont(String embedUrl, long lastModified) - registers a failed font with the cache
|
void | removeFont(String embedUrl) - removes font from cache
|
void | save() - Writes the font cache to disk.
|
void | saveTo(File cacheFile) - Writes the font cache to disk.
|
FontCache
public FontCache()
Default constructor
addFont
public void addFont(EmbedFontInfo fontInfo)
adds a font info to cache
clear
public void clear()
Clears font cache
containsFont
public boolean containsFont(String embedUrl)
is this font in the cache?
containsFont
public boolean containsFont(EmbedFontInfo fontInfo)
is this font info in the cache?
getCacheKey
protected static String getCacheKey(EmbedFontInfo fontInfo)
creates a key given a font info for the font mapping
getDefaultCacheFile
public static File getDefaultCacheFile(boolean forWriting)
Returns the default font cache file.
forWriting
- true if the user directory should be created
- the default font cache file
getFont
public CachedFontInfo getFont(String embedUrl)
returns a font from the cache
hasChanged
public boolean hasChanged()
cache has been updated since it was read
- if this cache has changed
isFailedFont
public boolean isFailedFont(String embedUrl,
long lastModified)
has this font previously failed to load?
embedUrl
- embed urllastModified
- last modified
- whether this is a failed font
load
public static FontCache load()
Reads the default font cache file and returns its contents.
- the font cache deserialized from the file (or null if no cache file exists or if
it could not be read)
loadFrom
public static FontCache loadFrom(File cacheFile)
Reads a font cache file and returns its contents.
cacheFile
- the cache file
- the font cache deserialized from the file (or null if no cache file exists or if
it could not be read)
registerFailedFont
public void registerFailedFont(String embedUrl,
long lastModified)
registers a failed font with the cache
embedUrl
- embed urllastModified
- time last modified
removeFont
public void removeFont(String embedUrl)
removes font from cache
save
public void save()
throws FOPException
Writes the font cache to disk.
saveTo
public void saveTo(File cacheFile)
throws FOPException
Writes the font cache to disk.
cacheFile
- the file to write to
Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.