|
aXSL API 0.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The Font interface exposes a font resource to the client application.
Field Summary | |
static byte |
FONT_COMPLEXITY_UNKNOWN
Font-complexity constant indicating that the complexity is not known. |
static byte |
FONT_COMPOSITE
Font-complexity constant indicating that the font is a composite font. |
static byte |
FONT_SELECTION_AUTO
font-selection-strategy constant indicating "auto". |
static byte |
FONT_SELECTION_CBC
font-selection-strategy constant indicating "character-by-character". |
static byte |
FONT_SIMPLE
Font-complexity constant indicating that the font is a simple font. |
static byte |
FONT_STRETCH_ANY
Font-stretch constant indicating no preference. |
static byte |
FONT_STRETCH_CONDENSED
Font-stretch constant indicating condensed. |
static byte |
FONT_STRETCH_EXPANDED
Font-stretch constant indicating expanded. |
static byte |
FONT_STRETCH_EXTRA_CONDENSED
Font-stretch constant indicating extra-condensed. |
static byte |
FONT_STRETCH_EXTRA_EXPANDED
Font-stretch constant indicating extra-expanded. |
static byte |
FONT_STRETCH_NORMAL
Font-stretch constant indicating normal. |
static byte |
FONT_STRETCH_SEMI_CONDENSED
Font-stretch constant indicating semi-condensed. |
static byte |
FONT_STRETCH_SEMI_EXPANDED
Font-stretch constant indicating semi-expanded. |
static byte |
FONT_STRETCH_ULTRA_CONDENSED
Font-stretch constant indicating ultra-condensed. |
static byte |
FONT_STRETCH_ULTRA_EXPANDED
Font-stretch constant indicating ultra-expanded. |
static byte |
FONT_STYLE_ANY
Font-style constant indicating no preference. |
static byte |
FONT_STYLE_BACKSLANT
Font-style constant indicating a backslant typeface. |
static byte |
FONT_STYLE_ITALIC
Font-style constant indicating an italic typeface. |
static byte |
FONT_STYLE_NORMAL
Font-style constant indicating an upright (Roman) typeface. |
static byte |
FONT_STYLE_OBLIQUE
Font-style constant indicating an oblique typeface. |
static byte |
FONT_VARIANT_ANY
Font-variant constant indicating no preference. |
static byte |
FONT_VARIANT_NORMAL
Font-variant constant indicating that small-caps is not on. |
static byte |
FONT_VARIANT_SMALL_CAPS
Font-variant constant indicating that small-caps is on. |
static short |
FONT_WEIGHT_100
Font-weight constant indicating a weight of 100 (extremely light). |
static short |
FONT_WEIGHT_200
Font-weight constant indicating a weight of 200 (very light). |
static short |
FONT_WEIGHT_300
Font-weight constant indicating a weight of 300 (light). |
static short |
FONT_WEIGHT_400
Font-weight constant indicating a weight of 400 (normal). |
static short |
FONT_WEIGHT_500
Font-weight constant indicating a weight of 500 (dark). |
static short |
FONT_WEIGHT_600
Font-weight constant indicating a weight of 600 (semi-bold). |
static short |
FONT_WEIGHT_700
Font-weight constant indicating a weight of 700 (bold). |
static short |
FONT_WEIGHT_800
Font-weight constant indicating a weight of 800 (extra bold). |
static short |
FONT_WEIGHT_900
Font-weight constant indicating a weight of 900 (black). |
static short |
FONT_WEIGHT_ANY
Font-weight constant indicating no preference. |
static short |
FONT_WEIGHT_BOLD
Font-weight constant indicating a weight of "bold", which is the same as FONT_WEIGHT_700 . |
static short |
FONT_WEIGHT_NORMAL
Font-weight constant indicating a weight of "normal", which is the same as FONT_WEIGHT_400 . |
static byte |
FORMAT_OTF_CFF
Font-format constant indicating that the font is an OpenType font with Compact Font Format (CFF) data (no TrueType outlines). |
static byte |
FORMAT_OTF_TRUETYPE
Font-format constant indicating that the font is an OpenType font with TrueType outlines. |
static byte |
FORMAT_TRUETYPE
Font-format constant indicating that the font is a TrueType font. |
static byte |
FORMAT_TYPE1
Font-format constant indicating that the font is a Type1 font. |
static byte |
FORMAT_UNKNOWN
Font-format constant indicating that the font's format is not known. |
static char |
INVALID_UNICODE_CHARACTER
Constant defining an invalid character value. |
static byte |
LH_ALGORITHM_DEFAULT
Normal line-height computation constant indicating that the implementation is in complete control of the normal line-height computation. |
static byte |
WRITING_MODE_HORIZONTAL
Constant indicating the writing mode is horizontal. |
static byte |
WRITING_MODE_VERTICAL
Constant indicating the writing mode is vertical. |
Method Summary | |
int |
baseline(java.lang.String script)
Determines which baseline should be used by this font for a specified script. |
int |
baselineOffset(int writingMode,
int baselineType,
int fontSize)
Returns the location of the specified baseline. |
int |
getAscender(int fontSize)
Returns the Ascender value for this font, scaled to a specific point size. |
java.awt.Font |
getAWTFont(int fontSize)
If this Font has a java.awt.Font associated with it, return it. |
int |
getCapHeight(int fontSize)
Returns the CapHeight value for this font, scaled to a specific point size. |
int |
getDefaultWidth()
Returns the default glyph width for this font. |
int |
getDescender(int fontSize)
Returns the Descender value for this font, scaled to a specific point size. |
java.lang.String |
getFamilyName()
Returns this font's font-family name. |
byte |
getFontComplexity()
Returns a value indicating whether this font is a simple or composite font. |
byte |
getFontFormat()
Returns a value indicating what format (e.g. |
java.lang.String |
getFontName()
Returns this font's name. |
Encoding |
getInternalEncoding()
Get the font's internal Encoding scheme. |
float |
getItalicAngle()
Returns the ItalicAngle value for this font. |
java.lang.String |
getPostscriptName()
Returns the PostScript name of the font. |
int |
getStemV()
Returns the StemV value for this font, used in a PDF Font Descriptor, as defined in the PDF Reference, Second Edition, Section 5.7. |
int |
getXHeight(int fontSize)
Returns the XHeight value for this font, scaled to a specific point size. |
boolean |
isEmbeddable()
Tells the client application whether this font can be embedded or not. |
boolean |
isPDFStandardFont()
Indicates whether this font is one of the PDF Base-14 fonts. |
boolean |
isSubsettable()
Tells the client application whether a subset of this font can be embedded. |
int |
kern(int char1,
int char2)
Computes the kerning needed between two glyphs in this font. |
float |
normalLineHeightFactor(int algorithm)
Returns a factor suitable for computing a "normal" line-height as defined in the CSS and XSL-FO standards. |
int |
overlinePosition(int fontSize)
The recommended position of the bottom of the overline stroke, relative to the baseline, in millipoints. |
int |
overlineSize(int fontSize)
The recommended thickness, in millipoints, of the overline stroke for this font. |
int |
strikeoutPosition(int fontSize)
The recommended position of the top of the strikeout stroke, relative to the baseline, in millipoints. |
int |
strikeoutSize(int fontSize)
The recommended thickness, in millipoints, of the strikeout stroke for this font. |
int |
underlinePosition(int fontSize)
The recommended position of the top of the underline stroke, relative to the baseline, in millipoints. |
int |
underlineSize(int fontSize)
The recommended thickness, in millipoints, of the underline stroke for this font. |
boolean |
usableInPostScriptOutput()
Indicates whether this font can be referenced within a PostScript file. |
int |
width(java.lang.CharSequence chars,
int fontSize,
int letterSpacing,
int wordSpacing)
Calculates the width of a given String, considering letter spacing, word spacing, and kerning. |
int |
width(int codePoint,
int fontSize)
Returns the width of a Unicode character for this font, at a specified point size. |
int |
widthEstimate(int codePoint,
int fontSize)
Returns the estimated width of a Unicode character for this font, at a specified point size. |
Methods inherited from interface java.lang.Comparable |
compareTo |
Field Detail |
public static final char INVALID_UNICODE_CHARACTER
public static final byte FONT_STYLE_NORMAL
public static final byte FONT_STYLE_ITALIC
public static final byte FONT_STYLE_OBLIQUE
public static final byte FONT_STYLE_BACKSLANT
public static final byte FONT_STYLE_ANY
public static final short FONT_WEIGHT_100
public static final short FONT_WEIGHT_200
public static final short FONT_WEIGHT_300
public static final short FONT_WEIGHT_400
public static final short FONT_WEIGHT_500
public static final short FONT_WEIGHT_600
public static final short FONT_WEIGHT_700
public static final short FONT_WEIGHT_800
public static final short FONT_WEIGHT_900
public static final short FONT_WEIGHT_NORMAL
FONT_WEIGHT_400
.
public static final short FONT_WEIGHT_BOLD
FONT_WEIGHT_700
.
public static final short FONT_WEIGHT_ANY
public static final byte FONT_VARIANT_NORMAL
public static final byte FONT_VARIANT_SMALL_CAPS
public static final byte FONT_VARIANT_ANY
public static final byte FONT_STRETCH_ULTRA_CONDENSED
public static final byte FONT_STRETCH_EXTRA_CONDENSED
public static final byte FONT_STRETCH_CONDENSED
public static final byte FONT_STRETCH_SEMI_CONDENSED
public static final byte FONT_STRETCH_NORMAL
public static final byte FONT_STRETCH_SEMI_EXPANDED
public static final byte FONT_STRETCH_EXPANDED
public static final byte FONT_STRETCH_EXTRA_EXPANDED
public static final byte FONT_STRETCH_ULTRA_EXPANDED
public static final byte FONT_STRETCH_ANY
public static final byte FONT_SELECTION_CBC
public static final byte FONT_SELECTION_AUTO
public static final byte FONT_COMPLEXITY_UNKNOWN
public static final byte FONT_SIMPLE
public static final byte FONT_COMPOSITE
public static final byte FORMAT_UNKNOWN
public static final byte FORMAT_TYPE1
public static final byte FORMAT_TRUETYPE
public static final byte FORMAT_OTF_TRUETYPE
public static final byte FORMAT_OTF_CFF
public static final byte LH_ALGORITHM_DEFAULT
public static final byte WRITING_MODE_HORIZONTAL
public static final byte WRITING_MODE_VERTICAL
Method Detail |
public int getAscender(int fontSize)
fontSize
- The font size, in millipoints.
public int getDescender(int fontSize)
fontSize
- The font size, in millipoints.
public int getCapHeight(int fontSize)
fontSize
- The font size, in millipoints.
public int getXHeight(int fontSize)
fontSize
- The font size, in millipoints.
public int width(int codePoint, int fontSize)
codePoint
- The Unicode character for which the width should be
returned.fontSize
- The size, in millipoints, of the font.
codePoint
, or Integer.MIN_VALUE
if such a glyph
is not found.public int width(java.lang.CharSequence chars, int fontSize, int letterSpacing, int wordSpacing)
chars
- The String whose width should be computed.fontSize
- The size, in millipoints, of the font.letterSpacing
- The size, in millipoints, of any letter-spacing.wordSpacing
- The size, in millipoints, of any word-spacing.
string
.
Letter-spacing and kerning are added between characters in
string
, but are not added either before or after.
(Adding letter-spacing or kerning before or after would require making
assumptions about the context of string
, including whether
it is at the beginning or end of the line, what fonts surround it, etc.)
Word-spacing is added only to space characters (0x20).
Any other whitespace characters that the client applications wishes to
have considered as word-spacing must first be normalized to 0x20.
If there is no glyph for a character in string
, the width
returned will be that of the "missing glyph".public int widthEstimate(int codePoint, int fontSize)
width(int, int)
has indicated that the font cannot return a
true width.
codePoint
- The Unicode character for which the width should be
returned.fontSize
- The size, in millipoints, of the font.
codePoint
, or Integer.MIN_VALUE
if the implementation cannot estimate such a width.public boolean isEmbeddable()
public boolean isSubsettable()
public java.awt.Font getAWTFont(int fontSize)
fontSize
- The font size, in millipoints.
Font
instance, if there is one,
otherwise null.public boolean usableInPostScriptOutput()
public java.lang.String getFamilyName()
getFontName()
,
getPostscriptName()
public java.lang.String getFontName()
getFamilyName()
,
getPostscriptName()
public java.lang.String getPostscriptName()
getFamilyName()
,
getFontName()
public Encoding getInternalEncoding()
FontUse.getEncoding()
public byte getFontComplexity()
FONT_COMPLEXITY_UNKNOWN
,
FONT_SIMPLE
, or FONT_COMPOSITE
.public byte getFontFormat()
FORMAT_UNKNOWN
,
FORMAT_TYPE1
, or FORMAT_TRUETYPE
.public int kern(int char1, int char2)
char1
- The Unicode code point of the first (left in a left-to-right
system) character.char2
- The Unicode code point of the second (right in left-to-right
system) character.
public float getItalicAngle()
public int getStemV()
public int getDefaultWidth()
public boolean isPDFStandardFont()
public float normalLineHeightFactor(int algorithm)
Returns a factor suitable for computing a "normal" line-height as defined in the CSS and XSL-FO standards. The line-height is the distance, including leading, between the baselines of stacked lines of text. The CSS and XSL-FO standards recommend that the "normal" value for line-height fall between 1.0 and 1.2. (see Section 7.15.4 of XSL-FO 1.0) This method attempts to find a suitable value based on the characteristics of the font itself.
Design Note 1: This method returns a float factor instead of a computation of the actual line-height to facilitate the handling of inheritance where that is required. For example, for CSS and XSL-FO, the factor is what is inherited instead of the computed line-height.
algorithm
- The specifier of an algorithm that should be used to
compute the factor.
Valid values include LH_ALGORITHM_DEFAULT
, which puts the
implementation in complete control of the computation.
Other algorithms may be added in the future.
public int baselineOffset(int writingMode, int baselineType, int fontSize)
writingMode
- Constant indicating the direction in which the script
is being written.
Valid values are Constants.AXIS_HORIZONTAL
and
Constants.AXIS_VERTICAL
.baselineType
- Constant indicating which baseline is sought.
Valid values are Constants.BASELINE_ALPHABETIC
,
Constants.BASELINE_IDEOGRAPHIC
,
Constants.BASELINE_HANGING
,
Constants.BASELINE_MATHEMATICAL
,
Constants.BASELINE_CENTRAL
,
Constants.BASELINE_MIDDLE
,
Constants.BASELINE_TEXT_BEFORE_EDGE
, and
Constants.BASELINE_TEXT_AFTER_EDGE
.fontSize
- The size, in millipoints, at which the font is scaled.
public int baseline(java.lang.String script)
script
- The
ISO 15924
script name for which a baseline is sought.
Constants.BASELINE_ALPHABETIC
,
Constants.BASELINE_IDEOGRAPHIC
,
Constants.BASELINE_HANGING
,
Constants.BASELINE_MATHEMATICAL
,
Constants.BASELINE_CENTRAL
,
Constants.BASELINE_MIDDLE
,
Constants.BASELINE_TEXT_BEFORE_EDGE
, and
Constants.BASELINE_TEXT_AFTER_EDGE
.public int underlineSize(int fontSize)
fontSize
- The font size for which the underline thickness should be
computed.
public int underlinePosition(int fontSize)
fontSize
- The font size for which the underline position should be
computed.
public int overlineSize(int fontSize)
fontSize
- The font size for which the overline thickness should be
computed.
public int overlinePosition(int fontSize)
fontSize
- The font size for which the overline position should be
computed.
public int strikeoutSize(int fontSize)
fontSize
- The font size for which the strikeout thickness should be
computed.
public int strikeoutPosition(int fontSize)
fontSize
- The font size for which the strikeout position should be
computed.
|
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.