#include "global.hpp"
#include "config.hpp"
#include "filesystem.hpp"
#include "font.hpp"
#include "game_config.hpp"
#include "log.hpp"
#include "sdl_utils.hpp"
#include "tooltips.hpp"
#include "util.hpp"
#include "video.hpp"
#include "serialization/parser.hpp"
#include "serialization/preprocessor.hpp"
#include "serialization/string_utils.hpp"
#include "marked-up_text.hpp"
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <sstream>
#include <stack>
#include <string>
Go to the source code of this file.
Namespaces | |
namespace | font |
Classes | |
struct | font::subset_descriptor |
Defines | |
#define | DBG_FT LOG_STREAM(debug, display) |
#define | LOG_FT LOG_STREAM(info, display) |
#define | WRN_FT LOG_STREAM(warn, display) |
#define | ERR_FT LOG_STREAM(err, display) |
Typedefs | |
typedef int | subset_id |
typedef std::map< std::string, SDL_Rect > | line_size_cache_map |
typedef std::map< int, floating_label > | label_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 &colour, int style) |
surface | font::get_rendered_text (const std::string &str, int size, const SDL_Color &colour, int style) |
SDL_Rect | font::draw_text_line (surface gui_surface, const SDL_Rect &area, int size, const SDL_Color &colour, const std::string &text, int x, int y, bool use_tooltips, int style) |
SDL_Rect | font::draw_text_line (CVideo *gui, const SDL_Rect &area, int size, const SDL_Color &colour, 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, bool with_tags=true) |
If the text excedes the specified max width, end it with an ellipsis (. | |
int | font::add_floating_label (const std::string &text, int font_size, const SDL_Color &colour, double xpos, double ypos, double xmove, double ymove, int lifetime, const SDL_Rect &clip_rect, ALIGN alignment=CENTER_ALIGN, const SDL_Color *bg_colour=NULL, int border_size=0, LABEL_SCROLL_MODE scroll_mode=ANCHOR_LABEL_SCREEN) |
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 () |
void | font::cache_mode (CACHE mode) |
Variables | |
std::map< font_id, TTF_Font * > | font_table |
std::vector< std::string > | font_names |
std::vector< subset_id > | font_map |
std::map< int, std::map< int, line_size_cache_map > > | line_size_cache |
const SDL_Color | font::NORMAL_COLOUR = {0xDD,0xDD,0xDD,0} |
const SDL_Color | font::GRAY_COLOUR = {0x77,0x77,0x77,0} |
const SDL_Color | font::LOBBY_COLOUR = {0xBB,0xBB,0xBB,0} |
const SDL_Color | font::GOOD_COLOUR = {0x00,0xFF,0x00,0} |
const SDL_Color | font::BAD_COLOUR = {0xFF,0x00,0x00,0} |
const SDL_Color | font::BLACK_COLOUR = {0x00,0x00,0x00,0} |
const SDL_Color | font::YELLOW_COLOUR = {0xFF,0xFF,0x00,0} |
const SDL_Color | font::BUTTON_COLOUR = {0xBC,0xB0,0x88,0} |
const SDL_Color | font::STONED_COLOUR = {0xA0,0xA0,0xA0,0} |
const SDL_Color | font::TITLE_COLOUR = {0xBC,0xB0,0x88,0} |
const SDL_Color | font::LABEL_COLOUR = {0x6B,0x8C,0xFF,0} |
const SDL_Color | font::BIGMAP_COLOUR = {0xFF,0xFF,0xFF,0} |
const SDL_Color | font::DISABLED_COLOUR = inverse(STONED_COLOUR) |
static const size_t | font::max_text_line_width = 4096 |
label_map | labels |
int | label_id = 1 |
std::stack< std::set< int > > | label_contexts |
#define ERR_FT LOG_STREAM(err, display) |
Definition at line 45 of file font.cpp.
Referenced by font::load_font_config(), font::manager::manager(), and open_font().
#define LOG_FT LOG_STREAM(info, display) |
#define WRN_FT LOG_STREAM(warn, display) |
typedef std::map<int,floating_label> label_map [static] |
typedef std::map<std::string,SDL_Rect> line_size_cache_map [static] |
static bool add_font_to_fontlist | ( | config * | fonts_config, | |
std::vector< font::subset_descriptor > & | fontlist, | |||
const std::string & | name | |||
) | [static] |
Definition at line 1084 of file font.cpp.
References config::find_child(), r, and utils::split().
Referenced by font::load_font_config().
static void clear_fonts | ( | ) | [static] |
Definition at line 198 of file font.cpp.
References font_map, 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 177 of file font.cpp.
References font_names, font_table, LOG_FT, open_font(), size, and subset.
Referenced by font::get_max_height().
static TTF_Font* open_font | ( | const std::string & | fname, | |
int | size | |||
) | [static] |
Definition at line 141 of file font.cpp.
References ERR_FT, file_exists(), name, and game_config::path.
Referenced by get_font().
static std::vector<text_chunk> split_text | ( | std::string const & | utf8_text | ) | [static] |
Definition at line 105 of file font.cpp.
References utils::utf8_iterator::end(), boost::foreach_detail_::end(), font_map, utils::utf8_iterator::substr(), and WRN_FT.
int alpha_change_ |
SDL_Rect clip_rect_ |
Definition at line 94 of file font.cpp.
Referenced by clear_fonts(), font::set_font_list(), and split_text().
std::vector<std::string> font_names [static] |
Definition at line 76 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] |
bool initialized_ |
std::stack<std::set<int> > label_contexts [static] |
std::map<int,std::map<int,line_size_cache_map> > line_size_cache [static] |
int old_style_ |
int size |
Definition at line 72 of file font.cpp.
Referenced by editormap::add_tiles_left(), editormap::add_tiles_right(), combatant::adjust_hitchance(), dialogs::advance_unit(), team::shroud_map::clear(), preferences::clock_format(), cut_surface(), gui2::twindow::do_show_help_popup(), gui2::twindow::do_show_tooltip(), hotkey::execute_command(), combatant::fight(), editormap::flip(), format_file_size(), game_logic::formula_function_expression::formula_function_expression(), cave_map_generator::generate_chambers(), gui2::tcontainer_::get_best_size(), get_font(), game_logic::get_functions_map(), gui2::tcontainer_::get_minimum_size(), replay::get_next_action(), team::get_side_colour_index(), gui2::tcontrol::get_single_line_best_size(), gui2::tgrid::get_size(), unit_type::has_random_traits(), theme::label::label(), gui2::tgrid::layout(), gui2::tcontrol::load_config(), gamemap::location::matches_range(), terrain_builder::parse_config(), dfool::arithmetic_evaluator::parse_tokens(), place_village(), replay::pre_replay(), process_queue(), t_translation::read_builder_map(), t_translation::read_game_map(), gui2::twindow::recalculate_size(), editormap::remove_tiles_bottom(), editormap::remove_tiles_top(), display::screenshot(), send_buffer(), CVideo::set_help_string(), map_editor::set_mouseover_overlay(), gui2::tgrid::set_size(), help::show_help(), theme::status_item::status_item(), utils::utf8_iterator::update(), map_editor::update_mouse_over_hexes(), team::shroud_map::value(), dfool::evaluator::value(), variable_info::variable_info(), font::word_wrap_text(), and unit::xp_color().
std::string str_ |
Definition at line 372 of file font.cpp.
Referenced by events::cmd_arg_parser::advance_to_arg(), events::cmd_arg_parser::get_arg(), events::cmd_arg_parser::get_data(), events::cmd_arg_parser::get_str(), and events::cmd_arg_parser::parse().
std::string text |
Definition at line 90 of file font.cpp.
Referenced by gui2::ttext::draw(), gui::progress_bar::draw_contents(), dialogs::unit_preview_pane::draw_contents(), draw_label(), font::draw_text(), draw_tip_of_day(), help::generate_ability_topics(), help::generate_about_text(), help::generate_races_sections(), help::generate_unit_topics(), help::generate_weapon_special_topics(), help::help_text_area::handle_bold_cfg(), help::help_text_area::handle_format_cfg(), help::help_text_area::handle_header_cfg(), help::help_text_area::handle_italic_cfg(), mp::ui::handle_key_event(), help::help_text_area::handle_ref_cfg(), unit_ability_list::highest(), map_editor::terrain_palette::load_tooltips(), map_editor::load_tooltips(), unit_ability_list::lowest(), help::parse_config_internal(), about::set_about(), about::show_about(), events::menu_handler::show_chat_log(), unit_animation::start_animation(), gui::floating_textbox::tab(), the_end(), and unit_display::unit_attack().
std::string text_ |
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |