class::draw::Text

class draw::Text
  : public draw::Drawing

This is a text label. The object automatically chooses the correct font height to fit within the area specified.

In order for this class to work correctly, sys::Assets::init() must be invoked so that the application is aware of the system fonts.

Members

Text(

const var::ConstString & text
)

virtual void draw_to_scale(

const DrawingScaledAttr & attr
)

const sgfx::Font * font() const
sg_size_t font_point_size() const
int font_style() const
Text & set_align_bottom()
Text & set_align_center()
Text & set_align_left()
Text & set_align_middle()
Text & set_align_right()
Text & set_align_top()
Text & set_color(

sg_color_t value
)

Text & set_font(

sgfx::Font * font
)

Text & set_font_point_size(

sg_size_t v
)

Text & set_font_style(

u8 style
)

Text & set_string(

const var::ConstString & value
)

Details

Text(

const var::ConstString & text
)

Construct a label with text


virtual void draw_to_scale(

const DrawingScaledAttr & attr
)

Draw the scaled text as specified by attr


const sgfx::Font * font() const

Gets a pointer to the current font.


sg_size_t font_point_size() const

Return the font size


int font_style() const

Returns the font style.


Text & set_align_bottom()

Text & set_align_center()

Text & set_align_left()

Text & set_align_middle()

Text & set_align_right()

Text & set_align_top()

Text & set_color(

sg_color_t value
)


Text & set_font(

sgfx::Font * font
)

Specifies a font to use with the text.

If no font is specified, the text will use sys::Assets::find_font() to load a font that most closely matches font_point_size(). If font_point_size() is zero, the text will get a font that most close matches the height of the container without exceeding the container height.


Text & set_font_point_size(

sg_size_t v
)

Set the font size


Text & set_font_style(

u8 style
)

Sets the font style.

Parameters


Text & set_string(

const var::ConstString & value
)


X

Thanks for Coming!

Subscribe to news and updates