The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
Namespaces | Functions
sdl_ttf_compat.hpp File Reference

Transitional API for porting SDL_ttf-based code to Pango. More...

#include "font/text.hpp"
Include dependency graph for sdl_ttf_compat.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  font
 Graphical text output.
 

Functions

texture font::pango_render_text (const std::string &text, int size, const color_t &color, font::pango_text::FONT_STYLE style=font::pango_text::STYLE_NORMAL, bool use_markup=false, int max_width=-1)
 Returns a SDL texture containing the rendered text.
 
std::pair< int, int > font::pango_line_size (const std::string &line, int font_size, font::pango_text::FONT_STYLE font_style=font::pango_text::STYLE_NORMAL)
 Determine the width and height of a line of text given a certain font size.
 
std::string font::pango_word_wrap (const std::string &unwrapped_text, int font_size, int max_width, int max_height=-1, int max_lines=-1, bool partial_line=false)
 Uses Pango to word wrap text.
 
rect font::pango_draw_text (bool actually_draw, const rect &area, int size, const color_t &color, const std::string &text, int x, int y)
 Draws text on the screen.
 

Detailed Description

Transitional API for porting SDL_ttf-based code to Pango.

Do NOT use in new code!

Note
GUI1 markup is not supported by this transitional API for cost-benefit reasons. Not only does implementing it require a lot more work to go over text line by line, it also had major design flaws – namely, only applying to whole lines with variable spans that would be decided by the layout algorithm depending on available space, rather than on a physical line basis (markup start till EOL) or fixed span basis (e.g. the special markup used by the Help browser, or Pango markup).

Definition in file sdl_ttf_compat.hpp.