Classes | Namespaces | Defines | Typedefs | Functions | Variables

font.cpp File Reference

#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>
Include dependency graph for font.cpp:

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_chunksplit_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_stringfont::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 Documentation

#define DBG_FT   LOG_STREAM(debug, log_font)

Definition at line 51 of file font.cpp.

#define ERR_FT   LOG_STREAM(err, log_font)
#define GETTEXT_DOMAIN   "wesnoth-lib"

Definition at line 17 of file font.cpp.

#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 Documentation

typedef std::map<std::string,SDL_Rect> line_size_cache_map

Definition at line 165 of file font.cpp.

typedef int subset_id

Definition at line 61 of file font.cpp.


Function Documentation

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().

Here is the call graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

static std::vector<text_chunk> split_text ( std::string const &  utf8_text  )  [static]

Variable Documentation

text_list cache_ [static]

Definition at line 653 of file font.cpp.

Referenced by test_config_cache::instance().

Definition at line 162 of file font.cpp.

std::vector<text_chunk> chunks_

Definition at line 481 of file font.cpp.

SDL_Color color_

Definition at line 476 of file font.cpp.

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().

Definition at line 475 of file font.cpp.

std::map<font_id, TTF_Font*> font_table [static]

Definition at line 79 of file font.cpp.

Referenced by clear_fonts(), and get_font().

int h_

Definition at line 478 of file font.cpp.

int hash_

Definition at line 474 of file font.cpp.

Definition at line 480 of file font.cpp.

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]
unsigned int max_size_ [static]

Definition at line 654 of file font.cpp.

std::string str_

Definition at line 479 of file font.cpp.

int style_

Definition at line 477 of file font.cpp.

std::vector<surface> surfs_

Definition at line 482 of file font.cpp.

int w_

Definition at line 478 of file font.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:04:19 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs