#include "global.hpp"#include "config.hpp"#include "filesystem.hpp"#include "font.hpp"#include "foreach.hpp"#include "game_config.hpp"#include "log.hpp"#include "marked-up_text.hpp"#include "text.hpp"#include "tooltips.hpp"#include "video.hpp"#include "serialization/parser.hpp"#include "serialization/preprocessor.hpp"#include "serialization/string_utils.hpp"#include <list>#include <set>#include <stack>#include <cairo-features.h>
Go to the source code of this file.
Classes | |
| struct | font_id |
| struct | text_chunk |
| struct | char_block_map |
| struct | font::subset_descriptor |
Namespaces | |
| namespace | font |
Graphical text output. | |
Defines | |
| #define | GETTEXT_DOMAIN "wesnoth-lib" |
| #define | DBG_FT LOG_STREAM(debug, log_font) |
| #define | LOG_FT LOG_STREAM(info, log_font) |
| #define | WRN_FT LOG_STREAM(warn, log_font) |
| #define | ERR_FT LOG_STREAM(err, log_font) |
Typedefs | |
| typedef int | subset_id |
| typedef std::map< std::string, SDL_Rect > | line_size_cache_map |
Functions | |
| static std::vector< text_chunk > | split_text (std::string const &utf8_text) |
| static TTF_Font * | open_font (const std::string &fname, int size) |
| static TTF_Font * | get_font (font_id id) |
| static void | clear_fonts () |
| static void | font::set_font_list (const std::vector< subset_descriptor > &fontlist) |
| static surface | font::render_text (const std::string &text, int fontsize, const SDL_Color &color, int style, bool use_markup) |
| surface | font::get_rendered_text (const std::string &str, int size, const SDL_Color &color, int style) |
| SDL_Rect | font::draw_text_line (surface gui_surface, const SDL_Rect &area, int size, const SDL_Color &color, const std::string &text, int x, int y, bool use_tooltips, int style) |
| int | font::get_max_height (int size) |
| int | font::line_width (const std::string &line, int font_size, int style=TTF_STYLE_NORMAL) |
| Determine the width of a line of text given a certain font size. | |
| SDL_Rect | font::line_size (const std::string &line, int font_size, int style=TTF_STYLE_NORMAL) |
| Determine the size of a line of text given a certain font size. | |
| std::string | font::make_text_ellipsis (const std::string &text, int font_size, int max_width, int style=TTF_STYLE_NORMAL) |
| If the text excedes the specified max width, end it with an ellipsis (...). | |
| int | font::add_floating_label (const floating_label &flabel) |
| add a label floating on the screen above everything else. | |
| void | font::move_floating_label (int handle, double xmove, double ymove) |
| moves the floating label given by 'handle' by (xmove,ymove) | |
| void | font::scroll_floating_labels (double xmove, double ymove) |
| moves all floating labels that have 'scroll_mode' set to ANCHOR_LABEL_MAP | |
| void | font::remove_floating_label (int handle) |
| removes the floating label given by 'handle' from the screen | |
| void | font::show_floating_label (int handle, bool show) |
| hides or shows a floating label | |
| SDL_Rect | font::get_floating_label_rect (int handle) |
| void | font::draw_floating_labels (surface screen) |
| void | font::undraw_floating_labels (surface screen) |
| static bool | add_font_to_fontlist (config &fonts_config, std::vector< font::subset_descriptor > &fontlist, const std::string &name) |
| bool | font::load_font_config () |
| const t_string & | font::get_font_families () |
| Returns the currently defined fonts. | |
| void | font::cache_mode (CACHE mode) |
Variables | |
| static lg::log_domain | log_font ("font") |
| static std::map< font_id, TTF_Font * > | font_table |
| static std::vector< std::string > | font_names |
| static char_block_map | char_blocks |
| static std::map< int, std::map < int, line_size_cache_map > > | line_size_cache |
| const SDL_Color | font::NORMAL_COLOR = {0xDD,0xDD,0xDD,0} |
| const SDL_Color | font::GRAY_COLOR = {0x77,0x77,0x77,0} |
| const SDL_Color | font::LOBBY_COLOR = {0xBB,0xBB,0xBB,0} |
| const SDL_Color | font::GOOD_COLOR = {0x00,0xFF,0x00,0} |
| const SDL_Color | font::BAD_COLOR = {0xFF,0x00,0x00,0} |
| const SDL_Color | font::BLACK_COLOR = {0x00,0x00,0x00,0} |
| const SDL_Color | font::YELLOW_COLOR = {0xFF,0xFF,0x00,0} |
| const SDL_Color | font::BUTTON_COLOR = {0xBC,0xB0,0x88,0} |
| const SDL_Color | font::PETRIFIED_COLOR = {0xA0,0xA0,0xA0,0} |
| const SDL_Color | font::TITLE_COLOR = {0xBC,0xB0,0x88,0} |
| const SDL_Color | font::LABEL_COLOR = {0x6B,0x8C,0xFF,0} |
| const SDL_Color | font::BIGMAP_COLOR = {0xFF,0xFF,0xFF,0} |
| const SDL_Color | font::DISABLED_COLOR = inverse(PETRIFIED_COLOR) |
| #define ERR_FT LOG_STREAM(err, log_font) |
Definition at line 54 of file font.cpp.
Referenced by font::floating_label::create_surface(), font::manager::init(), font::manager::manager(), and open_font().
| #define LOG_FT LOG_STREAM(info, log_font) |
Definition at line 52 of file font.cpp.
Referenced by char_block_map::compress(), get_font(), and font::manager::manager().
| #define WRN_FT LOG_STREAM(warn, log_font) |
Definition at line 53 of file font.cpp.
Referenced by font::set_font_list(), and split_text().
| typedef std::map<std::string,SDL_Rect> line_size_cache_map |
| static bool add_font_to_fontlist | ( | config & | fonts_config, | |
| std::vector< font::subset_descriptor > & | fontlist, | |||
| const std::string & | name | |||
| ) | [static] |
Definition at line 1210 of file font.cpp.
References config::find_child(), and utils::split().

| static void clear_fonts | ( | ) | [static] |
Definition at line 259 of file font.cpp.
References char_block_map::cbmap, font_names, font_table, and line_size_cache.
Referenced by font::set_font_list(), and font::manager::~manager().

| static TTF_Font* get_font | ( | font_id | id | ) | [static] |
Definition at line 238 of file font.cpp.
References font_names, font_table, LOG_FT, and open_font().

| static TTF_Font* open_font | ( | const std::string & | fname, | |
| int | size | |||
| ) | [static] |
Definition at line 202 of file font.cpp.
References ERR_FT, file_exists(), and game_config::path.
Referenced by get_font().


| static std::vector<text_chunk> split_text | ( | std::string const & | utf8_text | ) | [static] |
Definition at line 171 of file font.cpp.
References utils::utf8_iterator::end(), char_block_map::get_id(), schema_validation::sub(), text_chunk::subset, utils::utf8_iterator::substr(), text_chunk::text, and WRN_FT.

text_list cache_ [static] |
Definition at line 653 of file font.cpp.
Referenced by test_config_cache::instance().
char_block_map char_blocks [static] |
| std::vector<text_chunk> chunks_ |
std::vector<std::string> font_names [static] |
Definition at line 80 of file font.cpp.
Referenced by clear_fonts(), get_font(), and font::set_font_list().
| int font_size_ |
std::map<font_id, TTF_Font*> font_table [static] |
Definition at line 79 of file font.cpp.
Referenced by clear_fonts(), and get_font().
| bool initialized_ |
std::map<int,std::map<int,line_size_cache_map> > line_size_cache [static] |
Definition at line 168 of file font.cpp.
Referenced by clear_fonts().
lg::log_domain log_font("font") [static] |
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:04:19 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |