The GUI class used to draw text on the screen. More...
#include <gui_fontstring.hpp>
Public Member Functions | |
font_string (manager *pManager) | |
Constructor. | |
virtual | ~font_string () |
Destructor. | |
virtual std::string | serialize (const std::string &sTab) const |
Prints all relevant information about this widget in a string. | |
virtual void | render () |
Renders this widget on the current render target. | |
virtual void | copy_from (uiobject *pObj) |
Copies an uiobject's parameters into this font_string (inheritance). | |
virtual void | update (float fDelta) |
updates this widget's logic. | |
const std::string & | get_font_name () const |
Returns the name of the font file. | |
uint | get_font_height () const |
Returns the heigh of the font. | |
void | set_outlined (bool bIsOutlined) |
Adds or remove the outline around the text. | |
bool | is_outlined () const |
Check if this font_string is outlined. | |
text::alignment | get_justify_h () const |
Returns the horizontal alignment behavior. | |
text::vertical_alignment | get_justify_v () const |
Returns the vertical alignment behavior. | |
const color & | get_shadow_color () const |
Returns this font_string's shadow color. | |
std::array< int, 2 > | get_shadow_offsets () const |
Returns this font_string's shadow offsets. | |
int | get_shadow_x_offset () const |
Returns this font_string's shadow X offset. | |
int | get_shadow_y_offset () const |
Returns this font_string's shadow Y offset. | |
std::array< int, 2 > | get_offsets () const |
Returns this font_string's offsets. | |
float | get_spacing () const |
Returns the space between each letter. | |
const color & | get_text_color () const |
Returns the text color. | |
void | set_font (const std::string &sFontName, uint uiHeight) |
Sets this font_string's font (file and size). | |
void | set_justify_h (text::alignment mJustifyH) |
Sets this font_string's horizontal aligment behavior. | |
void | set_justify_v (text::vertical_alignment mJustifyV) |
Sets this font_string's vertical aligment behavior. | |
void | set_shadow_color (const color &mShadowColor) |
Sets this font_string's shadow color. | |
void | set_shadow_offsets (int iShadowXOffset, int iShadowYOffset) |
Sets this font_string's shadow offsets. | |
void | set_shadow_offsets (const std::array< int, 2 > &lShadowOffsets) |
Sets this font_string's shadow offsets. | |
void | set_offsets (int iXOffset, int iYOffset) |
Sets this font_string's offsets. | |
void | set_offsets (const std::array< int, 2 > &lOffsets) |
Sets this font_string's offsets. | |
void | set_spacing (float fSpacing) |
Sets the space between each letter. | |
void | set_text_color (const color &mTextColor) |
Sets the text color. | |
bool | can_non_space_wrap () const |
Checks is large text is truncated or wrapped. | |
float | get_string_height () const |
Returns the height of the string if not format is applied. | |
float | get_string_width () const |
Returns the width of the string if not format is applied. | |
const std::string & | get_text () const |
Returns the rendered text (with format tags). | |
const utils::ustring & | get_unicode_text () const |
Returns the rendered text (with format tags, unicode character set). | |
void | set_non_space_wrap (bool bCanNonSpaceWrap) |
Sets whether large text is truncated or wrapped. | |
bool | has_shadow () const |
Checks if this font_string draws a shadow under its text. | |
void | set_shadow (bool bHasShadow) |
Sets whether this font_string should draw a shadow under its text. | |
void | set_word_wrap (bool bCanWordWrap, bool bAddEllipsis) |
Enables word wrap. | |
bool | can_word_wrap () const |
Checks if word wrap is enabled. | |
void | enable_formatting (bool bFormatting) |
Enables color formatting. | |
bool | is_formatting_enabled () const |
Checks if color formatting is enabled. | |
void | set_text (const std::string &sText) |
Sets the rendered text. | |
virtual void | create_glue () |
Creates the associated Lua glue. | |
virtual void | parse_block (xml::block *pBlock) |
Parses data from an xml::block. | |
utils::wptr< text > | get_text_object () |
Returns the text used to render this fontString. | |
Static Public Member Functions | |
static void | register_glue (utils::wptr< lua::state > pLua) |
Registers this widget to the provided lua::state. |
The GUI class used to draw text on the screen.
This object contains formated text, managed by the text class.
Definition at line 14 of file gui_fontstring.hpp.
gui::font_string::font_string | ( | manager * | pManager | ) | [explicit] |
Constructor.
Definition at line 14 of file gui_fontstring.cpp.
gui::font_string::~font_string | ( | ) | [virtual] |
Destructor.
Definition at line 25 of file gui_fontstring.cpp.
bool gui::font_string::can_non_space_wrap | ( | ) | const |
Checks is large text is truncated or wrapped.
Definition at line 370 of file gui_fontstring.cpp.
bool gui::font_string::can_word_wrap | ( | ) | const |
Checks if word wrap is enabled.
Definition at line 436 of file gui_fontstring.cpp.
void gui::font_string::copy_from | ( | uiobject * | pObj | ) | [virtual] |
Copies an uiobject's parameters into this font_string (inheritance).
pObj | The uiobject to copy |
Definition at line 154 of file gui_fontstring.cpp.
void gui::font_string::create_glue | ( | ) | [virtual] |
Creates the associated Lua glue.
Reimplemented from gui::layered_region.
Definition at line 145 of file gui_fontstring.cpp.
void gui::font_string::enable_formatting | ( | bool | bFormatting | ) |
Enables color formatting.
bFormatting | 'true' to enable color formatting |
Definition at line 441 of file gui_fontstring.cpp.
uint gui::font_string::get_font_height | ( | ) | const |
Returns the heigh of the font.
Definition at line 188 of file gui_fontstring.cpp.
const std::string & gui::font_string::get_font_name | ( | ) | const |
Returns the name of the font file.
Definition at line 183 of file gui_fontstring.cpp.
text::alignment gui::font_string::get_justify_h | ( | ) | const |
Returns the horizontal alignment behavior.
Definition at line 207 of file gui_fontstring.cpp.
text::vertical_alignment gui::font_string::get_justify_v | ( | ) | const |
Returns the vertical alignment behavior.
Definition at line 212 of file gui_fontstring.cpp.
std::array< int, 2 > gui::font_string::get_offsets | ( | ) | const |
Returns this font_string's offsets.
Definition at line 227 of file gui_fontstring.cpp.
const color & gui::font_string::get_shadow_color | ( | ) | const |
Returns this font_string's shadow color.
Definition at line 217 of file gui_fontstring.cpp.
std::array< int, 2 > gui::font_string::get_shadow_offsets | ( | ) | const |
Returns this font_string's shadow offsets.
Definition at line 222 of file gui_fontstring.cpp.
int gui::font_string::get_shadow_x_offset | ( | ) | const |
Returns this font_string's shadow X offset.
Definition at line 232 of file gui_fontstring.cpp.
int gui::font_string::get_shadow_y_offset | ( | ) | const |
Returns this font_string's shadow Y offset.
Definition at line 237 of file gui_fontstring.cpp.
float gui::font_string::get_spacing | ( | ) | const |
Returns the space between each letter.
Definition at line 242 of file gui_fontstring.cpp.
float gui::font_string::get_string_height | ( | ) | const |
Returns the height of the string if not format is applied.
Definition at line 375 of file gui_fontstring.cpp.
float gui::font_string::get_string_width | ( | ) | const |
Returns the width of the string if not format is applied.
Definition at line 383 of file gui_fontstring.cpp.
const std::string & gui::font_string::get_text | ( | ) | const |
Returns the rendered text (with format tags).
Definition at line 391 of file gui_fontstring.cpp.
const color & gui::font_string::get_text_color | ( | ) | const |
utils::wptr< text > gui::font_string::get_text_object | ( | ) |
Returns the text used to render this fontString.
Definition at line 466 of file gui_fontstring.cpp.
const utils::ustring & gui::font_string::get_unicode_text | ( | ) | const |
Returns the rendered text (with format tags, unicode character set).
Definition at line 396 of file gui_fontstring.cpp.
bool gui::font_string::has_shadow | ( | ) | const |
Checks if this font_string draws a shadow under its text.
Definition at line 414 of file gui_fontstring.cpp.
bool gui::font_string::is_formatting_enabled | ( | ) | const |
Checks if color formatting is enabled.
Definition at line 448 of file gui_fontstring.cpp.
bool gui::font_string::is_outlined | ( | ) | const |
Check if this font_string is outlined.
Definition at line 202 of file gui_fontstring.cpp.
void gui::font_string::parse_block | ( | xml::block * | pBlock | ) | [virtual] |
Parses data from an xml::block.
pBlock | The font_string's xml::block |
Reimplemented from gui::layered_region.
Definition at line 8 of file gui_fontstring_parser.cpp.
void gui::font_string::register_glue | ( | utils::wptr< lua::state > | pLua | ) | [static] |
Registers this widget to the provided lua::state.
Definition at line 10 of file gui_fontstring_glues.cpp.
void gui::font_string::render | ( | ) | [virtual] |
Renders this widget on the current render target.
Reimplemented from gui::region.
Definition at line 29 of file gui_fontstring.cpp.
std::string gui::font_string::serialize | ( | const std::string & | sTab | ) | const [virtual] |
Prints all relevant information about this widget in a string.
sTab | The offset to give to all lines |
Reimplemented from gui::layered_region.
Definition at line 103 of file gui_fontstring.cpp.
void gui::font_string::set_font | ( | const std::string & | sFontName, | |
uint | uiHeight | |||
) |
Sets this font_string's font (file and size).
sFontName | The file path to the .ttf file | |
uiHeight | The font height |
Definition at line 252 of file gui_fontstring.cpp.
void gui::font_string::set_justify_h | ( | text::alignment | mJustifyH | ) |
Sets this font_string's horizontal aligment behavior.
mJustifyH | The horizontal alignment behavior |
Definition at line 270 of file gui_fontstring.cpp.
void gui::font_string::set_justify_v | ( | text::vertical_alignment | mJustifyV | ) |
Sets this font_string's vertical aligment behavior.
mJustifyV | The vertical alignment behavior |
Definition at line 283 of file gui_fontstring.cpp.
void gui::font_string::set_non_space_wrap | ( | bool | bCanNonSpaceWrap | ) |
Sets whether large text is truncated or wrapped.
bCanNonSpaceWrap | 'true' to truncate the text |
Definition at line 405 of file gui_fontstring.cpp.
void gui::font_string::set_offsets | ( | const std::array< int, 2 > & | lOffsets | ) |
Sets this font_string's offsets.
lOffsets | Offsets |
Definition at line 338 of file gui_fontstring.cpp.
void gui::font_string::set_offsets | ( | int | iXOffset, | |
int | iYOffset | |||
) |
Sets this font_string's offsets.
iXOffset | The horizontal offset | |
iYOffset | The vertical offset |
Definition at line 328 of file gui_fontstring.cpp.
void gui::font_string::set_outlined | ( | bool | bIsOutlined | ) |
Adds or remove the outline around the text.
bIsOutlined | 'true' to enable the outline |
Definition at line 193 of file gui_fontstring.cpp.
void gui::font_string::set_shadow | ( | bool | bHasShadow | ) |
Sets whether this font_string should draw a shadow under its text.
bHasShadow | 'true' to enable shadow |
Definition at line 419 of file gui_fontstring.cpp.
void gui::font_string::set_shadow_color | ( | const color & | mShadowColor | ) |
Sets this font_string's shadow color.
mShadowColor | The shadow color |
Definition at line 296 of file gui_fontstring.cpp.
void gui::font_string::set_shadow_offsets | ( | const std::array< int, 2 > & | lShadowOffsets | ) |
Sets this font_string's shadow offsets.
lShadowOffsets | Offsets |
Definition at line 317 of file gui_fontstring.cpp.
void gui::font_string::set_shadow_offsets | ( | int | iShadowXOffset, | |
int | iShadowYOffset | |||
) |
Sets this font_string's shadow offsets.
iShadowXOffset | The horizontal offset | |
iShadowYOffset | The vertical offset |
Definition at line 306 of file gui_fontstring.cpp.
void gui::font_string::set_spacing | ( | float | fSpacing | ) |
Sets the space between each letter.
fSpacing | The space between each letter |
Definition at line 348 of file gui_fontstring.cpp.
void gui::font_string::set_text | ( | const std::string & | sText | ) |
Sets the rendered text.
sText | The rendered text |
Definition at line 453 of file gui_fontstring.cpp.
void gui::font_string::set_text_color | ( | const color & | mTextColor | ) |
void gui::font_string::set_word_wrap | ( | bool | bCanWordWrap, | |
bool | bAddEllipsis | |||
) |
Enables word wrap.
bCanWordWrap | 'true' to enable word wrap | |
bAddEllipsis | 'true' to put "..." at the end of a truncated line |
Definition at line 428 of file gui_fontstring.cpp.
void gui::font_string::update | ( | float | fDelta | ) | [virtual] |
updates this widget's logic.
Reimplemented from gui::uiobject.
Definition at line 87 of file gui_fontstring.cpp.