|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.foray.font.FontServer4a
public class FontServer4a
An implementation of the aXSL FontServer
interface.
It is designed to be a singleton, but is not required to be so.
Field Summary |
---|
Fields inherited from interface org.axsl.font.FontServer |
---|
OBLIQUE_SIMULATION_INVALID, SMALL_CAP_SIMULATION_INVALID, SMALL_CAP_SIMULATION_NATIVE, STRETCH_SIMULATION_INVALID |
Constructor Summary | |
---|---|
FontServer4a()
Zero-argument constructor used for resource discovery purposes. |
|
FontServer4a(org.apache.commons.logging.Log logger,
org.axsl.ps.PsServer psServer)
Constructor. |
Method Summary | |
---|---|
boolean |
fontOutputFactoryAvailable(String mimeType)
Reports on the availability of FontOutputFactory4a instances
by mime-type. |
List<org.axsl.font.Font> |
getAllFonts(boolean freeStandingFonts,
boolean systemFonts)
|
URL |
getBaseFontURL()
Returns the base URL used for finding font files. |
protected URL |
getBaseURL()
Returns the base general URL. |
protected RegisteredFontDesc |
getDefaultFont(boolean freeStandingFont)
Finds a default registered font. |
RegisteredFontDesc |
getDefaultFreeStandingFont()
Returns the fallback free-standing font when no other font can be used. |
protected RegisteredFontDesc |
getDefaultSystemFont()
Returns the fallback system font when no other font can be used. |
org.axsl.ps.Encoding |
getEncoding(String name)
|
EntityResolver |
getEntityResolver()
Returns the EntityResolver for this server. |
String |
getFontFamilyForAlias(String alias)
|
protected Graphics2D |
getGraphics2D()
Returns a graphics environment. |
org.apache.commons.logging.Log |
getLogger()
Returns the logger that should be used as the system logger. |
FontOutputFactory4a |
getOutputFactory(String mimeType)
Returns the output factory for a given mime type. |
org.axsl.ps.PsServer |
getPsServer()
Returns the PostScript server. |
RegisteredFont |
getRegisteredFont(String name)
Returns the font registered to a given name. |
RegisteredFontFamily |
getRegisteredFontFamily(String fontFamilyName)
Returns a named registered font family. |
List<String> |
getSystemFontFamilyList()
|
List<Font> |
getSystemFontList()
|
boolean |
isRegisteredFont(String fontID)
|
boolean |
isRegisteredFontFamily(String name)
|
boolean |
isRegisteredFontFamilyAlias(String alias)
Indicates whether a given String has been registered as a font-family alias. |
FontConsumer4a |
makeFontConsumer()
|
FontSelector |
makeFontSelector(FontConsumer4a consumer)
Returns the font-selector that should be used by a given font consumer. |
Collection<RegisteredFontFamily> |
registeredFontFamilies()
Returns the collection of registered font-family instances. |
void |
registerFont(String fontID,
DataSource fontFileSource,
DataSource metricsFileSource,
String collectionID,
org.axsl.font.Font.Embedding requestedEmbedding,
String systemName)
|
void |
registerFont(String fontID,
RegisteredFont rf)
Maps a given font name to its related RegisteredFont instance. |
void |
registerFontDescription(String fontFamily,
String fontID,
org.axsl.ps.Encoding encoding,
org.axsl.font.Font.Style style,
org.axsl.font.Font.Weight weight,
org.axsl.font.Font.Variant variant,
org.axsl.font.Font.Stretch stretch,
float simulatedSmallCaps,
float simulatedOblique,
float simulatedBackslant,
float[] simulatedStretch)
|
void |
registerFontFamily(String name)
|
RegisteredFontFamily |
registerFontFamily2(String name)
Add a RegisteredFontFamily to the Collection. |
void |
registerFontFamilyAlias(String alias,
String realFamily)
Add an alias to a RegisteredFontFamily. |
void |
registerFontOutputFactory(FontOutputFactory4a factory)
Registers a FontOutputFactory4a for use by this server. |
void |
registerFontSelectorFactory(String name,
FontSelectorFactory factory)
Register a FontSelectorFactory for use in the font system. |
protected void |
registerStandardOutputFactories()
Registers each of the standard output factories. |
void |
setBaseFontURL(URL url)
Set the base URL for Font locations, unless it has already been set. |
void |
setBaseURL(URL url)
Set the base URL for general resources, unless it has already been set. |
void |
setEntityResolver(EntityResolver entityResolver)
Sets the EntityResolver for this server. |
void |
setFatalConfigurationError(boolean hasError)
Use this method to indicate that a configuration error has occurred which cannot be recovered. |
void |
setup(InputStream fontConfigFile,
Map<String,String> fontConfigOptions)
Registers the FreeStanding fonts that are available based on font configuration file and options. |
void |
setUsingFreeStandingFonts(boolean using)
Set parameter determining whether FreeStanding fonts will be setup. |
void |
setUsingSystemFonts(boolean using)
Set parameter determining whether System fonts will be setup. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FontServer4a(org.apache.commons.logging.Log logger, org.axsl.ps.PsServer psServer)
logger
- The Logger to be used for system-level messages. Please
note that the FontConsumer also has a method for obtaining a Logger
instance. These two instances can be the same, or, if desired,
system-level messages can be logged to the FontServer logger, and
messages that are more client-related can be logged to the FontConsumer
logger.psServer
- The PostScript server.public FontServer4a()
FontServer4a(Log, PsServer)
.
Method Detail |
---|
protected void registerStandardOutputFactories() throws org.axsl.font.FontException
org.axsl.font.FontException
- For an invalid factory.public RegisteredFontFamily getRegisteredFontFamily(String fontFamilyName)
fontFamilyName
- The font family being sought.
public RegisteredFontDesc getDefaultFreeStandingFont()
protected RegisteredFontDesc getDefaultSystemFont()
protected RegisteredFontDesc getDefaultFont(boolean freeStandingFont)
freeStandingFont
- Indicates whether free-standing fonts should be
sought or system fonts (mutually exclusive).
public void setBaseURL(URL url)
url
- The base URL for general resources.protected URL getBaseURL()
public void setBaseFontURL(URL url)
url
- The base URL for fonts.public URL getBaseFontURL()
public void setup(InputStream fontConfigFile, Map<String,String> fontConfigOptions) throws org.axsl.font.FontException
fontConfigFile
- The URL for the font configuration file that should
be used during setup.fontConfigOptions
- An optional Map of font configuration options.
Implementations that do not wish to use this should simply ignore it.
Clients that do not wish to use it should pass null.
This can be used for any purpose, but is intended primarily to allow
an implementation to allow keys to be embedded in font configuration
files, and then to replace those keys with the mapped value during
parsing.
org.axsl.font.FontException
- on font configuration error.protected Graphics2D getGraphics2D()
public RegisteredFontFamily registerFontFamily2(String name) throws org.axsl.font.FontException
name
- the name of the font family (e.g. "Courier")
org.axsl.font.FontException
- If the font-family is already registered.public void registerFontFamilyAlias(String alias, String realFamily) throws org.axsl.font.FontException
registerFontFamilyAlias
in interface org.axsl.font.FontServer
alias
- The name of the font family alias (e.g. "sans-serif").realFamily
- The name of the real font family to which this alias
should be associated (e.g. "Helvetica").
org.axsl.font.FontException
- If the realFamily
does not exist, or
if the alias is already registered to another font-family.public org.apache.commons.logging.Log getLogger()
getLogger
in interface FontParserClient
public void setUsingFreeStandingFonts(boolean using)
using
- When true, FreeStanding fonts will be configured.public void setUsingSystemFonts(boolean using)
using
- When true, System fonts will be configured.public void setFatalConfigurationError(boolean hasError)
hasError
- Set to true to indicate that the server configuration
is so bad that the server should not be used.public List<String> getSystemFontFamilyList()
getSystemFontFamilyList
in interface org.axsl.font.FontServer
public List<Font> getSystemFontList()
getSystemFontList
in interface org.axsl.font.FontServer
public org.axsl.ps.Encoding getEncoding(String name)
getEncoding
in interface org.axsl.font.FontServer
public List<org.axsl.font.Font> getAllFonts(boolean freeStandingFonts, boolean systemFonts)
getAllFonts
in interface org.axsl.font.FontServer
public EntityResolver getEntityResolver()
public void setEntityResolver(EntityResolver entityResolver)
entityResolver
- The new EntityResolver.public void registerFontOutputFactory(FontOutputFactory4a factory)
FontOutputFactory4a
for use by this server.
This method can be used both to support custom FontOutput
types and to override standard types.
Note that if a factory was previously registered for the mime-type
of the factory now being registered, the new registration overrides the
previous registration.
If this behavior is not desired, check the return value of
fontOutputFactoryAvailable(String)
before registering the new
factory.
factory
- The factory which should be registered.public FontOutputFactory4a getOutputFactory(String mimeType)
mimeType
- The mime type for which an output factory is desired.
public boolean fontOutputFactoryAvailable(String mimeType)
FontOutputFactory4a
instances
by mime-type.
mimeType
- The mime-type for which a factory is sought.
public void registerFontFamily(String name) throws org.axsl.font.FontException
registerFontFamily
in interface org.axsl.font.FontServer
org.axsl.font.FontException
public boolean isRegisteredFontFamily(String name)
isRegisteredFontFamily
in interface org.axsl.font.FontServer
public String getFontFamilyForAlias(String alias)
getFontFamilyForAlias
in interface org.axsl.font.FontServer
public boolean isRegisteredFontFamilyAlias(String alias)
alias
- The alias which is being tested.
public void registerFont(String fontID, DataSource fontFileSource, DataSource metricsFileSource, String collectionID, org.axsl.font.Font.Embedding requestedEmbedding, String systemName) throws org.axsl.font.FontException
registerFont
in interface org.axsl.font.FontServer
org.axsl.font.FontException
public RegisteredFont getRegisteredFont(String name)
name
- The name of the font being sought.
public void registerFont(String fontID, RegisteredFont rf) throws org.axsl.font.FontException
RegisteredFont
instance.
fontID
- The name of the font to be associated.rf
- The registered font instance to be associated with the name.
org.axsl.font.FontException
- If the fontID
is already registered.public boolean isRegisteredFont(String fontID)
isRegisteredFont
in interface org.axsl.font.FontServer
public void registerFontDescription(String fontFamily, String fontID, org.axsl.ps.Encoding encoding, org.axsl.font.Font.Style style, org.axsl.font.Font.Weight weight, org.axsl.font.Font.Variant variant, org.axsl.font.Font.Stretch stretch, float simulatedSmallCaps, float simulatedOblique, float simulatedBackslant, float[] simulatedStretch) throws org.axsl.font.FontException
registerFontDescription
in interface org.axsl.font.FontServer
org.axsl.font.FontException
public FontSelector makeFontSelector(FontConsumer4a consumer)
consumer
- The consumer for which a font-selector is needed.
public void registerFontSelectorFactory(String name, FontSelectorFactory factory) throws org.axsl.font.FontException
name
- The name by which this factory should be referred in
FontConsumer4a.setFontSelectorAutoType(String)
.factory
- The factory instance that should be used to create
FontSelectors for name
when requested.
org.axsl.font.FontException
- If either name
, or
factory
is invalid.public FontConsumer4a makeFontConsumer()
makeFontConsumer
in interface org.axsl.font.FontServer
public Collection<RegisteredFontFamily> registeredFontFamilies()
public org.axsl.ps.PsServer getPsServer()
getPsServer
in interface FontParserClient
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |