Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::TextRegion Class Reference

Renders formatted text within a geometry region. More...

#include <spk_text_region.hpp>

Collaboration diagram for spk::TextRegion:
Collaboration graph

Public Member Functions

 TextRegion ()
 Builds an empty text region.
void setFont (spk::Font *p_font)
 Sets the font used for rendering.
void setFontSize (const spk::Font::Size &p_size)
 Sets the font size used for rendering.
void setGlyphColor (const spk::Color &p_color)
 Sets the glyph fill color.
void setOutlineColor (const spk::Color &p_color)
 Sets the glyph outline color.
void setColors (const spk::Color &p_glyphColor, const spk::Color &p_outlineColor)
 Sets glyph and outline colors together.
void setAlignment (HorizontalAlignment p_horizontalAlignment, VerticalAlignment p_verticalAlignment)
 Sets text alignment within the region.
void setText (const std::wstring &p_text)
 Sets the text content.
void setLayer (const float &p_layer)
 Sets the rendering layer.
const float & layer () const
 Returns the current layer value.
spk::Fontfont () const
 Returns the current font pointer.
const spk::Font::SizefontSize () const
 Returns the current font size.
const spk::ColorglyphColor () const
 Returns the glyph fill color.
const spk::ColoroutlineColor () const
 Returns the glyph outline color.
const std::wstring & text () const
 Returns the current text content.
HorizontalAlignment horizontalAlignment () const
 Returns the horizontal alignment setting.
VerticalAlignment verticalAlignment () const
 Returns the vertical alignment setting.
void setGeometry (const spk::Extend2D &p_geometry)
 Sets the geometry used to render the text.
const spk::Extend2Dgeometry () const
 Returns the current render geometry.
const spk::Vector2UInt computeTextSize () const
 Computes the text size using current font settings.
void render ()
 Renders the text region.

Detailed Description

Renders formatted text within a geometry region.

See also
Font
text.setText(L"Hello");
text.render();
Renders formatted text within a geometry region.
Definition spk_text_region.hpp:24
const std::wstring & text() const
Returns the current text content.
Definition spk_text_region.cpp:144

Member Function Documentation

◆ computeTextSize()

const spk::Vector2UInt spk::TextRegion::computeTextSize ( ) const

Computes the text size using current font settings.

Returns
Size in pixels.
Here is the call graph for this function:

◆ font()

spk::Font * spk::TextRegion::font ( ) const

Returns the current font pointer.

Returns
Font pointer.

◆ fontSize()

const spk::Font::Size & spk::TextRegion::fontSize ( ) const

Returns the current font size.

Returns
Font size.

◆ geometry()

const spk::Extend2D & spk::TextRegion::geometry ( ) const

Returns the current render geometry.

Returns
Render geometry.

◆ glyphColor()

const spk::Color & spk::TextRegion::glyphColor ( ) const

Returns the glyph fill color.

Returns
Glyph color.

◆ horizontalAlignment()

HorizontalAlignment spk::TextRegion::horizontalAlignment ( ) const

Returns the horizontal alignment setting.

Returns
Horizontal alignment.

◆ layer()

const float & spk::TextRegion::layer ( ) const

Returns the current layer value.

Returns
Layer value.

◆ outlineColor()

const spk::Color & spk::TextRegion::outlineColor ( ) const

Returns the glyph outline color.

Returns
Outline color.

◆ setAlignment()

void spk::TextRegion::setAlignment ( HorizontalAlignment p_horizontalAlignment,
VerticalAlignment p_verticalAlignment )

Sets text alignment within the region.

Parameters
p_horizontalAlignmentHorizontal alignment.
p_verticalAlignmentVertical alignment.

◆ setColors()

void spk::TextRegion::setColors ( const spk::Color & p_glyphColor,
const spk::Color & p_outlineColor )

Sets glyph and outline colors together.

Parameters
p_glyphColorGlyph color.
p_outlineColorOutline color.

◆ setFont()

void spk::TextRegion::setFont ( spk::Font * p_font)

Sets the font used for rendering.

Parameters
p_fontFont pointer to use.

◆ setFontSize()

void spk::TextRegion::setFontSize ( const spk::Font::Size & p_size)

Sets the font size used for rendering.

Parameters
p_sizeFont size.

◆ setGeometry()

void spk::TextRegion::setGeometry ( const spk::Extend2D & p_geometry)

Sets the geometry used to render the text.

Parameters
p_geometryRender geometry.

◆ setGlyphColor()

void spk::TextRegion::setGlyphColor ( const spk::Color & p_color)

Sets the glyph fill color.

Parameters
p_colorGlyph color.

◆ setLayer()

void spk::TextRegion::setLayer ( const float & p_layer)

Sets the rendering layer.

Parameters
p_layerLayer value.

◆ setOutlineColor()

void spk::TextRegion::setOutlineColor ( const spk::Color & p_color)

Sets the glyph outline color.

Parameters
p_colorOutline color.

◆ setText()

void spk::TextRegion::setText ( const std::wstring & p_text)

Sets the text content.

Parameters
p_textText to render.

◆ text()

const std::wstring & spk::TextRegion::text ( ) const

Returns the current text content.

Returns
Text string.

◆ verticalAlignment()

VerticalAlignment spk::TextRegion::verticalAlignment ( ) const

Returns the vertical alignment setting.

Returns
Vertical alignment.

The documentation for this class was generated from the following files:
  • includes/structure/widget/components/spk_text_region.hpp
  • srcs/structure/widget/components/spk_text_region.cpp