The Battle for Wesnoth  1.15.12+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 https://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.
20  */
21 
22 #include "font_options.hpp"
23 
24 class t_string;
25 
26 namespace font {
27 
28 // Object which initializes font rendering libraries and related caches.
29 // When it is created, the font directory is found within game_config::path.
30 // If that path changes then this object should be destroyed and recreated.
31 //
32 // You should not use GUI1 or GUI2 or any font api function unless a
33 // font::manager is alive.
34 // Don't create two font::manager objects at once.
35 //
36 struct manager {
37  manager();
38  ~manager();
39 
40  manager(const manager &) = delete;
41  manager & operator = (const manager &) = delete;
42 };
43 
44 /***
45  * load_font_config actually searches the game font path for fonts, and refreshes
46  * the set of loaded fonts
47  *
48  * Returns true in case of success
49  */
50 bool load_font_config();
51 
52 /** Returns the currently defined fonts. */
54 
55 /** Test if a font file exists */
56 bool check_font_file(std::string name);
57 
58 } // 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:62
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()