|
aXSL API 0.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FontConsumer
FontConsumer provides many of the font-related services that a client
application may require, such as font resolution (obtaining a
FontUse
instance to use),
and getting a collection of Font
and FontUse
instances
actually used.
A separate FontConsumer implementation should be obtained for each document or other item that uses fonts. FontConsumer keeps track of which fonts and glyphs have been used by each consumer. This provides the following benefits:
FontServer
implementation.
Field Summary | |
---|---|
static byte |
FONT_SOURCE_FREE_STANDING
Free standing fonts are those fonts which are available to the application through means other than the operating system. |
static byte |
FONT_SOURCE_SYSTEM
System fonts are those fonts which are available to the application through the operating system. |
Method Summary | |
---|---|
Font[] |
getUsedFonts()
Returns an array of the Font instances that have been used by
this FontConsumer. |
FontUse[] |
getUsedFontUses()
Returns an array of the FontUse instances that have been used by
this FontConsumer. |
void |
optimizeFonts()
Optimizes the fonts used by this FontConsumer. |
FontUse |
selectFontCss(java.lang.String[] familyList,
Font.Style style,
Font.Weight weight,
Font.Variant variant,
Font.Stretch stretch,
int size,
int codePoint)
The same as selectFontXsl(org.axsl.font.Font.SelectionStrategy, java.lang.String[], org.axsl.font.Font.Style, org.axsl.font.Font.Weight, org.axsl.font.Font.Variant, org.axsl.font.Font.Stretch, int, int) , except that the algorithm specified
by CSS 2.1 is used instead. |
FontUse |
selectFontPanose(byte[] panose,
int codePoint)
Accepts the client's PANOSE description of the desired font, and returns the best-fitting Font found. |
FontUse |
selectFontXsl(Font.SelectionStrategy selectionStrategy,
java.lang.String[] familyList,
Font.Style style,
Font.Weight weight,
Font.Variant variant,
Font.Stretch stretch,
int size,
int codePoint)
Accepts the client's description of the desired font, and returns the best-fitting Font found, using the algorithm specified by the XSL-FO 1.1 Standard. |
void |
setFontSources(int[] fontSources)
Sets the font sources that can be selected for this FontConsumer. |
Field Detail |
---|
static final byte FONT_SOURCE_FREE_STANDING
static final byte FONT_SOURCE_SYSTEM
Method Detail |
---|
FontUse selectFontXsl(Font.SelectionStrategy selectionStrategy, java.lang.String[] familyList, Font.Style style, Font.Weight weight, Font.Variant variant, Font.Stretch stretch, int size, int codePoint) throws FontException
selectionStrategy
- One of
Font.SelectionStrategy.CHARACTER_BY_CHARACTER
(for
"character-by-character" selection) or
Font.SelectionStrategy.AUTO
(for "auto" selection").familyList
- An array of possible font family names from which to
choose the font.
The most desirable font-family name is listed first, then the next
most desirable, etc.
Elements should not contain leading or trailing quotation marks or
spaces.
Client applications may use FontUtility.foFontFamily(String)
to
convert String input into the value expected here.style
- The style of the font desired. Valid values are
Font.Style.NORMAL
, Font.Style.ITALIC
,
Font.Style.OBLIQUE
, and Font.Style.BACKSLANT
.
Client applications may use FontUtility.foFontStyle(String,
boolean)
to convert String input into the value expected here.weight
- The weight of the font desired. Valid values are
Font.Weight.EXTREMELY_LIGHT
, Font.Weight.VERY_LIGHT
,
Font.Weight.LIGHT
, Font.Weight.NORMAL
,
Font.Weight.DARK
, Font.Weight.SEMI_BOLD
,
Font.Weight.BOLD
, Font.Weight.EXTRA_BOLD
, or
Font.Weight.BLACK
.
Client applications may use FontUtility.foFontWeight(String,
boolean)
to convert String input into the value expected here.variant
- The variant (normal or small-caps) of the font desired.
Valid values are Font.Variant.NORMAL
and
Font.Variant.SMALL_CAPS
.
Client applications may use FontUtility.foFontVariant(String,
boolean)
to convert String input into the value expected here.stretch
- The stretch (normal, condensed, expanded, etc.) of the
font desired. Valid values Font.Stretch.ULTRA_CONDENSED
,
Font.Stretch.EXTRA_CONDENSED
,
Font.Stretch.CONDENSED
,
Font.Stretch.SEMI_CONDENSED
,
Font.Stretch.NORMAL
,
Font.Stretch.SEMI_EXPANDED
,
Font.Stretch.EXPANDED
,
Font.Stretch.EXTRA_EXPANDED
,
Font.Stretch.ULTRA_EXPANDED
.
Client applications may use FontUtility.foFontStretch(String,
boolean)
to convert String input into the value expected here.size
- The size (in millipoints) of the font.
This is only meaningful for bitmapped fonts.codePoint
- The first character to be painted using the selected
FontUse
.
This allows the selection process to avoid selecting a FontUse
that cannot even paint the first character.
FontUse
instance associated with the
descriptive input.
FontException
- if there is no matching font.selectFontCss(java.lang.String[], org.axsl.font.Font.Style, org.axsl.font.Font.Weight, org.axsl.font.Font.Variant, org.axsl.font.Font.Stretch, int, int)
FontUse selectFontCss(java.lang.String[] familyList, Font.Style style, Font.Weight weight, Font.Variant variant, Font.Stretch stretch, int size, int codePoint) throws FontException
selectFontXsl(org.axsl.font.Font.SelectionStrategy, java.lang.String[], org.axsl.font.Font.Style, org.axsl.font.Font.Weight, org.axsl.font.Font.Variant, org.axsl.font.Font.Stretch, int, int)
, except that the algorithm specified
by CSS 2.1 is used instead.
Note also that CSS has no concept of a font-selection-strategy as XSL-FO
does.
familyList
- See selectFontXsl(org.axsl.font.Font.SelectionStrategy, java.lang.String[], org.axsl.font.Font.Style, org.axsl.font.Font.Weight, org.axsl.font.Font.Variant, org.axsl.font.Font.Stretch, int, int)
.
Client applications may use FontUtility.cssFontFamily(String)
to
convert String input into the value expected here.style
- See selectFontXsl(org.axsl.font.Font.SelectionStrategy, java.lang.String[], org.axsl.font.Font.Style, org.axsl.font.Font.Weight, org.axsl.font.Font.Variant, org.axsl.font.Font.Stretch, int, int)
.
Client applications may use FontUtility.cssFontStyle(String,
boolean)
to convert String input into the value expected here.weight
- See selectFontXsl(org.axsl.font.Font.SelectionStrategy, java.lang.String[], org.axsl.font.Font.Style, org.axsl.font.Font.Weight, org.axsl.font.Font.Variant, org.axsl.font.Font.Stretch, int, int)
.
Client applications may use FontUtility.cssFontWeight(String,
boolean)
to convert String input into the value expected here.variant
- See selectFontXsl(org.axsl.font.Font.SelectionStrategy, java.lang.String[], org.axsl.font.Font.Style, org.axsl.font.Font.Weight, org.axsl.font.Font.Variant, org.axsl.font.Font.Stretch, int, int)
.
Client applications may use FontUtility.cssFontVariant(String,
boolean)
to convert String input into the value expected here.stretch
- See selectFontXsl(org.axsl.font.Font.SelectionStrategy, java.lang.String[], org.axsl.font.Font.Style, org.axsl.font.Font.Weight, org.axsl.font.Font.Variant, org.axsl.font.Font.Stretch, int, int)
.
Client applications may use FontUtility.cssFontStretch(String,
boolean)
to convert String input into the value expected here.size
- The size (in millipoints) of the font.
This is only meaningful for bitmapped fonts.codePoint
- The first character to be painted using the selected
FontUse
.
This allows the selection process to avoid selecting a FontUse
that cannot even paint the first character.
FontUse
instance associated with the
descriptive input.
FontException
- if there is no matching font.selectFontXsl(org.axsl.font.Font.SelectionStrategy, java.lang.String[], org.axsl.font.Font.Style, org.axsl.font.Font.Weight, org.axsl.font.Font.Variant, org.axsl.font.Font.Stretch, int, int)
FontUse selectFontPanose(byte[] panose, int codePoint) throws FontException
panose
- The 10-element PANOSE description of the desired font.codePoint
- The first character to be painted using the selected
FontUse
.
This allows the selection process to avoid selecting a FontUse
that cannot even paint the first character.
FontUse
instance associated with the
descriptive input.
FontException
- if there is no matching font.Font[] getUsedFonts()
Font
instances that have been used by
this FontConsumer.
Font
instances used by this FontConsumer.FontUse[] getUsedFontUses()
FontUse
instances that have been used by
this FontConsumer.
FontUse
instances used by this FontConsumer.void optimizeFonts()
Optimizes the fonts used by this FontConsumer. This is only useful if two passes are made at the document contents, one before running this method, the other after doing so. To be effective, the fonts must be selected and the characters registered identically between the two passes. The first pass tells the system what fonts and characters will be used. Then running this method allows the system to take the "big picture" view of the document contents, and optimize things like encodings and character sets before actually processing the document contents.
Note that implementations are free to make this method a no-op, that is to do nothing at all. Even if something is done, there is no guarantee that it is worth the extra cost of processing the document twice. Consult implementation documentation for details.
Caveat: The timing of when this process should be run is very critical. It should only be run after all glyph indices that are used by the FontConsumer have been registered. It should also only be run before any glyph indices have been written to actual document output. If the client runs the registration and writing tasks concurrently, it should not use this method, as doing so will corrupt the logical connection between the glyph indices used to embed the font and those used to write the document contents.
void setFontSources(int[] fontSources)
fontSources
- The array of valid font sources that can be used by
this consumer.
Valid array values are FONT_SOURCE_FREE_STANDING
and
FONT_SOURCE_SYSTEM
.
The order of the array signifies the order of preference for selection
purposes.
For example, if both system fonts and free-standing fonts can be used,
but free-standing fonts are preferred, the array should contain
{ FONT_SOURCE_FREE_STANDING, FONT_SOURCE_SYSTEM };
|
aXSL API 0.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This documentation was created August 8 2007 by The aXSL Group and may be freely copied. See license for details.