public final class FontLoader extends Object
| Constructor and Description |
|---|
FontLoader() |
| Modifier and Type | Method and Description |
|---|---|
void |
decommissionAllCaches()
This provides clients a way to remove caches from service.
|
boolean |
decommissionCache(File cacheFile)
This allows a single cache to be separately decomissioned.
|
boolean |
decommissionCachedFont(File fontFile)
This removes a single font file from all caches.
|
static FXGFontResolver |
getFXGFontResolverInstance()
Create a new empty
FXGNameResolver. |
static FXGFontResolver |
getFXGFontResolverInstance(FXGFontResolver original)
Create a copy of a
FXGNameResolver. |
static PlatformFontResolver |
getPlatformFontResolverInstance()
Create a new empty
PlatformNameResolver. |
static PlatformFontResolver |
getPlatformFontResolverInstance(FamilyNameNormalizer normalizer)
Create a new empty
PlatformNameResolver. |
static PlatformFontResolver |
getPlatformFontResolverInstance(PlatformFontResolver original)
Create a copy of a
PlatformNameResolver. |
static PSNameResolver |
getPSNameResolverInstance()
Create a new empty
PSNameResolver. |
static PSNameResolver |
getPSNameResolverInstance(FamilyNameNormalizer normalizer)
Create a new empty
PSNameResolver. |
static PSNameResolver |
getPSNameResolverInstance(PSNameResolver original)
Create a copy of a
PSNameResolver. |
Font[] |
load(File f,
boolean recurseDirectories,
List exceptions)
Creates Font objects for all fonts in a file or directory represented by f.
|
Font[] |
load(File f,
boolean recurseDirectories,
List exceptions,
List badUrls)
Creates Font objects for all fonts in a file or directory represented by f.
|
Font[] |
load(File f,
boolean recurseDirectories,
List exceptions,
List badUrls,
File cacheFile)
The new font cache support code starts here, although some supporting changes have also been
made in code above here.
|
Font |
load(InputStream inputStream,
int length,
boolean wasEmbedded)
Creates a Font object from an InputStream and data describing
the font.
|
Font |
load(PDFSimpleFontValuesAccessor accessor)
Creates a Font object from a PDF /Font object with subtype /Type1.
|
Font[] |
load(URL url)
Creates Font objects from a URL.
|
Font[] |
load(URL[] url,
List exceptions)
Creates Font objects from an array of URL.
|
Font[] |
load(URL[] url,
List exceptions,
List badUrls)
Creates Font objects from an array of URL.
|
void |
saveAllCaches(boolean clean)
The cache files MUST be explictly save by the client.
|
boolean |
saveCache(File cacheFile,
boolean clean)
The inner loop, publically available, that saves just one cache file
|
public static PSNameResolver getPSNameResolverInstance()
PSNameResolver.
PSNameResolver interface that is returned from this method offers some tighter
thread safety guarantees than that guaranteed by the PSNameResolver interface. It is safe
to use the PSNameResolver
object for font resolution from multiple threads at one time as long as the methods which
change the state of the PSNameResolver object are not called at any time that
it may be being used for font resolution. There is no mechanism
within PSNameResolver or
FontLoader to guarantee that this doesn't occur. A client program can guarantee this by modifying the
PSNameResolver object fully before giving it to one or more
threads. A client program could also use some synchronization constructs of its own to guarantee this.
This means that the addFont() and setResolutionPriority() methods can not
be called while there is any chance that the PSNameResolver
object may be being used for font resolution.
It is also safe to copy this PSNameResolver object except when it is possible that it may be being modified.
It is again the responsibility of the client to ensure that this doesn't happen.public static PSNameResolver getPSNameResolverInstance(FamilyNameNormalizer normalizer)
PSNameResolver.
This method allows a client to specify a
FamilyNameNormalizer object
that is used to modify the font family name of every Font object
added to the PSNameResolver. It is also used to modify the font names inside of any search request.
PSNameResolver interface that is returned from this method offers some tighter
thread safety guarantees than that guaranteed by the PSNameResolver interface. It is safe
to use the PSNameResolver
object for font resolution from multiple threads at one time as long as the methods which
change the state of the PSNameResolver object are not called at any time that
it may be being used for font resolution. There is no mechanism
within PSNameResolver or
FontLoader to guarantee that this doesn't occur. A client program can guarantee this by modifying the
PSNameResolver object fully before giving it to one or more
threads. A client program could also use some synchronization constructs of its own to guarantee this.
This means that the addFont() and setResolutionPriority() methods can not
be called while there is any chance that the PSNameResolver
object may be being used for font resolution.
It is also safe to copy this PSNameResolver object except when it is possible that it may be being modified.
It is again the responsibility of the client to ensure that this doesn't happen.normalizer - A FamilyNameNormalizer
used for adjusting font family names.public static PSNameResolver getPSNameResolverInstance(PSNameResolver original)
PSNameResolver.
PSNameResolver interface that is returned from this method offers some tighter
thread safety guarantees than that guaranteed by the PSNameResolver interface. It is safe
to use the PSNameResolver
object for font resolution from multiple threads at one time as long as the methods which
change the state of the PSNameResolver object are not called at any time that
it may be being used for font resolution. There is no mechanism
within PSNameResolver or
FontLoader to guarantee that this doesn't occur. A client program can guarantee this by modifying the
PSNameResolver object fully before giving it to one or more
threads. A client program could also use some synchronization constructs of its own to guarantee this.
This means that the addFont() and setResolutionPriority() methods can not
be called while there is any chance that the PSNameResolver
object may be being used for font resolution.
It is also safe to copy this PSNameResolver object except when it is possible that it may be being modified.
It is again the responsibility of the client to ensure that this doesn't happen.original - the PSNameResolver to copypublic static PlatformFontResolver getPlatformFontResolverInstance()
PlatformNameResolver.
PSNameResolver interface that is returned from this method offers some tighter
thread safety guarantees than that guaranteed by the PSNameResolver interface. It is safe
to use the PSNameResolver
object for font resolution from multiple threads at one time as long as the methods which
change the state of the PSNameResolver object are not called at any time that
it may be being used for font resolution. There is no mechanism
within PSNameResolver or
FontLoader to guarantee that this doesn't occur. A client program can guarantee this by modifying the
PSNameResolver object fully before giving it to one or more
threads. A client program could also use some synchronization constructs of its own to guarantee this.
This means that the addFont() and setResolutionPriority() methods can not
be called while there is any chance that the PSNameResolver
object may be being used for font resolution.
It is also safe to copy this PSNameResolver object except when it is possible that it may be being modified.
It is again the responsibility of the client to ensure that this doesn't happen.public static PlatformFontResolver getPlatformFontResolverInstance(PlatformFontResolver original)
PlatformNameResolver.
PSNameResolver interface that is returned from this method offers some tighter
thread safety guarantees than that guaranteed by the PSNameResolver interface. It is safe
to use the PSNameResolver
object for font resolution from multiple threads at one time as long as the methods which
change the state of the PSNameResolver object are not called at any time that
it may be being used for font resolution. There is no mechanism
within PSNameResolver or
FontLoader to guarantee that this doesn't occur. A client program can guarantee this by modifying the
PSNameResolver object fully before giving it to one or more
threads. A client program could also use some synchronization constructs of its own to guarantee this.
This means that the addFont() and setResolutionPriority() methods can not
be called while there is any chance that the PSNameResolver
object may be being used for font resolution.
It is also safe to copy this PSNameResolver object except when it is possible that it may be being modified.
It is again the responsibility of the client to ensure that this doesn't happen.original - the PlatformFontResolver to copypublic static PlatformFontResolver getPlatformFontResolverInstance(FamilyNameNormalizer normalizer)
PlatformNameResolver.
PSNameResolver interface that is returned from this method offers some tighter
thread safety guarantees than that guaranteed by the PSNameResolver interface. It is safe
to use the PSNameResolver
object for font resolution from multiple threads at one time as long as the methods which
change the state of the PSNameResolver object are not called at any time that
it may be being used for font resolution. There is no mechanism
within PSNameResolver or
FontLoader to guarantee that this doesn't occur. A client program can guarantee this by modifying the
PSNameResolver object fully before giving it to one or more
threads. A client program could also use some synchronization constructs of its own to guarantee this.
This means that the addFont() and setResolutionPriority() methods can not
be called while there is any chance that the PSNameResolver
object may be being used for font resolution.
It is also safe to copy this PSNameResolver object except when it is possible that it may be being modified.
It is again the responsibility of the client to ensure that this doesn't happen.normalizer - A FamilyNameNormalizer
used for adjusting platform font family names.public static FXGFontResolver getFXGFontResolverInstance()
FXGNameResolver.
PSNameResolver interface that is returned from this method offers some tighter
thread safety guarantees than that guaranteed by the PSNameResolver interface. It is safe
to use the PSNameResolver
object for font resolution from multiple threads at one time as long as the methods which
change the state of the PSNameResolver object are not called at any time that
it may be being used for font resolution. There is no mechanism
within PSNameResolver or
FontLoader to guarantee that this doesn't occur. A client program can guarantee this by modifying the
PSNameResolver object fully before giving it to one or more
threads. A client program could also use some synchronization constructs of its own to guarantee this.
This means that the addFont() and setResolutionPriority() methods can not
be called while there is any chance that the PSNameResolver
object may be being used for font resolution.
It is also safe to copy this PSNameResolver object except when it is possible that it may be being modified.
It is again the responsibility of the client to ensure that this doesn't happen.public static FXGFontResolver getFXGFontResolverInstance(FXGFontResolver original)
FXGNameResolver.
PSNameResolver interface that is returned from this method offers some tighter
thread safety guarantees than that guaranteed by the PSNameResolver interface. It is safe
to use the PSNameResolver
object for font resolution from multiple threads at one time as long as the methods which
change the state of the PSNameResolver object are not called at any time that
it may be being used for font resolution. There is no mechanism
within PSNameResolver or
FontLoader to guarantee that this doesn't occur. A client program can guarantee this by modifying the
PSNameResolver object fully before giving it to one or more
threads. A client program could also use some synchronization constructs of its own to guarantee this.
This means that the addFont() and setResolutionPriority() methods can not
be called while there is any chance that the PSNameResolver
object may be being used for font resolution.
It is also safe to copy this PSNameResolver object except when it is possible that it may be being modified.
It is again the responsibility of the client to ensure that this doesn't happen.original - the PSNameResolver to copypublic Font[] load(URL url) throws FontLoadingException, InvalidFontException, UnsupportedFontException
url - The url of the font data. OpenType, TrueType, and Type1 fonts
are the only acceptable input. In order to have predictible behavior,
url must be available and must point to the same data for the lifetime of the
returned Fonts. If the Font is added to a FontSet that is to be
serialized, the urls must remain unchanged for as long as the serialized data is to be used.FontLoadingException - thrown if the font data cannot be accessedInvalidFontException - thrown if the font data appears to represent a font, but
there is something about the data that cannot be understood and cannot be ignoredUnsupportedFontException - thrown if the font contains data that indicates that AFE cannot
support that category of fonts.public Font[] load(URL[] url, List exceptions)
url - The url of the font data. OpenType, TrueType and Type1 fonts and
metric files associated with the type1 fonts are the only acceptable input.
In order to have predictible behavior,
url must be available and must point to the same data for the lifetime of the
returned Fonts. If the Font is added to a FontSet that is to be
serialized, the urls must remain unchanged for as long as the serialized data is to be used.exceptions - Any exceptions that are encountered during the loading process will added
to the provided List. This can be a null if the caller doesn't want to
know about the exceptions that occured.public Font[] load(URL[] url, List exceptions, List badUrls)
url - The url of the font data. OpenType, TrueType and Type1 fonts and
metric files associated with the type1 fonts are the only acceptable input.
In order to have predictible behavior,
url must be available and must point to the same data for the lifetime of the
returned Fonts. If the Font is added to a FontSet that is to be
serialized, the urls must remain unchanged for as long as the serialized data is to be used.exceptions - Any exceptions that are encountered during the loading process will added
to the provided List. This can be a null if the caller doesn't want to
know about the exceptions that occured.badUrls - The URLs causing any exception are recorded here. These are in
1 to 1 alignment with the exceptions returned. This can be a null if the
caller doesn't want to know about the bad URLs that occured.public Font load(InputStream inputStream, int length, boolean wasEmbedded) throws FontLoadingException
inputStream - The input stream containing the font data. This stream will be read from
to create the Font. After returning from this method the stream will not
be accessed again and it is the responsibilty of the caller to close this stream.length - The number of bytes in the InputStream.wasEmbedded - true iff this font is embedded in a document. This affects the way
this font can be used. See Technote 5147 "Font Embedding Guidelines for Adobe Third-party
Developers" for more information.FontLoadingExceptionpublic Font[] load(File f, boolean recurseDirectories, List exceptions)
f - The root directory or file to be read in.
Only host font formats (OpenType, TrueType, or Type1) will
be processed by this api. In order to have predictible behavior,
the files pointed to by f must be available and must point to the
same data for the lifetime of the returned Font.If these fonts become part
of serialized font sets, f (and its subdirectories, if they are recursively searched) must be
accessible from all servers sharing the serialized data. Likewise, the contents of f
must not change for as long as the serialized data is to be used.recurseDirectories - if f is a directory, recurseDirectories specifies whether
load should recursively walk all subdirectories. If true, the recursion happens. It
does not if recurseDirectories is false. This parameter is ignored if f is not a directory.exceptions - Any exceptions that are encountered during the loading process will added
to the provided List. This can be a null if the caller doesn't want to
know about the exceptions that occured.public Font[] load(File f, boolean recurseDirectories, List exceptions, List badUrls)
f - The root directory or file to be read in.
Only host font formats (OpenType, TrueType, or Type1) will
be processed by this api. In order to have predictible behavior,
the files pointed to by f must be available and must point to the
same data for the lifetime of the returned Font.If these fonts become part
of serialized font sets, f (and its subdirectories, if they are recursively searched) must be
accessible from all servers sharing the serialized data. Likewise, the contents of f
must not change for as long as the serialized data is to be used.recurseDirectories - if f is a directory, recurseDirectories specifies whether
load should recursively walk all subdirectories. If true, the recursion happens. It
does not if recurseDirectories is false. This parameter is ignored if f is not a directory.exceptions - Any exceptions that are encountered during the loading process will added
to the provided List. This can be a null if the caller doesn't want to
know about the exceptions that occured.badUrls - If any exceptions are encountered during the loading process then the URL which
casued the exception is recorded in this List. It is in 1 to 1 correlation with the exceptions
returned in the exceptions List. This can be a null if the caller doesn't want to
know about the bad URLs that occured.public Font load(PDFSimpleFontValuesAccessor accessor) throws InvalidFontException, UnsupportedFontException
accessor - an object through which the PDF keys will be accessed.InvalidFontExceptionUnsupportedFontExceptionpublic Font[] load(File f, boolean recurseDirectories, List exceptions, List badUrls, File cacheFile)
public void saveAllCaches(boolean clean)
throws IOException
IOExceptionpublic boolean saveCache(File cacheFile, boolean clean) throws IOException
IOExceptionpublic boolean decommissionCachedFont(File fontFile) throws IOException
IOExceptionpublic void decommissionAllCaches()
public boolean decommissionCache(File cacheFile)
Copyright © 2010 - 2020 Adobe. All Rights Reserved