The Battle for Wesnoth  1.19.0-dev
font_config.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2016 - 2024
3  by Chris Beck<render787@gmail.com>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
18 /***
19  * The font::manager initializes cairo and font_config in order to figure out
20  * what local fonts to use.
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 
45 /***
46  * load_font_config actually searches the game font path for fonts, and refreshes
47  * the set of loaded fonts
48  *
49  * Returns true in case of success
50  */
51 bool load_font_config();
52 
53 /** Returns the currently defined fonts. */
55 
56 /** Test if a font file exists */
57 bool check_font_file(std::string name);
58 
59 } // end namespace font
Collection of helper functions relating to Pango formatting.
family_class
Font classes for get_font_families().
@ FONT_SANS_SERIF
bool check_font_file(std::string name)
Test if a font file exists.
Definition: font_config.cpp:42
const t_string & get_font_families(family_class fclass)
Returns the currently defined fonts.
bool load_font_config()
Definition: font_config.cpp:79
manager(const manager &)=delete
manager & operator=(const manager &)=delete