|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.font.GlyphMetrics
Glyphs are either STANDARD, LIGATURE, COMBINING, or COMPONENT.
Other metrics available through GlyphMetrics are the advance, bounds, and left and right side bearings. The advance of a glyph is the distance from the glyph's origin to the origin of the next glyph. Note that, in a GlyphVector, the distance from a glyph to its following glyph may not be the glyph's advance. The bounds is the smallest rectangle which completely contains the visible portion of the glyph. The bounds rectangle is relative to the glyph's origin. The left-side bearing is the distance from the glyph origin to the left of its bounds rectangle. If the left-side bearing is negative, part of the glyph is drawn to the left of its origin. The right-side bearing is the distance from the right side of the bounds rectangle to the next glyph origin (the origin plus the advance). If negative, part of the glyph is drawn to the right of the next glyph's origin.
Although instances of GlyphMetrics may be directly constructed, they are almost always obtained from a GlyphVector. Once constructed, GlyphMetrics are immutable.
Example:
Querying a Font for glyph information
Font font = ...; int glyphIndex = ...; GlyphMetrics metrics = GlyphVector.getGlyphMetrics(glyphIndex); int isStandard = metrics.isStandard(); float glyphAdvance = metrics.getAdvance();
Font
,
GlyphVector
Field Summary | |
static byte | COMBINING
This code indicates a glyph that represents a combining character, such as an umlaut. |
static byte | COMPONENT
This code indicates a glyph with no corresponding character in the backing store. |
static byte | LIGATURE
This code indicates a glyph that represents multiple characters as a ligature, for example 'fi' or 'ffi'. |
static byte | STANDARD
This code indicates a glyph that represents a single standard character. |
static byte | WHITESPACE
This code indicates a glyph with no visual representation. |
Constructor Summary | |
GlyphMetrics(float advance,
Rectangle2D bounds,
byte glyphType)
Construct a GlyphMetrics. |
Method Summary | |
float | getAdvance()
Return the advance width (height) of the glyph. |
Rectangle2D | getBounds2D()
Return the black box bounds of the glyph. |
float | getLSB()
Return the left (top) side bearing of the glyph. |
float | getRSB()
Return the right (bottom) side bearing of the glyph. |
int | getType()
Return the raw glyph type code. |
boolean | isCombining()
Return true if this is a combining glyph. |
boolean | isComponent()
Return true if this is a component glyph. |
boolean | isLigature()
Return true if this is a ligature glyph. |
boolean | isStandard()
Return true if this is a standard glyph. |
boolean | isWhitespace()
Return true if this is a whitespace glyph. |
Methods inherited from class java.lang.Object | |
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
Field Detail |
public static final byte STANDARD
public static final byte LIGATURE
public static final byte COMBINING
public static final byte COMPONENT
public static final byte WHITESPACE
Constructor Detail |
public GlyphMetrics(float advance, Rectangle2D bounds, byte glyphType)
advance
- the advance width (height) of the glyph
bounds
- the black box bounds of the glyph.
glyphType
- the type of the glyphMethod Detail |
public float getAdvance()
public Rectangle2D getBounds2D()
public float getLSB()
public float getRSB()
public int getType()
public boolean isStandard()
public boolean isLigature()
public boolean isCombining()
public boolean isComponent()
public boolean isWhitespace()
|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |