|
aXSL API 0.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Font
The Font interface exposes a font resource to the client application.
Nested Class Summary | |
---|---|
static class |
Font.Complexity
Enumeration of constants to describe the complexity of a font. |
static class |
Font.Format
Enumeration of constants to describe the format of a font. |
static class |
Font.LineHeightAlgorithm
Enumeration of possible algorithms that could be used to compute the line-height for a given font. |
static class |
Font.SelectionStrategy
Enumeration of constants needed to describe the various font selection strategies. |
static class |
Font.Stretch
Enumeration of constants needed to describe the "stretch" value of a font. |
static class |
Font.Style
Enumeration of constants needed to describe the style of a font. |
static class |
Font.Variant
Enumeration of constants needed to describe the variant of a font. |
static class |
Font.Weight
Enumeration of constants needed to describe the weight of a font. |
static class |
Font.WritingMode
Enumeration of possible writing-modes that a font might have. |
Method Summary | |
---|---|
Baseline |
baseline(Iso15924 script)
Determines which baseline should be used by this font for a specified script. |
int |
baselineOffset(AbsoluteAxis writingMode,
Baseline 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. |
Font.Complexity |
getFontComplexity()
Returns a value indicating whether this font is a simple or composite font. |
Font.Format |
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. |
byte[] |
getPanose()
Returns the Panose array 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(Font.LineHeightAlgorithm 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 |
subscriptShift(int fontSize)
The amount by which the alphabetic baseline should be shifted when writing subscripts for this font. |
int |
superscriptShift(int fontSize)
The amount by which the alphabetic baseline should be shifted when writing superscripts 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. |
Method Detail |
---|
int getAscender(int fontSize)
fontSize
- The font size, in millipoints.
int getDescender(int fontSize)
fontSize
- The font size, in millipoints.
int getCapHeight(int fontSize)
fontSize
- The font size, in millipoints.
int getXHeight(int fontSize)
fontSize
- The font size, in millipoints.
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.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".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.boolean isEmbeddable()
boolean isSubsettable()
java.awt.Font getAwtFont(int fontSize)
fontSize
- The font size, in millipoints.
Font
instance, if there is one,
otherwise null.boolean usableInPostScriptOutput()
java.lang.String getFamilyName()
getFontName()
,
getPostscriptName()
java.lang.String getFontName()
getFamilyName()
,
getPostscriptName()
java.lang.String getPostscriptName()
getFamilyName()
,
getFontName()
Encoding getInternalEncoding()
FontUse.getEncoding()
Font.Complexity getFontComplexity()
Font.Complexity.SIMPLE
,
or Font.Complexity.COMPOSITE
.Font.Format getFontFormat()
Font.Format.TYPE1
,
or Font.Format.TRUETYPE
.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.
float getItalicAngle()
int getStemV()
int getDefaultWidth()
boolean isPdfStandardFont()
float normalLineHeightFactor(Font.LineHeightAlgorithm 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 Font.LineHeightAlgorithm.DEFAULT
, which puts the
implementation in complete control of the computation.
Other algorithms may be added in the future.
int baselineOffset(AbsoluteAxis writingMode, Baseline baselineType, int fontSize)
writingMode
- Constant indicating the direction in which the script
is being written.
Valid values are AbsoluteAxis.HORIZONTAL
and
AbsoluteAxis.VERTICAL
.baselineType
- Constant indicating which baseline is sought.
Valid values are Baseline.ALPHABETIC
,
Baseline.IDEOGRAPHIC
,
Baseline.HANGING
,
Baseline.MATHEMATICAL
,
Baseline.CENTRAL
,
Baseline.MIDDLE
,
Baseline.TEXT_BEFORE_EDGE
, and
Baseline.TEXT_AFTER_EDGE
.fontSize
- The size, in millipoints, at which the font is scaled.
Baseline baseline(Iso15924 script)
script
- The
ISO 15924
script name for which a baseline is sought.
Baseline.ALPHABETIC
,
Baseline.IDEOGRAPHIC
,
Baseline.HANGING
,
Baseline.MATHEMATICAL
,
Baseline.CENTRAL
,
Baseline.MIDDLE
,
Baseline.TEXT_BEFORE_EDGE
, and
Baseline.TEXT_AFTER_EDGE
.int subscriptShift(int fontSize)
fontSize
- The size, in millipoints, at which the font is scaled.
int superscriptShift(int fontSize)
fontSize
- The size, in millipoints, at which the font is scaled.
int underlineSize(int fontSize)
fontSize
- The font size for which the underline thickness should be
computed.
int underlinePosition(int fontSize)
fontSize
- The font size for which the underline position should be
computed.
int overlineSize(int fontSize)
fontSize
- The font size for which the overline thickness should be
computed.
int overlinePosition(int fontSize)
fontSize
- The font size for which the overline position should be
computed.
int strikeoutSize(int fontSize)
fontSize
- The font size for which the strikeout thickness should be
computed.
int strikeoutPosition(int fontSize)
fontSize
- The font size for which the strikeout position should be
computed.
byte[] getPanose()
|
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.