Constructs a pre-configured projected 3D-label with given text. 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 on 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.
The camera is used to retrieve (1) the view projection matrix, and (2) the width and height of targeted frame. (1) is used to project the 3D label as a 2D label, (2) is used to calculate the font size in px units. Setting the camera invalidates the transform.
The camera is used to retrieve (1) the view projection matrix, and (2) the width and height of targeted frame. (1) is used to project the 3D label as a 2D label, (2) is used to calculate the font size in px units. Setting the camera invalidates the transform.
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)
This unit is used for the font size. This method overrides the super.fontSizeUnit, since Projected3DLabel
only
supports Pixel, for now.
(@see fontSize)
This unit is used for the font size. This method overrides the super.fontSizeUnit, since Projected3DLabel
only
supports Pixel, for now.
(@see fontSize)
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
If altered, creates a position and direction-vector, then prepares the vertex storage and invokes typesetting. Depending on the label's type (static or dynamic) the transform is stored and applied either during typesetting (static) or passed as single transform to the vertex shader during rendering (dynamic).
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.
A Label that can be positioned in 3D space, but projected onto a 2D plane (a.k.a. screen). The unit for positioning is world space, the unit for size is pixel (px).