24 #include <SDL2/SDL_rect.h> 33 std::string::const_iterator
parse_markup(std::string::const_iterator i1,
34 std::string::const_iterator i2,
60 const color_t& color,
const std::string& text,
61 int x,
int y,
bool use_tooltips =
false,
int style = 0);
65 const color_t& color,
const std::string& text,
66 int x,
int y,
bool use_tooltips =
false,
int style = 0);
73 std::string
del_tags(
const std::string& text);
99 int max_width,
int max_height = -1,
int max_lines = -1,
bool partial_line =
false);
SDL_Rect text_area(const std::string &text, int size, int style)
Calculate the size of a text (in pixels) if it were to be drawn.
Note: Specific to sdl_ttf.
std::string::const_iterator parse_markup(std::string::const_iterator i1, std::string::const_iterator i2, int *font_size, color_t *color, int *style)
Parses the markup-tags at the front of a string.
const char LARGE_TEXT
Standard markups for color, size, font, images.
std::string word_wrap_text(const std::string &unwrapped_text, int font_size, int max_width, int max_height, int max_lines, bool partial_line)
Wrap text.
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
bool is_format_char(char c)
Determine if char is one of the special chars used as markup.
std::string del_tags(const std::string &text)
Copy string, but without tags at the beginning.
SDL_Rect draw_text(surface &dst, const SDL_Rect &area, int size, const color_t &color, const std::string &txt, int x, int y, bool use_tooltips, int style)
Function to draw text on a surface.
bool is_cjk_char(const char32_t ch)
Determine if a char32_t is a CJK character.