The Battle for Wesnoth  1.15.7+dev
Namespaces | Macros | Functions | Variables
sdl_ttf.cpp File Reference
#include "font/sdl_ttf.hpp"
#include "font/error.hpp"
#include "font/font_config.hpp"
#include "font/font_id.hpp"
#include "font/text_cache.hpp"
#include "font/text_surface.hpp"
#include "filesystem.hpp"
#include "font/marked-up_text.hpp"
#include "game_config.hpp"
#include "log.hpp"
#include "preferences/general.hpp"
#include "tooltips.hpp"
#include "sdl/rect.hpp"
#include "sdl/surface.hpp"
#include "serialization/unicode.hpp"
#include <SDL2/SDL_ttf.h>
#include <map>
#include <string>
#include <vector>
Include dependency graph for sdl_ttf.cpp:

Go to the source code of this file.

Namespaces

 font
 Note: Specific to sdl_ttf.
 

Macros

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

Functions

static surface font::render_text (const std::string &text, int fontsize, const color_t &color, int style, bool use_markup)
 
surface font::get_rendered_text (const std::string &str, int size, const color_t &color, int style)
 
SDL_Rect font::draw_text_line (surface &gui_surface, const SDL_Rect &area, int size, const color_t &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 void font::clear_fonts ()
 

Variables

static lg::log_domain log_font ("font")
 

Macro Definition Documentation

◆ DBG_FT

#define DBG_FT   LOG_STREAM(debug, log_font)

Definition at line 41 of file sdl_ttf.cpp.

Referenced by font::sdl_ttf::set_font_list().

◆ ERR_FT

#define ERR_FT   LOG_STREAM(err, log_font)

Definition at line 44 of file sdl_ttf.cpp.

Referenced by font::sdl_ttf::sdl_ttf().

◆ LOG_FT

#define LOG_FT   LOG_STREAM(info, log_font)

Definition at line 42 of file sdl_ttf.cpp.

Referenced by font::sdl_ttf::sdl_ttf().

◆ WRN_FT

#define WRN_FT   LOG_STREAM(warn, log_font)

Definition at line 43 of file sdl_ttf.cpp.

Referenced by font::make_text_ellipsis(), and font::sdl_ttf::split_text().

Variable Documentation

◆ font

std::shared_ptr<const TTF_Font> font

Definition at line 56 of file sdl_ttf.cpp.

Referenced by font::sdl_ttf::get_font().

◆ log_font

lg::log_domain log_font("font")
static

◆ name

std::string name

Definition at line 70 of file sdl_ttf.cpp.

Referenced by game_events::event_handlers::add_event_handler(), schema_validation::wml_tag::add_filter(), terrain_builder::add_images_from_config(), plugins_manager::add_plugin(), replay::add_rename(), schema_validation::wml_tag::add_switch(), schema_validation::wml_tag::add_tag(), addon_filename_legal(), simple_wml::node::apply_diff(), ng::create_engine::apply_level_filter(), archive_dir(), attack_info(), simple_wml::node::attr(), aux_upvalue(), auxupvalue(), t_string::base_str(), BOOST_AUTO_TEST_CASE(), team::calculate_is_enemy(), events::menu_handler::can_recruit(), team::change_team(), font::check_font_file(), game_events::event_handlers::clean_up_expired_handlers(), config::copy_attributes(), events::menu_handler::current_unit(), savegame::save_index_class::data(), db_getlocal(), db_setlocal(), default_map_generator_job::default_generate_map(), gui2::dialogs::game_load::delete_button_callback(), savegame::save_index_class::delete_game(), wfl::variant_callable::deref_iterator(), mp_sync::user_choice::description(), play_controller::hotkey_handler::do_execute_command(), ai::engine_fai::do_parse_stage_from_config(), do_replay_handle(), events::menu_handler::do_search(), events::console_handler::do_set_var(), gui2::image_shape::draw(), editor::editor_palette< overlay >::draw_contents(), game_display::draw_sidebar(), editor::context_manager::edit_scenario_dialog(), game_events::manager::execute_on_events(), play_controller::hotkey_handler::expand_autosaves(), gui2::dialogs::game_load::filter_text_changed(), config::find_child(), schema_validation::wml_tag::find_key(), schema_validation::wml_tag::find_tag(), findlocal(), savegame::save_info::format_time_local(), markov_generator::generate(), help::generate_faction_topics(), help::generate_trait_topics(), savegame::save_index_class::get(), unit::get_ability_list(), game_events::event_handlers::get_active(), preprocessor_file::get_chunk(), font::get_color_string_pango(), persist_manager::get_context(), replay_helper::get_event(), display::get_fog_shroud_images(), editor::editor_action_extendable::get_name(), editor::editor_action::get_name(), editor::editor_action_location::get_name(), editor::editor_action_location_terrain::get_name(), editor::editor_action_area::get_name(), ai::register_engine_factory< ENGINE >::get_new_instance(), filesystem::get_next_filename(), vconfig::get_parsed_config(), ai::readonly_context_impl::get_readonly_context(), mp::chat_info::get_whisper_log(), game_state::get_wml_menu_items(), campaignd::server::handle_request_campaign(), campaignd::server::handle_request_campaign_list(), campaignd::server::handle_upload(), wb::manager::has_temp_move(), gui2::dialogs::preferences_dialog::hotkey_filter_callback(), lua_widget::impl_widget_get(), lua_widget::impl_widget_set(), ng::connect_engine::import_user(), init_textdomains(), intf_invoke_synced_command(), intf_load(), game_lua_kernel::intf_scroll(), ll_require(), ai::formula_ai::load_candidate_action_from_config(), plugins_manager::load_plugin(), ng::connect_engine::load_previous_sides_users(), preferences::login(), lua_check_impl::lua_check(), lua_getinfo(), lua_getlocal(), lua_getupvalue(), lua_setlocal(), lua_setupvalue(), luaD_protectedparser(), luaL_checkoption(), luaT_objtypename(), luaU_undump(), main(), help::make_unit_link(), game_lua_kernel::my_name(), newlabelentry(), newupvalue(), simple_wml::node::node(), plugins_manager::notify_event(), ai::formula_ai::on_create(), gui2::dialogs::mp_connect::on_server_add(), schema_validation::schema_validator::open_tag(), image::swap_modification::operator()(), time_of_day::operator==(), schema_validation::wml_tag::operator==(), game_config::optional_features_table(), pack_scalar(), ng::side_engine::place_user(), plugins_context::plugins_context(), gui2::dialogs::game_load::populate_game_list(), gui2::dialogs::preferences_dialog::post_build(), gui2::dialogs::mp_create_game::post_show(), gui2::dialogs::unit_advance::pre_show(), gui2::dialogs::terrain_layers::pre_show(), gui2::dialogs::label_settings::pre_show(), gui2::dialogs::faction_select::pre_show(), gui2::dialogs::unit_list::pre_show(), gui2::dialogs::unit_recall::pre_show(), gui2::dialogs::editor_resize_map::pre_show(), gui2::dialogs::preferences_dialog::preferences_dialog(), context_free_grammar_generator::print_nonterminal(), ng::connect_engine::process_network_data(), gui2::dialogs::file_dialog::push_fileview_row(), pushglobalfuncname(), metrics::record_sample(), reports::register_generator(), filesystem::blacklist_pattern_list::remove_blacklisted_files_and_dirs(), unit::rename(), editor::context_manager::rename_area_dialog(), gui2::dialogs::unit_recall::rename_unit(), events::menu_handler::rename_unit(), editor::editor_controller::rename_unit(), mariadb::result_set::result_set(), replay_controller::return_to_play_side(), application_lua_kernel::thread::run_script(), editor::context_manager::save_all_maps(), savegame::save_game_exists(), editor::context_manager::save_map(), searcher_C(), searcher_Croot(), searcher_Lua(), searcher_preload(), synced_context::server_choice::send_request(), plugins_context::set_accessor(), plugins_context::set_accessor_int(), plugins_context::set_accessor_string(), plugins_context::set_callback(), schema_validation::schema_validator::set_create_exceptions(), gui2::unit_preview_pane::set_displayed_type(), gui2::unit_preview_pane::set_displayed_unit(), mp::lobby_info::set_game_filter_invert(), ng::configure_engine::set_game_name(), ng::configure_engine::set_game_password(), gui2::widget::set_id(), savegame::save_index_class::set_modified(), schema_validation::wml_key::set_name(), schema_validation::wml_tag::set_name(), unit::set_name(), mariadb::account::set_option(), editor::map_context::set_scenario_setup(), gui2::scrollbar_container::set_scrollbar_button_status(), synced_context::set_synced_state(), gui2::chatbox::set_wesnothd_connection(), editor::context_manager::set_window_title(), gui2::dialogs::event_mode_controller::show_list(), gui2::dialogs::campaign_selection::sort_campaigns(), attack_type::special_tooltips(), game_events::event_handlers::standardize_name(), savegame::save_info::summary(), SYNCED_COMMAND_HANDLER_FUNCTION(), unit_name(), gui2::player_list_helper::update_list(), gui2::dialogs::mp_lobby::update_playerlist(), team::user_team_name(), schema_validation::schema_validator::validate(), campaignd::server::validate_addon(), game_events::builtin_conditions::variable_matches(), wfl::variant::variant(), varinfo(), user_choice_manager::wait_message(), attack_type::weapon_specials(), game_events::WML_HANDLER_FUNCTION(), game_config_view::wrap(), campaignd::server::write_config(), abstract_validator::~abstract_validator(), mariadb::account::~account(), ai::formula_ai::~formula_ai(), reports::generator::~generator(), map_generator::~map_generator(), and user_handler::~user_handler().

◆ style

int style

◆ subset

subset_id subset

Definition at line 69 of file sdl_ttf.cpp.

Referenced by font::sdl_ttf::get_font(), and font::sdl_ttf::set_font_list().