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.
|
static java.io.File |
getFileFromUrls(java.lang.String[] urls)
Tries to identify a File instance from an array of URLs.
|
org.apache.fop.fonts.FontCache.CachedFontFile |
getFontFile(java.lang.String embedUrl)
Returns a font from the cache.
|
EmbedFontInfo[] |
getFontInfos(java.lang.String embedUrl,
long lastModified)
Returns the EmbedFontInfo instances belonging to a font file.
|
static long |
getLastModified(java.net.URL url)
Retrieve the last modified date/time of a URL.
|
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 static java.io.File getFileFromUrls(java.lang.String[] urls)
urls
- array of possible font urlspublic void addFont(EmbedFontInfo fontInfo)
fontInfo
- font infopublic org.apache.fop.fonts.FontCache.CachedFontFile getFontFile(java.lang.String embedUrl)
embedUrl
- font infopublic EmbedFontInfo[] getFontInfos(java.lang.String embedUrl, long lastModified)
embedUrl
- the font URLlastModified
- the last modified date/time of the font filepublic 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()
public static long getLastModified(java.net.URL url)
url
- the URLCopyright 1999-2010 The Apache Software Foundation. All Rights Reserved.