SourceForge.net Logo
aXSL API 0.1

org.axsl.fontR
Class FontUtility

java.lang.Object
  extended byorg.axsl.fontR.FontUtility

public final class FontUtility
extends java.lang.Object

Class containing font-related utility methods.

References to CSS2 are to the Cascading Style Sheet standard, version 2.0, found at:

http://www.w3.org/TR/REC-CSS2/

References to XSL-FO refer to the eXtensible Stylesheet Language Formatting Objects standard, version 1.0, found at:

http://www.w3.org/TR/2001/REC-xsl-20011015/


Field Summary
static java.lang.String INPUT_BACKSLANT
          String value for input "backslant".
static java.lang.String INPUT_CONDENSED
          String value for input "condensed".
static java.lang.String INPUT_EXPANDED
          String value for input "expanded".
static java.lang.String INPUT_EXTRA_CONDENSED
          String value for input "extra-condensed".
static java.lang.String INPUT_EXTRA_EXPANDED
          String value for input "extra-expanded".
static java.lang.String INPUT_INVALID
          String value for invalid input.
static java.lang.String INPUT_ITALIC
          String value for input "italic".
static java.lang.String INPUT_NORMAL
          String value for input "normal".
static java.lang.String INPUT_OBLIQUE
          String value for input "oblique".
static java.lang.String INPUT_SEMI_CONDENSED
          String value for input "semi-condensed".
static java.lang.String INPUT_SEMI_EXPANDED
          String value for input "semi-expanded".
static java.lang.String INPUT_SMALL_CAPS
          String value for input "small-caps".
static java.lang.String INPUT_ULTRA_CONDENSED
          String value for input "ultra-condensed".
static java.lang.String INPUT_ULTRA_EXPANDED
          String value for input "ultra-expanded".
 
Method Summary
static java.lang.String[] cssFontFamily(java.lang.String input)
          Converts a CSS2-style String input for font-family into a value expected by FontConsumer.selectFontCSS(String[], int, int, int, int, int, int).
static byte cssFontStretch(java.lang.String input, boolean lowerCaseOnly)
          Converts a CSS2-style String input for font-stretch into a value expected by FontConsumer.selectFontCSS(String[], int, int, int, int, int, int).
static byte cssFontStyle(java.lang.String input, boolean lowerCaseOnly)
          Converts a CSS2-style String input for font-style into a value expected by FontConsumer.selectFontCSS(String[], int, int, int, int, int, int).
static byte cssFontVariant(java.lang.String input, boolean lowerCaseOnly)
          Converts a CSS2-style String input for font-variant into a value expected by FontConsumer.selectFontCSS(String[], int, int, int, int, int, int).
static short cssFontWeight(java.lang.String input, boolean lowerCaseOnly)
          Converts a CSS2-style String input for font-weight into a value expected by FontConsumer.selectFontCSS(String[], int, int, int, int, int, int).
static java.lang.String[] foFontFamily(java.lang.String input)
          Same as cssFontFamily(String), except input is an XSL-FO-style String.
static byte foFontSelectionStrategy(java.lang.String input, boolean lowerCaseOnly)
          Converts XSL-FO String input for font-selection-strategy into a value expected by FontConsumer.selectFontXSL(int, String[], int, int, int, int, int, int).
static byte foFontStretch(java.lang.String input, boolean lowerCaseOnly)
          Same as cssFontStretch(String, boolean), except input is an XSL-FO-style String.
static byte foFontStyle(java.lang.String input, boolean lowerCaseOnly)
          Same as cssFontStyle(String, boolean), except input is an XSL-FO-style String.
static byte foFontVariant(java.lang.String input, boolean lowerCaseOnly)
          Same as cssFontVariant(String, boolean), except input is an XSL-FO-style String.
static short foFontWeight(java.lang.String input, boolean lowerCaseOnly)
          Same as cssFontWeight(String, boolean), except input is an XSL-FO-style String.
static java.lang.String fontStretchName(int fontStretch)
          Returns a String description for a numeric font-weight value, suitable for using in user messages.
static java.lang.String fontStyleName(int fontStyle)
          Returns a String description for a numeric font-style value, suitable for using in user messages.
static java.lang.String fontVariantName(int fontVariant)
          Returns a String description for a numeric font-weight value, suitable for using in user messages.
static java.lang.String fontWeightName(int fontWeight)
          Returns a String description for a numeric font-weight value, suitable for using in user messages.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INPUT_INVALID

public static final java.lang.String INPUT_INVALID
String value for invalid input.

See Also:
Constant Field Values

INPUT_NORMAL

public static final java.lang.String INPUT_NORMAL
String value for input "normal".

See Also:
Constant Field Values

INPUT_ITALIC

public static final java.lang.String INPUT_ITALIC
String value for input "italic".

See Also:
Constant Field Values

INPUT_OBLIQUE

public static final java.lang.String INPUT_OBLIQUE
String value for input "oblique".

See Also:
Constant Field Values

INPUT_BACKSLANT

public static final java.lang.String INPUT_BACKSLANT
String value for input "backslant".

See Also:
Constant Field Values

INPUT_SMALL_CAPS

public static final java.lang.String INPUT_SMALL_CAPS
String value for input "small-caps".

See Also:
Constant Field Values

INPUT_ULTRA_CONDENSED

public static final java.lang.String INPUT_ULTRA_CONDENSED
String value for input "ultra-condensed".

See Also:
Constant Field Values

INPUT_EXTRA_CONDENSED

public static final java.lang.String INPUT_EXTRA_CONDENSED
String value for input "extra-condensed".

See Also:
Constant Field Values

INPUT_CONDENSED

public static final java.lang.String INPUT_CONDENSED
String value for input "condensed".

See Also:
Constant Field Values

INPUT_SEMI_CONDENSED

public static final java.lang.String INPUT_SEMI_CONDENSED
String value for input "semi-condensed".

See Also:
Constant Field Values

INPUT_SEMI_EXPANDED

public static final java.lang.String INPUT_SEMI_EXPANDED
String value for input "semi-expanded".

See Also:
Constant Field Values

INPUT_EXPANDED

public static final java.lang.String INPUT_EXPANDED
String value for input "expanded".

See Also:
Constant Field Values

INPUT_EXTRA_EXPANDED

public static final java.lang.String INPUT_EXTRA_EXPANDED
String value for input "extra-expanded".

See Also:
Constant Field Values

INPUT_ULTRA_EXPANDED

public static final java.lang.String INPUT_ULTRA_EXPANDED
String value for input "ultra-expanded".

See Also:
Constant Field Values
Method Detail

foFontSelectionStrategy

public static byte foFontSelectionStrategy(java.lang.String input,
                                           boolean lowerCaseOnly)
Converts XSL-FO String input for font-selection-strategy into a value expected by FontConsumer.selectFontXSL(int, String[], int, int, int, int, int, int).

Parameters:
input - The XSL-FO-style String to be converted.
lowerCaseOnly - Set to true to insist that all input values be lowercase.
Returns:
One of Font.FONT_SELECTION_CBC or Font.FONT_SELECTION_AUTO. For invalid input, -1.

cssFontStyle

public static byte cssFontStyle(java.lang.String input,
                                boolean lowerCaseOnly)
Converts a CSS2-style String input for font-style into a value expected by FontConsumer.selectFontCSS(String[], int, int, int, int, int, int).

Parameters:
input - The CSS2-style String to be converted.
lowerCaseOnly - Set to true to insist that all input values be lowercase. There is some ambiguity about whether CSS is case-sensitive or not. If it is, all input should be lower case.
Returns:
For valid input, one of Font.FONT_STYLE_NORMAL, Font.FONT_STYLE_ITALIC, Font.FONT_STYLE_OBLIQUE, or Font.FONT_STYLE_BACKSLANT. For invalid input, -1.
See Also:
FontConsumer.selectFontCSS(String[], int, int, int, int, int, int)

foFontStyle

public static byte foFontStyle(java.lang.String input,
                               boolean lowerCaseOnly)
Same as cssFontStyle(String, boolean), except input is an XSL-FO-style String.

Parameters:
input - The XSL-FO-style String to be converted.
lowerCaseOnly - Set to true to insist that all input values be lowercase. There is some ambiguity about whether XSL-FO is case-sensitive or not. If it is, all input should be lower case.
Returns:
For valid input, one of Font.FONT_STYLE_NORMAL, Font.FONT_STYLE_ITALIC, Font.FONT_STYLE_OBLIQUE, or Font.FONT_STYLE_BACKSLANT. For invalid input, -1.
See Also:
cssFontStyle(String, boolean)

cssFontWeight

public static short cssFontWeight(java.lang.String input,
                                  boolean lowerCaseOnly)
Converts a CSS2-style String input for font-weight into a value expected by FontConsumer.selectFontCSS(String[], int, int, int, int, int, int).

Parameters:
input - The CSS2-style String to be converted.
lowerCaseOnly - Set to true to insist that all input values be lowercase. There is some ambiguity about whether CSS is case-sensitive or not. If it is, all input should be lower case.
Returns:
For valid input, one of 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, Font.FONT_WEIGHT_900, Font.FONT_WEIGHT_NORMAL, and Font.FONT_WEIGHT_BOLD. For invalid input, -1.
See Also:
FontConsumer.selectFontCSS(String[], int, int, int, int, int, int)

foFontWeight

public static short foFontWeight(java.lang.String input,
                                 boolean lowerCaseOnly)
Same as cssFontWeight(String, boolean), except input is an XSL-FO-style String.

Parameters:
input - The XSL-FO-style String to be converted.
lowerCaseOnly - Set to true to insist that all input values be lowercase. There is some ambiguity about whether XSL-FO is case-sensitive or not. If it is, all input should be lower case.
Returns:
For valid input, one of 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, Font.FONT_WEIGHT_900, Font.FONT_WEIGHT_NORMAL, and Font.FONT_WEIGHT_BOLD. For invalid input, -1.
See Also:
cssFontWeight(String, boolean)

cssFontVariant

public static byte cssFontVariant(java.lang.String input,
                                  boolean lowerCaseOnly)
Converts a CSS2-style String input for font-variant into a value expected by FontConsumer.selectFontCSS(String[], int, int, int, int, int, int).

Parameters:
input - The CSS2-style String to be converted.
lowerCaseOnly - Set to true to insist that all input values be lowercase. There is some ambiguity about whether CSS is case-sensitive or not. If it is, all input should be lower case.
Returns:
For valid input, one of Font.FONT_VARIANT_NORMAL or Font.FONT_VARIANT_SMALL_CAPS. For invalid input, -1.
See Also:
FontConsumer.selectFontCSS(String[], int, int, int, int, int, int)

foFontVariant

public static byte foFontVariant(java.lang.String input,
                                 boolean lowerCaseOnly)
Same as cssFontVariant(String, boolean), except input is an XSL-FO-style String.

Parameters:
input - The XSL-FO-style String to be converted.
lowerCaseOnly - Set to true to insist that all input values be lowercase. There is some ambiguity about whether XSL-FO is case-sensitive or not. If it is, all input should be lower case.
Returns:
For valid input, one of Font.FONT_VARIANT_NORMAL or Font.FONT_VARIANT_SMALL_CAPS. For invalid input, -1.
See Also:
cssFontVariant(String, boolean)

cssFontStretch

public static byte cssFontStretch(java.lang.String input,
                                  boolean lowerCaseOnly)
Converts a CSS2-style String input for font-stretch into a value expected by FontConsumer.selectFontCSS(String[], int, int, int, int, int, int).

Parameters:
input - The CSS2-style String to be converted.
lowerCaseOnly - Set to true to insist that all input values be lowercase. There is some ambiguity about whether CSS is case-sensitive or not. If it is, all input should be lower case.
Returns:
For valid input, 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, Font.FONT_STRETCH_ULTRA_EXPANDED. For invalid input, -1.
See Also:
FontConsumer.selectFontCSS(String[], int, int, int, int, int, int)

foFontStretch

public static byte foFontStretch(java.lang.String input,
                                 boolean lowerCaseOnly)
Same as cssFontStretch(String, boolean), except input is an XSL-FO-style String.

Parameters:
input - The XSL-FO-style String to be converted.
lowerCaseOnly - Set to true to insist that all input values be lowercase. There is some ambiguity about whether XSL-FO is case-sensitive or not. If it is, all input should be lower case.
Returns:
For valid input, 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, Font.FONT_STRETCH_ULTRA_EXPANDED. For invalid input, -1.
See Also:
cssFontStretch(String, boolean)

cssFontFamily

public static java.lang.String[] cssFontFamily(java.lang.String input)
Converts a CSS2-style String input for font-family into a value expected by FontConsumer.selectFontCSS(String[], int, int, int, int, int, int).

Parameters:
input - The CSS2-style font-family String to be converted. This is a comma-delimited String containing one or more potential font-family items to be selected. Consult the CSS2 standard for details.
Returns:
A String array with the parsed font-family items in it, or null if none were found.
See Also:
FontConsumer.selectFontCSS(String[], int, int, int, int, int, int)

foFontFamily

public static java.lang.String[] foFontFamily(java.lang.String input)
Same as cssFontFamily(String), except input is an XSL-FO-style String.

Parameters:
input - The XSL-FO font-family String to be converted. This is a comma-delimited String containing one or more potential font-family items to be selected. Consult the XSL-FO standard for details.
Returns:
A String array with the parsed font-family items in it, or null if none were found.
See Also:
cssFontFamily(String)

fontStyleName

public static java.lang.String fontStyleName(int fontStyle)
Returns a String description for a numeric font-style value, suitable for using in user messages.

Parameters:
fontStyle - One of Font.FONT_STYLE_NORMAL, Font.FONT_STYLE_ITALIC, Font.FONT_STYLE_OBLIQUE, or Font.FONT_STYLE_BACKSLANT.
Returns:
A String description for fontStyle

fontWeightName

public static java.lang.String fontWeightName(int fontWeight)
Returns a String description for a numeric font-weight value, suitable for using in user messages.

Parameters:
fontWeight - One of 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.
Returns:
A String description for fontWeight

fontVariantName

public static java.lang.String fontVariantName(int fontVariant)
Returns a String description for a numeric font-weight value, suitable for using in user messages.

Parameters:
fontVariant - One of Font.FONT_VARIANT_NORMAL or Font.FONT_VARIANT_SMALL_CAPS.
Returns:
A String description for fontWeight

fontStretchName

public static java.lang.String fontStretchName(int fontStretch)
Returns a String description for a numeric font-weight value, suitable for using in user messages.

Parameters:
fontStretch - 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.
Returns:
A String description for fontStretch

SourceForge.net Logo
aXSL API 0.1

This documentation was created September 6 2006 by The aXSL Group and may be freely copied. See license for details.