Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
java.lang.Object | +----java.awt.font.GlyphMetrics
Glyphs are either STANDARD, LIGATURE, COMBINING, COMPONENT, or FILLER. They also may be marked as being either WHITESPACE or HANGING_PUNCTUATION. STANDARD glyphs are commonly used to represent single characters. LIGATURE glyphs are always the first glyph in a sequence of glyphs that combine to represent a set of "combining characters," such as the 'fi' ligature found in some fonts. A LIGATURE glyph in a GlyphSet is always followed by one or more FILLER glyphs. The number of LIGATURE and FILLER glyphs is always the same as the number of characters represented by the ligature. COMPONENT glyphs in a GlyphSet do not correspond to a particular character in a text model. Instead, COMPONENT glyphs are added for typographical reasons (such as Arabic justification). COMBINING glyphs embellish STANDARD or LIGATURE glyphs, such as accent marks. Carets do not appear before COMBINING glyphs.
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 glyphset, 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 Font. Once constructed, GlyphMetrics are immutable.
Example:
Querying a Font for glyph information
Font font = ...; int glyphCode = ...; GlyphMetrics metrics = font.getGlyphMetrics(glyphCode); int isStandard = metrics.isStandard(); float glyphAdvance = metrics.getAdvance();
Field Summary | |
static byte | COMBINING
|
static byte | COMPONENT
|
static byte | FILLER
|
static byte | HANGING_PUNCTUATION
|
static byte | LIGATURE
|
static byte | STANDARD
|
static byte | WHITESPACE
|
Constructor Summary | |
GlyphMetrics(float advance,
Rectangle2D bounds,
byte glyphType)
|
Method Summary | |
float | getAdvance()
|
Rectangle2D | getBounds2D()
|
float | getLSB()
|
float | getRSB()
|
byte | getType()
|
boolean | isCombining()
|
boolean | isComponent()
|
boolean | isFiller()
|
boolean | isHangingPunctuation()
|
boolean | isLigature()
|
boolean | isStandard()
|
boolean | isWhitespace()
|
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 FILLER
public static final byte HANGING_PUNCTUATION
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 glyph
Method Detail |
public float getAdvance()
public Rectangle2D getBounds2D()
public float getLSB()
public float getRSB()
public byte getType()
public boolean isStandard()
public boolean isLigature()
public boolean isCombining()
public boolean isComponent()
public boolean isFiller()
public boolean isWhitespace()
public boolean isHangingPunctuation()
Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |