Constructs an unconfigured, empty label. Depending on the label type, transformations are applied once when typesetting (static) or every frame during rendering (dynamic).
The text that is displayed by this label.
Either static or dynamic. If static is used, all transformations are baked and modifications to any of the label's transformations are expected to occur less often.
The font face that should be used for that label, or undefined if set later.
Stores the resulting dynamic transform. This is intended to be used when in dynamic mode. (e.g., for calculations to the final transform).
Stores the resulting dynamic transform. This is intended to be used when in dynamic mode. (e.g., for calculations to the final transform).
If enabled, shrinks the label to line width. Depending on the elide mode, the ellipses is put left, middle, or right. The ellipsis string can be adjusted (@see ellipsis). If the labels text does not exceed the line width no elide will be applied.
If enabled, shrinks the label to line width. Depending on the elide mode, the ellipses is put left, middle, or right. The ellipsis string can be adjusted (@see ellipsis). If the labels text does not exceed the line width no elide will be applied.
Returns the width and height of the typset label in fontSizeUnit. Both are zero if not typeset yet. The static transform is already applied.
The typesetter sets this extent after typesetting and applying the static transform. Don't set this manually without typesetting.
Font face used for typesetting, transformation, and rendering. To avoid unnecessary state changes when rendering, prefer to add labels of the same font face consecutively (since this specifies draw sequence and state change occurs whenever font face changes between two subsequent labels).
Font face used for typesetting, transformation, and rendering. To avoid unnecessary state changes when rendering, prefer to add labels of the same font face consecutively (since this specifies draw sequence and state change occurs whenever font face changes between two subsequent labels).
The currently used font size. (@see fontSizeUnit)
The currently used font size. (@see fontSizeUnit)
Length of the text, i.e., number of characters within the text.
Vertical text anchor point used for positional reference.
Vertical text anchor point used for positional reference.
Character that is to be used for Line feed.
Width of a single line in typesetting space (the unit used while Typesetting, i.e., the unit as the font face's glyph texture atlas). Since the font face needs to be defined in order to typeset, we assume here that the label has a defined fontFace.
Line width used to either maximum length for elide or maximum length for line breaks due to word wrap. The line width is expected in font size.
Transformation used to move, scale, rotate, skew, etc. the label into an arbitrary coordinate space (e.g., screen space, world space, ...). This can be set either explicitly or implicitly using various transformation utility functions. @todo review/refine this.
Transformation used to move, scale, rotate, skew, etc. the label into an arbitrary coordinate space (e.g., screen space, world space, ...). This can be set either explicitly or implicitly using various transformation utility functions. @todo review/refine this.
Read-only access to this labels type specified at construction time. Static labels are baking as much transformations as possible into the glyph vertices (used for GPU). This means, when the position or size changes, the label must be typeset again and vertices are fully re-computed. For dynamic labels, only most relevant transformations are applied and dynamic transformations such as rotation, translation, scale etc, are applied during rendering without requiring re-typesetting or re-computation of vertices. The type, however, does not relate to the text. Whenever the text changes, re-typesetting etc. have to be invoked.
Returns whether or not this label is ready to be rendered (aka has a font face with valid texture as well as a text with a length > 0).
If enabled, breaks lines automatically at line width (while typesetting). Note that elide mode takes precedence.
If enabled, breaks lines automatically at line width (while typesetting). Note that elide mode takes precedence.
Returns the advancement of the glyph at given index.
The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.
Returns the character at the specified index.
The zero-based index of the desired character.
character at the specified index
Returns the Unicode value (codepoint) of the character at the specified location.
The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.
Gets the kerning value after (i.e., right in left-to-right writing systems) the given glyph index.
index of the glyph in this label
Gets the kerning value before (i.e., left in left-to-right writing systems) the given glyph index.
index of the glyph in this label
Returns, whether or not the character at a given index is equal to the default or the text's line feed character.
The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.
Intended for resetting alteration status.
Convenience getter to the label's text as string.
the label's text as string
Interface intended to compute/update the label's static and dynamic transformations as well as invoking the typesetter in order to create the glyph vertices. Returns undefined, if previous vertices can be reused since no typesetting was required. Returns an empty GlyphVertices storage if label is invalid or cannot be rendered ...
Creates an Array of glyph vertices, ready to be used in the Typesetter.
Returns the window device pixel ratio. If this is not available/undefined 1.0 is returned.
Object comprising a text reference, a font face, and additional typographic information for type setting, rendering, and interaction. Multiple labels might reference the same text, but could be placed at different locations or rendered applying different font faces, styles etc.