The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
font_config.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2016 - 2017 by Chris Beck<render787@gmail.com>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
17 /***
18  * The font::manager initializes cairo and font_config in order to figure out
19  * what local fonts to use. It also asks SDL_TTF to initialize itself, via the
20  * sdl_ttf raii object.
21  */
22 
23 #include "font_options.hpp"
24 #include "sdl_ttf.hpp"
25 
26 class t_string;
27 
28 namespace font {
29 
30 // Object which initializes font rendering libraries and related caches.
31 // When it is created, the font directory is found within game_config::path.
32 // If that path changes then this object should be destroyed and recreated.
33 //
34 // You should not use GUI1 or GUI2 or any font api function unless a
35 // font::manager is alive.
36 // Don't create two font::manager objects at once.
37 //
38 struct manager {
39  manager();
40  ~manager();
41 
42  manager(const manager &) = delete;
43  manager & operator = (const manager &) = delete;
44 
45 private:
46 
47  /** Initialize sdl_ttf concurrent with font::manager lifetime */
49 };
50 
51 /***
52  * load_font_config actually searches the game font path for fonts, and refreshes
53  * the set of loaded fonts
54  *
55  * Returns true in case of success
56  */
57 bool load_font_config();
58 
59 /** Returns the currently defined fonts. */
61 
62 /** Test if a font file exists */
64 
65 } // end namespace font
std::vector< char_t > string
family_class
Font classes for get_font_families().
bool check_font_file(std::string name)
Test if a font file exists.
Definition: font_config.cpp:63
Note: Specific to sdl_ttf.
const t_string & get_font_families(family_class fclass)
Returns the currently defined fonts.
sdl_ttf sdl_ttf_initializer_
Initialize sdl_ttf concurrent with font::manager lifetime.
Definition: font_config.hpp:48
manager & operator=(const manager &)=delete
bool load_font_config()
static const char * name(const std::vector< SDL_Joystick * > &joysticks, const size_t index)
Definition: joystick.cpp:48