GlyphMetricsclass represents infomation for a single glyph. A glyph is the visual representation of one or more characters. Many different glyphs can be used to represent a single character or combination of characters.
GlyphMetricsinstances are produced by Font and are applicable to a specific glyph in a particular
Glyphs are either STANDARD, LIGATURE, COMBINING, or COMPONENT.
Other metrics available through
GlyphMetrics are the
components of the advance, the visual bounds, and the left and right
Glyphs for a rotated font, or obtained from a
which has applied a rotation to the glyph, can have advances that
contain both X and Y components. Usually the advance only has one
The advance of a glyph is the distance from the glyph's origin to the
origin of the next glyph along the baseline, which is either vertical
or horizontal. Note that, in a
the distance from a glyph to its following glyph might not be the
glyph's advance, because of kerning or other positioning adjustments.
The bounds is the smallest rectangle that completely contains the outline 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. Note that the bounds does not necessarily enclose all the pixels affected when rendering the glyph, because of rasterization and pixel adjustment effects.
Although instances of
GlyphMetrics can be directly
constructed, they are almost always obtained from a
GlyphVector. Once constructed,
objects are immutable.
Font for glyph information
Font font = ...; int glyphIndex = ...; GlyphMetrics metrics = GlyphVector.getGlyphMetrics(glyphIndex); int isStandard = metrics.isStandard(); float glyphAdvance = metrics.getAdvance();
|public static final byte||STANDARD||Indicates a glyph that represents a single standard character.|
|public static final byte||LIGATURE||Indicates a glyph that represents multiple characters as a ligature, for example 'fi' or 'ffi'. It is followed by filler glyphs for the remaining characters. Filler and combining glyphs can be intermixed to control positioning of accent marks on the logically preceeding ligature.|
|public static final byte||COMBINING||Indicates a glyph that represents a combining character, such as an umlaut. There is no caret position between this glyph and the preceeding glyph.|
|public static final byte||COMPONENT||Indicates a glyph with no corresponding character in the backing store. The glyph is associated with the character represented by the logicaly preceeding non-component glyph. This is used for kashida justification or other visual modifications to existing glyphs. There is no caret position between this glyph and the preceeding glyph.|
|public static final byte||WHITESPACE||Indicates a glyph with no visual representation. It can be added to the other code values to indicate an invisible glyph.|
public GlyphMetrics(float advance, Rectangle2D bounds, byte glyphType)
public GlyphMetrics(boolean horizontal, float advanceX, float advanceY, Rectangle2D bounds, byte glyphType)
|Method from java.awt.font.GlyphMetrics Summary:|
|getAdvance, getAdvanceX, getAdvanceY, getBounds2D, getLSB, getRSB, getType, isCombining, isComponent, isLigature, isStandard, isWhitespace|
|Methods from java.lang.Object:|
|clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait|
|Method from java.awt.font.GlyphMetrics Detail:|
public float getAdvance()
public float getAdvanceX()
public float getAdvanceY()
public Rectangle2D getBounds2D()
public float getLSB()
This is the distance from 0, 0 to the left (top) of the glyph bounds. If the bounds of the glyph is to the left of (above) the origin, the LSB is negative.
public float getRSB()
This is the distance from the right (bottom) of the glyph bounds to the advance. If the bounds of the glyph is to the right of (below) the advance, the RSB is negative.
public int getType()
public boolean isCombining()
public boolean isComponent()
public boolean isLigature()
public boolean isStandard()
public boolean isWhitespace()