|
aXSL API 0.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
FontServer provides some basic system-wide services such as listing available fonts.
Notes to creating implementations of FontServer:
Method Summary | |
boolean |
fontOutputFactoryAvailable(java.lang.String mime)
Reports on the availability of FontOutputFactory instances by
mime-type. |
Font[] |
getAllFonts(boolean freeStandingFonts,
boolean systemFonts)
Returns an array of all Font instances. |
Encoding |
getEncoding(java.lang.String name)
Returns an Encoding instance for the given name. |
java.lang.String |
getFontFamilyForAlias(java.lang.String alias)
Finds the font-family that is associated with a given font-family alias. |
java.lang.String[] |
getSystemFontFamilyList()
Exposes the list of font families registered with the operating system. |
java.awt.Font[] |
getSystemFontList()
Exposes the list of fonts registered with the operating system. |
boolean |
isRegisteredFont(java.lang.String fontID)
Indicates whether a font has already been registered for use by the system. |
boolean |
isRegisteredFontFamily(java.lang.String name)
Indicates whether a font-family has already been registered for use by the system. |
FontConsumer |
makeFontConsumer()
Creates an implementation-specific FontConsumer instance. |
void |
registerFont(java.lang.String fontID,
java.lang.String fontFileDescription,
byte[] fontFileContents,
java.lang.String metricsFileDescription,
byte[] metricsFileContents,
java.lang.String collectionID,
java.lang.String embed,
java.lang.String systemName)
Register a font for use by the system. |
void |
registerFont(java.lang.String fontID,
java.net.URL fontFileURL,
java.net.URL metricsFileURL,
java.lang.String collectionID,
java.lang.String embed,
java.lang.String systemName)
Register a font for use by the system. |
void |
registerFontDescription(java.lang.String fontFamily,
java.lang.String fontID,
Encoding encoding,
byte style,
short weight,
byte variant,
byte stretch,
float simulatedSmallCaps,
float simulatedOblique,
float simulatedBackslant,
float[] simulatedStretch)
Register a font description for use by the system. |
void |
registerFontFamily(java.lang.String name)
Register a font-family for use by the system. |
void |
registerFontFamilyAlias(java.lang.String alias,
java.lang.String realFamily)
Add a font-family alias. |
void |
registerFontOutputFactory(FontOutputFactory factory)
Registers a FontOutputFactory for use by this server. |
Method Detail |
public Font[] getAllFonts(boolean freeStandingFonts, boolean systemFonts)
freeStandingFonts
- Set to true to include free-standing fonts in
the returned array.systemFonts
- Set to true to include system fonts in the returned
array.
public java.lang.String[] getSystemFontFamilyList()
public java.awt.Font[] getSystemFontList()
public Encoding getEncoding(java.lang.String name)
name
- The name of the Encoding instance that is sought.
public void registerFontOutputFactory(FontOutputFactory factory) throws FontException
FontOutputFactory
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.
FontException
- If the factory cannot be registered.public boolean fontOutputFactoryAvailable(java.lang.String mime)
FontOutputFactory
instances by
mime-type.
mime
- The mime-type for which a factory is sought.
public void registerFontFamily(java.lang.String name) throws FontException
name
- The name of the font-family (e.g. "Courier").
FontException
- If the font-family is already registered.public boolean isRegisteredFontFamily(java.lang.String name)
name
- The name of the font-family (e.g. "Courier").
public void registerFontFamilyAlias(java.lang.String alias, java.lang.String realFamily) throws FontException
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").
FontException
- If the font-family alias is already registered, or
if realFamily
is not a registered font-family.public java.lang.String getFontFamilyForAlias(java.lang.String alias)
alias
- The name of the font-family alias.
alias
.public void registerFont(java.lang.String fontID, java.net.URL fontFileURL, java.net.URL metricsFileURL, java.lang.String collectionID, java.lang.String embed, java.lang.String systemName) throws FontException
fontID
- A unique ID for this font (e.g. "Courier-Bold").fontFileURL
- URL to the file containing the font.metricsFileURL
- URL to the file containing the font metrics. This
is null for TrueType and OpenType fonts.collectionID
- For TrueType collections, indicates which font in
the collection corresponds to this font.embed
- One of "none", "all", or "subset", indicating whether this
font should be embedded in output documents.systemName
- For system fonts only, this is the name that should be
supplied to the operating system font registry to obtain the font from
it. For other fonts, set this to null.
FontException
- If a font with this fontID
is already
registered.public void registerFont(java.lang.String fontID, java.lang.String fontFileDescription, byte[] fontFileContents, java.lang.String metricsFileDescription, byte[] metricsFileContents, java.lang.String collectionID, java.lang.String embed, java.lang.String systemName) throws FontException
registerFont(String, URL, URL, String, String, String)
intended for situations where a font's contents have been extracted from
a document.
fontID
- A unique ID for this font (e.g. "Courier-Bold").fontFileDescription
- A description of the font file. This is used
primarily in user messages. (The overloaded method that takes URLs just
uses the path of the URL for descriptive user messages).fontFileContents
- Byte array containing the font file contents.metricsFileDescription
- A description of the metrics file. This is
used primarily in user messages. (The overloaded method that takes URLs
just uses the path of the URL for descriptive user messages).metricsFileContents
- Byte array containing the metrics contents.
This is null for TrueType and OpenType fonts.collectionID
- For TrueType collections, indicates which font in
the collection corresponds to this font.embed
- One of "none", "all", or "subset", indicating whether this
font should be embedded in output documents.systemName
- For system fonts only, this is the name that should be
supplied to the operating system font registry to obtain the font from
it. For other fonts, set this to null.
FontException
- If a font with this fontID
is already
registered.public boolean isRegisteredFont(java.lang.String fontID)
fontID
- The unique font ID for the font (e.g. "Courier-Bold").
fontID
is already
registered.public void registerFontDescription(java.lang.String fontFamily, java.lang.String fontID, Encoding encoding, byte style, short weight, byte variant, byte stretch, float simulatedSmallCaps, float simulatedOblique, float simulatedBackslant, float[] simulatedStretch) throws FontException
fontFamily
- The name of the font-family in which this font should
be registered.fontID
- The font ID for the font that should be registered.encoding
- The encoding, if any, that should be used by this
font description. Set this value to null unless you wish to override
the encoding for this font.style
- One of Font.FONT_STYLE_NORMAL
,
Font.FONT_STYLE_ITALIC
,
Font.FONT_STYLE_OBLIQUE
, or
Font.FONT_STYLE_BACKSLANT
.weight
- One of Font.FONT_WEIGHT_NORMAL
,
Font.FONT_WEIGHT_BOLD
,
Font.FONT_WEIGHT_100
,
Font.FONT_WEIGHT_200
,
Font.FONT_WEIGHT_300
,
Font.FONT_WEIGHT_400
,
Font.FONT_WEIGHT_500
,
Font.FONT_WEIGHT_600
,
Font.FONT_WEIGHT_700
,
Font.FONT_WEIGHT_800
,or
Font.FONT_WEIGHT_900
.variant
- One of Font.FONT_VARIANT_NORMAL
, or
Font.FONT_VARIANT_SMALL_CAPS
.stretch
- One of Font.FONT_STRETCH_ULTRA_CONDENSED
,
Font.FONT_STRETCH_EXTRA_CONDENSED
,
Font.FONT_STRETCH_CONDENSED
,
Font.FONT_STRETCH_SEMI_CONDENSED
,
Font.FONT_STRETCH_NORMAL
,
Font.FONT_STRETCH_SEMI_EXPANDED
,
Font.FONT_STRETCH_EXPANDED
,
Font.FONT_STRETCH_EXTRA_EXPANDED
, or
Font.FONT_STRETCH_ULTRA_EXPANDED
.simulatedSmallCaps
- To prevent this font-description from being
used to simulate small-caps, set this value to Float.NaN
.
Otherwise, set it to the percentage which should be applied to the
font-size for the small caps. For example, if set to 80%, and the
font-size is 12 points, the resulting small-caps will be presented at
9.6 points.simulatedOblique
- To prevent this font-description from being
used to simulate oblique, set this value to Float.NaN
.
Otherwise, set it to the number of degrees clockwise that the font should
be skewed to simulate oblique.simulatedBackslant
- To prevent this font-description from being
used to simulate backslant, set this value to Float.NaN
.
Otherwise, set it to the number of degrees counterclockwise that the font
should be skewed to simulate backslant.simulatedStretch
- Array containing percentages by which the font
should be stretched horizontally for various font-stretch values.
Values greater than 100 will result in wider characters.
Values less than 100 will result in narrower characters.
Invalid or unset amounts are indicated by the value Float.NaN
.
Element 0 corresponds to ultra-condensed (the narrowest value), and
element 7 corresponds to ultra-expanded (the widest value).
Note that there is no element for "normal", since that does not need to
be simulated.
FontException
- If fontFamily
or fontID
are not already registered.public FontConsumer makeFontConsumer()
FontConsumer
instance.
FontConsumer
instance.
|
aXSL API 0.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This documentation was created September 6 2006 by The aXSL Group and may be freely copied. See license for details.