public final class FontCache
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
FontCache()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addFont(EmbedFontInfo fontInfo)
adds a font info to cache
|
void |
clear()
Clears font cache
|
boolean |
containsFont(EmbedFontInfo fontInfo)
is this font info in the cache?
|
boolean |
containsFont(java.lang.String embedUrl)
is this font in the cache?
|
protected static java.lang.String |
getCacheKey(EmbedFontInfo fontInfo)
creates a key given a font info for the font mapping
|
static java.io.File |
getDefaultCacheFile(boolean forWriting)
Returns the default font cache file.
|
CachedFontInfo |
getFont(java.lang.String embedUrl)
returns a font from the cache
|
boolean |
hasChanged()
cache has been updated since it was read
|
boolean |
isFailedFont(java.lang.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(java.io.File cacheFile)
Reads a font cache file and returns its contents.
|
void |
registerFailedFont(java.lang.String embedUrl,
long lastModified)
registers a failed font with the cache
|
void |
removeFont(java.lang.String embedUrl)
removes font from cache
|
void |
save()
Writes the font cache to disk.
|
void |
saveTo(java.io.File cacheFile)
Writes the font cache to disk.
|
public static java.io.File getDefaultCacheFile(boolean forWriting)
forWriting
- true if the user directory should be createdpublic static FontCache load()
public static FontCache loadFrom(java.io.File cacheFile)
cacheFile
- the cache filepublic void save() throws FOPException
FOPException
- fop exceptionpublic void saveTo(java.io.File cacheFile) throws FOPException
cacheFile
- the file to write toFOPException
- fop exceptionprotected static java.lang.String getCacheKey(EmbedFontInfo fontInfo)
fontInfo
- font infopublic boolean hasChanged()
public boolean containsFont(java.lang.String embedUrl)
embedUrl
- font infopublic boolean containsFont(EmbedFontInfo fontInfo)
fontInfo
- font infopublic void addFont(EmbedFontInfo fontInfo)
fontInfo
- font infopublic CachedFontInfo getFont(java.lang.String embedUrl)
embedUrl
- font infopublic void removeFont(java.lang.String embedUrl)
embedUrl
- embed urlpublic boolean isFailedFont(java.lang.String embedUrl, long lastModified)
embedUrl
- embed urllastModified
- last modifiedpublic void registerFailedFont(java.lang.String embedUrl, long lastModified)
embedUrl
- embed urllastModified
- time last modifiedpublic void clear()
Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.