TextRender

Inherited: Renderable

Description

The TextRender component allows you to display a text in both 2D and 3D scenes.

Public Methods

int

align () const

Vector4

color () const

Font *

font () const

int

fontSize () const

bool

kerning () const

void

setAlign (int alignment)

void

setColor (const Vector4 color)

void

setFont (Font * font)

void

setFontSize (int size)

void

setKerning (const bool kerning)

void

setMaterial (Material * material)

void

setSize (const Vector2 boundaries)

void

setText (const std::string text)

void

setWordWrap (bool wrap)

Vector2

size () const

std::string

text () const

bool

wordWrap () const

Static Methods

Vector2

cursorPosition (Font * font, int size, const std::string & text, bool kerning, const Vector2 & boundaries)

Methods Description

int TextRender::align () const

Returns text alignment policy.

See also setAlign().


Vector4 TextRender::color () const

Returns the color of the text to be drawn.

See also setColor().


Vector2 TextRender::cursorPosition (Font * font, int size, std::string & text, bool kerning, Vector2 & boundaries)

Returns the cursor position for rendering text with specified font and size. Developer can also enable kerning and specify a boundaries for the text.


:ref:`Font<api_Font>`* TextRender::font () const

Returns the font which will be used to draw a text.

See also setFont().


int TextRender::fontSize () const

Returns the size of the font.

See also setFontSize().


bool TextRender::kerning () const

Returns true if glyph kerning enabled; otherwise returns false.

See also setKerning().


void TextRender::setAlign (int alignment)

Sets text alignment policy.

See also align().


void TextRender::setColor (Vector4 color)

Changes the color of the text to be drawn.

See also *color*().


void TextRender::setFont (Font * font)

Changes the font which will be used to draw a text.

See also *font*().


void TextRender::setFontSize (int size)

Changes the size of the font.

See also fontSize().


void TextRender::setKerning (bool kerning)

Set true to enable glyph kerning and false to disable.

Note: Glyph kerning functionality depends on fonts which you are using. In case of font doesn’t support kerning, you will not see the difference.

See also *kerning*().


void TextRender::setMaterial (Material * material)

Reimplements: Renderable::setMaterial(Material *material).

Creates a new instance of material and assigns it.


void TextRender::setSize (Vector2 boundaries)

Changes the size of boundaries of the text area. This parameter is involved in Word Wrap calculations.

See also size().


void TextRender::setText (std::string text)

Changes the text which will be drawn.

See also *text*().


void TextRender::setWordWrap (bool wrap)

Sets the word wrap policy. Set true to enable word wrap and false to disable.

See also wordWrap().


Vector2 TextRender::size () const

Returns the boundaries of the text area. This parameter is involved in Word Wrap calculations.

See also setSize().


std::string TextRender::text () const

Returns the text which will be drawn.

See also setText().


bool TextRender::wordWrap () const

Returns true if word wrap enabled; otherwise returns false.

See also setWordWrap().