#include "global.hpp"
#include "config.hpp"
#include "filesystem.hpp"
#include "font.hpp"
#include "game_config.hpp"
#include "log.hpp"
#include "marked-up_text.hpp"
#include "text.hpp"
#include "tooltips.hpp"
#include "sdl/alpha.hpp"
#include "sdl/rect.hpp"
#include "serialization/parser.hpp"
#include "serialization/preprocessor.hpp"
#include "serialization/string_utils.hpp"
#include "serialization/unicode.hpp"
#include "preferences.hpp"
#include <boost/optional.hpp>
#include <list>
#include <set>
#include <stack>
#include <sstream>
#include <cairo-features.h>
Go to the source code of this file.
Classes | |
struct | font_id |
struct | ttf_record |
struct | text_chunk |
struct | char_block_map |
struct | font::subset_descriptor |
Namespaces | |
font | |
Graphical text output. | |
Macros | |
#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< font_id, ttf_record > | tfont_table |
typedef std::map< std::string, SDL_Rect > | line_size_cache_map |
typedef std::map< std::pair < std::string, int >, TTF_Font * > | topen_font_cache |
Functions | |
static std::vector< text_chunk > | split_text (std::string const &utf8_text) |
static TTF_Font * | open_font_impl (const std::string &, int) |
static TTF_Font * | open_font (const std::string &fname, int size) |
static TTF_Font * | get_font (font_id id) |
static void | clear_fonts () |
static bool | font::check_font_file (std::string name) |
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. More... | |
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. More... | |
std::string | font::make_text_ellipsis (const std::string &text, int font_size, int max_width, int style=TTF_STYLE_NORMAL) |
If the text exceeds the specified max width, end it with an ellipsis (...) More... | |
static bool | add_font_to_fontlist (const 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 (family_class fclass=FONT_SANS_SERIF) |
Returns the currently defined fonts. More... | |
void | font::cache_mode (CACHE mode) |
Variables | |
static lg::log_domain | log_font ("font") |
static tfont_table | font_table |
static std::vector< std::string > | font_names |
static std::vector< std::string > | bold_names |
static std::vector< std::string > | italic_names |
static char_block_map | char_blocks |
static std::map< int, std::map < int, line_size_cache_map > > | line_size_cache |
topen_font_cache | open_fonts |
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 DBG_FT LOG_STREAM(debug, log_font) |
Definition at line 60 of file font.cpp.
Referenced by open_font_impl(), and font::set_font_list().
#define ERR_FT LOG_STREAM(err, log_font) |
Definition at line 63 of file font.cpp.
Referenced by font::manager::init(), font::load_font_config(), font::manager::manager(), and open_font_impl().
#define LOG_FT LOG_STREAM(info, log_font) |
Definition at line 61 of file font.cpp.
Referenced by char_block_map::compress(), font::manager::init(), and font::manager::manager().
#define WRN_FT LOG_STREAM(warn, log_font) |
Definition at line 62 of file font.cpp.
Referenced by font::check_font_file(), and split_text().
typedef std::map<std::string,SDL_Rect> line_size_cache_map |
typedef std::map<font_id, ttf_record> tfont_table |
typedef std::map<std::pair<std::string, int>, TTF_Font*> topen_font_cache |
|
static |
Definition at line 1027 of file font.cpp.
References config::find_child().
Referenced by font::load_font_config().
|
static |
Definition at line 346 of file font.cpp.
References char_block_map::cbmap, font_table, i, and open_fonts.
Referenced by font::set_font_list(), and font::manager::~manager().
|
static |
Definition at line 295 of file font.cpp.
References font_table, and open_font().
Referenced by font::get_max_height().
|
static |
Definition at line 236 of file font.cpp.
References open_font_impl(), and open_fonts.
Referenced by get_font().
|
static |
Definition at line 249 of file font.cpp.
References DBG_FT, ERR_FT, filesystem::file_exists(), filesystem::load_RWops(), and game_config::path.
Referenced by open_font().
|
static |
Definition at line 197 of file font.cpp.
References ucs4::iterator_base< string_type, update_implementation >::end(), char_block_map::get_id(), schema_validation::sub(), text_chunk::subset, ucs4::iterator_base< string_type, update_implementation >::substr(), text_chunk::text, and WRN_FT.
|
static |
|
static |
Definition at line 772 of file font.cpp.
Referenced by test_config_cache::instance(), and movetype::terrain_info::data::value().
|
static |
|
mutable |
SDL_Color color_ |
|
static |
int font_size_ |
Definition at line 604 of file font.cpp.
Referenced by gui::menu::style::get_font_size().
|
static |
Definition at line 103 of file font.cpp.
Referenced by clear_fonts(), and get_font().
|
mutable |
Definition at line 607 of file font.cpp.
Referenced by image::scale_modification::get_h(), and editor::start().
int hash_ |
Definition at line 603 of file font.cpp.
Referenced by terrain_builder::building_rule::get_hash().
|
mutable |
Definition at line 609 of file font.cpp.
Referenced by gui2::init(), and gui::menu::imgsel_style::load_images().
|
static |
|
static |
|
static |
topen_font_cache open_fonts |
Definition at line 229 of file font.cpp.
Referenced by clear_fonts(), and open_font().
std::string str_ |
|
mutable |
Definition at line 607 of file font.cpp.
Referenced by image::scale_modification::get_w().