The GlyphMetrics class represents information 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. GlyphMetrics instances are produced by Font and are applicable to a specific glyph in a particular Font.
Glyphs are either STANDARD, LIGATURE, COMBINING, or COMPONENT.
STANDARD glyphs are commonly used to represent single characters. LIGATURE glyphs are used to represent sequences of characters. COMPONENT glyphs in a GlyphVector 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 components of the advance, the visual bounds, and the left and right side bearings.
Glyphs for a rotated font, or obtained from a GlyphVector which has applied a rotation to the glyph, can have advances that contain both X and Y components. Usually the advance only has one component.
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 GlyphVector, 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, GlyphMetrics objects 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();
The GlyphMetrics class represents information 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. GlyphMetrics instances are produced by Font and are applicable to a specific glyph in a particular Font. Glyphs are either STANDARD, LIGATURE, COMBINING, or COMPONENT. STANDARD glyphs are commonly used to represent single characters. LIGATURE glyphs are used to represent sequences of characters. COMPONENT glyphs in a GlyphVector 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 components of the advance, the visual bounds, and the left and right side bearings. Glyphs for a rotated font, or obtained from a GlyphVector which has applied a rotation to the glyph, can have advances that contain both X and Y components. Usually the advance only has one component. 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 GlyphVector, 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, GlyphMetrics objects 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();
Static Constant.
Indicates a glyph that represents a combining character, such as an umlaut. There is no caret position between this glyph and the preceding glyph.
type: byte
Static Constant. Indicates a glyph that represents a combining character, such as an umlaut. There is no caret position between this glyph and the preceding glyph. type: byte
Static Constant.
Indicates a glyph with no corresponding character in the backing store. The glyph is associated with the character represented by the logically preceding 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 preceding glyph.
type: byte
Static Constant. Indicates a glyph with no corresponding character in the backing store. The glyph is associated with the character represented by the logically preceding 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 preceding glyph. type: byte
Static Constant.
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 preceding ligature.
type: byte
Static Constant. 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 preceding ligature. type: byte
Static Constant.
Indicates a glyph that represents a single standard character.
type: byte
Static Constant. Indicates a glyph that represents a single standard character. type: byte
Static Constant.
Indicates a glyph with no visual representation. It can be added to the other code values to indicate an invisible glyph.
type: byte
Static Constant. Indicates a glyph with no visual representation. It can be added to the other code values to indicate an invisible glyph. type: byte
(->glyph-metrics advance bounds glyph-type)
(->glyph-metrics horizontal advance-x advance-y bounds glyph-type)
Constructor.
Constructs a GlyphMetrics object.
horizontal - if true, metrics are for a horizontal baseline, otherwise they are for a vertical baseline - boolean
advance-x - the X-component of the glyph's advance - float
advance-y - the Y-component of the glyph's advance - float
bounds - the visual bounds of the glyph - java.awt.geom.Rectangle2D
glyph-type - the type of the glyph - byte
Constructor. Constructs a GlyphMetrics object. horizontal - if true, metrics are for a horizontal baseline, otherwise they are for a vertical baseline - `boolean` advance-x - the X-component of the glyph's advance - `float` advance-y - the Y-component of the glyph's advance - `float` bounds - the visual bounds of the glyph - `java.awt.geom.Rectangle2D` glyph-type - the type of the glyph - `byte`
(combining? this)
Returns true if this is a combining glyph.
returns: true if this is a combining glyph;
false otherwise. - boolean
Returns true if this is a combining glyph. returns: true if this is a combining glyph; false otherwise. - `boolean`
(component? this)
Returns true if this is a component glyph.
returns: true if this is a component glyph;
false otherwise. - boolean
Returns true if this is a component glyph. returns: true if this is a component glyph; false otherwise. - `boolean`
(get-advance this)
Returns the advance of the glyph along the baseline (either horizontal or vertical).
returns: the advance of the glyph - float
Returns the advance of the glyph along the baseline (either horizontal or vertical). returns: the advance of the glyph - `float`
(get-advance-x this)
Returns the x-component of the advance of the glyph.
returns: the x-component of the advance of the glyph - float
Returns the x-component of the advance of the glyph. returns: the x-component of the advance of the glyph - `float`
(get-advance-y this)
Returns the y-component of the advance of the glyph.
returns: the y-component of the advance of the glyph - float
Returns the y-component of the advance of the glyph. returns: the y-component of the advance of the glyph - `float`
(get-bounds-2-d this)
Returns the bounds of the glyph. This is the bounding box of the glyph outline. Because of rasterization and pixel alignment effects, it does not necessarily enclose the pixels that are affected when rendering the glyph.
returns: a Rectangle2D that is the bounds of the glyph. - java.awt.geom.Rectangle2D
Returns the bounds of the glyph. This is the bounding box of the glyph outline. Because of rasterization and pixel alignment effects, it does not necessarily enclose the pixels that are affected when rendering the glyph. returns: a Rectangle2D that is the bounds of the glyph. - `java.awt.geom.Rectangle2D`
(get-lsb this)
Returns the left (top) side bearing of the glyph.
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.
returns: the left side bearing of the glyph. - float
Returns the left (top) side bearing of the glyph. 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. returns: the left side bearing of the glyph. - `float`
(get-rsb this)
Returns the right (bottom) side bearing of the glyph.
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.
returns: the right side bearing of the glyph. - float
Returns the right (bottom) side bearing of the glyph. 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. returns: the right side bearing of the glyph. - `float`
(get-type this)
Returns the raw glyph type code.
returns: the raw glyph type code. - int
Returns the raw glyph type code. returns: the raw glyph type code. - `int`
(ligature? this)
Returns true if this is a ligature glyph.
returns: true if this is a ligature glyph;
false otherwise. - boolean
Returns true if this is a ligature glyph. returns: true if this is a ligature glyph; false otherwise. - `boolean`
(standard? this)
Returns true if this is a standard glyph.
returns: true if this is a standard glyph;
false otherwise. - boolean
Returns true if this is a standard glyph. returns: true if this is a standard glyph; false otherwise. - `boolean`
(whitespace? this)
Returns true if this is a whitespace glyph.
returns: true if this is a whitespace glyph;
false otherwise. - boolean
Returns true if this is a whitespace glyph. returns: true if this is a whitespace glyph; false otherwise. - `boolean`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close