UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1

ObjectText Class

The ObjectText class allows rendering flat text in a scene.

ObjectText Class

This class inherits from Object

Members


ObjectText ()

Default constructor. Creates an empty object with no text and font set.

ObjectText (string font)

Constructor. Creates an object with no text but with the specified font.

Arguments

  • string font - The path to the TTF font relatively to the data directory.

ObjectText (string font, string text)

Constructor. Creates an object with the set font and text.

Arguments

  • string font - The path to the TTF font relatively to the data directory.
  • string text - The text (can be either plain or rich).

int getFontHSpacing ()

Returns the horizontal spacing between letters (kerning value).

Return value

The horizontal spacing, in dots.

string getFontName ()

Returns the path to the TTF font specified in the node.

Return value

The path to the font relatively to the data directory, if specified; otherwise — the empty string.

int getFontOutline ()

Returns the flag indicating if the text outline is enabled.

Return value

1 — the outline is enabled; 0 — disabled.

int getFontResolution ()

Returns the text resolution value.

Return value

The text resolution value.

int getFontRich ()

Returns the value indicating if the rich text is enabled.

Return value

1 — the rich text is enabled; 0 — disabled.

int getFontSize ()

Returns the text font size.

Return value

The text font size, in dots.

int getFontVSpacing ()

Returns the vertical spacing between letters (kerning value).

Return value

The vertical spacing, in dots.

vec4 getTextColor ()

Returns the color of the text.

Return value

The text color in the RGBA range.

string getText ()

Returns the text set in the node.

Return value

The text.

void setFontHSpacing (int spacing)

Sets the horizontal spacing between letters (kerning value). This parameter influences the text's physical size.

Arguments

  • int spacing - The horizontal spacing value.

void setFontName (string font)

Sets the path to the TTF font.

Arguments

  • string font - The path to the TTF font relatively to the data directory.

void setFontOutline (int outline)

Sets the outline for the text. The outline looks like the dark shadow in the right lower corner of the text and is displaced by one dot.

Arguments

  • int outline - 1 — to enable the outline; 0 — to disable.

void setFontResolution (int resolution)

Sets the resolution of the texture into which the text will be rendered. The lower the value, the less detailed will be the text, the less video memory will be required for the texture. It doesn't influence the text's physical size.

Arguments

  • int resolution - The font resolution.

void setFontRich (int rich)

Sets the flag indicating if the rich text is enabled.

Arguments

  • int rich - 1 — to enable the rich text; 0 — to disable.

void setFontSize (int size)

Sets the size of the text font. The more dots, the higher the size of the font. To match dots with a 3D space, there is a set value: 288 dots per unit. For example, if you have the Arial font with the size of 20, the physical height of the letter can be calculated as 20/288=0.0694 units.

Arguments

  • int size - The size of the text, in dots.

void setFontVSpacing (int spacing)

Sets the vertical spacing between letters (kerning value). This parameter influences the text's physical size.

Arguments

  • int spacing - The vertical spacing value.

void setTextColor (vec4 color)

Sets the color of the text.

Arguments

  • vec4 color - The color of the text in the RGBA range.

void setText (string text)

Sets the text for the node. Can be either a plain or rich text.

Arguments

  • string text - The text.
Last update: 2017-07-03