Glyph class

Glyph describes a single character/ligature/icon within a SpriteFont.

A glyph has an associated "glyph box", which is the box where the glyph is logically located. Here "logically" means that it includes not only the character itself, but also some padding around it as necessary for the character to look nice within the text. For all glyphs in a font, their boxes will have the same height (which is the font size), the same ascent and descent, but possibly different widths.

The properties left, top, width and height describe the location of the glyph box within the source image.

In addition to the logical "glyph box", a glyph may also have a "source box", which describes a rectangle within the source image where the glyph's pixels are actually located. The source box may be larger or smaller than the glyph box. It will be larger if the glyph has a particularly large flourish that trespasses upon other characters' space; or smaller if the characters are packed too tightly in the source image, or if you're trying to improve rendering performance by not copying empty pixels.

Constructors

Glyph(String char, {required double left, required double top, double? width, double? height, double? srcLeft, double? srcTop, double? srcRight, double? srcBottom})

Properties

char String
final
hashCode int
The hash code for this object.
no setterinherited
height double
getter/setter pair
left double
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
srcBottom double
getter/setter pair
srcLeft double
getter/setter pair
srcRight double
getter/setter pair
srcTop double
getter/setter pair
top double
final
width double
getter/setter pair

Methods

initialize(double defaultCharWidth, double charHeight) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited