The Battle for Wesnoth  1.15.0-dev
font_config.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2016 - 2018 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 
25 class t_string;
26 
27 namespace font {
28 
29 // Object which initializes font rendering libraries and related caches.
30 // When it is created, the font directory is found within game_config::path.
31 // If that path changes then this object should be destroyed and recreated.
32 //
33 // You should not use GUI1 or GUI2 or any font api function unless a
34 // font::manager is alive.
35 // Don't create two font::manager objects at once.
36 //
37 struct manager {
38  manager();
39  ~manager();
40 
41  manager(const manager &) = delete;
42  manager & operator = (const manager &) = delete;
43 
44 private:
45 };
46 
47 /***
48  * load_font_config actually searches the game font path for fonts, and refreshes
49  * the set of loaded fonts
50  *
51  * Returns true in case of success
52  */
53 bool load_font_config();
54 
55 /** Returns the currently defined fonts. */
57 
58 /** Test if a font file exists */
59 bool check_font_file(std::string name);
60 
61 } // end namespace font
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:61
Collection of helper functions relating to Pango formatting.
const t_string & get_font_families(family_class fclass)
Returns the currently defined fonts.
manager & operator=(const manager &)=delete
bool load_font_config()