This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

ObjectText Class

To use this class, include the UnigineObjects.h file.

ObjectText Class

Members


ObjectText ()

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

ObjectText (const char * font_name)

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

Arguments

  • const char * font_name - The path to the TTF font relatively to the data directory.

ObjectText (const char * font_name, const char * text)

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

Arguments

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

int getFontResolution ()

Returns the text resolution value.

Return value

The text resolution value.

void setTextWrapWidth (float width)

Sets text wrap width in units. The text will wrap if its physical size will be greater than the set value. If 0 is set, text wrapping is disabled.

Arguments

  • float width - Wrap width in units.

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 setText (const char * text)

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

Arguments

  • const char * text - The text.

const char * getFontName ()

Returns the path to the TTF font specified in the node.
Notice
Names of font files for bold, italic and bold italic fonts must have the b, i and bi postfixes correspondingly. For example: myfontb.ttf, myfontbi.ttf.

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.

void setFontVSpacing (int vspacing)

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

Arguments

  • int vspacing - The vertical spacing value.

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.

int getFontVSpacing ()

Returns the vertical spacing between letters (kerning value).

Return value

The vertical spacing, in dots.

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.

float getTextWrapWidth ()

Returns the current text wrap width in units.

Return value

Wrap width in units.

void setFontHSpacing (int hspacing)

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

Arguments

  • int hspacing - The horizontal spacing value.

const char * getText ()

Returns the text set in the node.

Return value

The text.

int getFontSize ()

Returns the text font size.

Return value

The text font size, in dots.

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.

int getFontRich ()

Returns the value indicating if the rich text is enabled.

Return value

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

int getFontHSpacing ()

Returns the horizontal spacing between letters (kerning value).

Return value

The horizontal spacing, in dots.

void setTextColor (const Math::vec4 & color)

Sets the color of the text.

Arguments

  • const Math::vec4 & color - The color of the text in the RGBA range.

void setFontName (const char * name)

Sets the path to the TTF font.
Notice
Names of font files for bold, italic and bold italic fonts must have the b, i and bi postfixes correspondingly. For example: myfontb.ttf, myfontbi.ttf.

Arguments

  • const char * name - The path to the TTF font relatively to the data directory.

Math::vec4 getTextColor ()

Returns the color of the text.

Return value

The text color in the RGBA range.
Last update: 03.07.2017
Build: ()