Freeciv21
Develop your civilization from humble roots to a global empire
fonts.h
Go to the documentation of this file.
1 /**************************************************************************
2  Copyright (c) 1996-2020 Freeciv21 and Freeciv contributors. This file is
3  part of Freeciv21. Freeciv21 is free software: you can redistribute it
4  and/or modify it under the terms of the GNU General Public License as
5  published by the Free Software Foundation, either version 3 of the
6  License, or (at your option) any later version. You should have received
7  a copy of the GNU General Public License along with Freeciv21. If not,
8  see https://www.gnu.org/licenses/.
9 **************************************************************************/
10 #pragma once
11 
12 // Qt
13 #include <QFont>
14 #include <QMap>
15 #include <QStringList>
16 
17 namespace fonts {
18 const char *const default_font = "gui_qt_font_default";
19 const char *const notify_label = "gui_qt_font_notify_label";
20 const char *const help_label = "gui_qt_font_help_label";
21 const char *const help_text = "gui_qt_font_help_text";
22 const char *const chatline = "gui_qt_font_chatline";
23 const char *const city_names = "gui_qt_font_city_names";
24 const char *const city_productions = "gui_qt_font_city_productions";
25 const char *const reqtree_text = "gui_qt_font_reqtree_text";
26 } // namespace fonts
27 
28 class fcFont {
30 
31 private:
33  static fcFont *m_instance;
34  explicit fcFont();
35 
36 public:
37  static fcFont *instance();
38  static void drop();
39  void setFont(const QString &name, const QFont &qf);
40  void setSizeAll(int);
41  QFont getFont(const QString &name, double zoom = 1.0) const;
42  void initFonts();
43  void releaseFonts();
44 };
45 
46 bool isFontInstalled(const QString &font_name);
47 void load_fonts();
48 void configure_fonts();
Definition: fonts.h:28
void initFonts()
Initiazlizes fonts from client options.
Definition: fonts.cpp:77
QMap< QString, QFont > font_map
Definition: fonts.h:32
void setSizeAll(int)
Increases/decreases all fonts sizes.
Definition: fonts.cpp:99
void releaseFonts()
Deletes all fonts.
Definition: fonts.cpp:117
fcFont()
Font provider constructor.
Definition: fonts.cpp:29
QFont getFont(const QString &name, double zoom=1.0) const
Returns desired font.
Definition: fonts.cpp:57
Q_DISABLE_COPY(fcFont)
static fcFont * m_instance
Definition: fonts.h:33
static void drop()
Deletes fc_icons instance.
Definition: fonts.cpp:45
static fcFont * instance()
Returns instance of fc_font.
Definition: fonts.cpp:34
void setFont(const QString &name, const QFont &qf)
Adds new font or overwrite old one.
Definition: fonts.cpp:122
void load_fonts()
Loads the fonts into the font database.
Definition: fonts.cpp:140
bool isFontInstalled(const QString &font_name)
Returns if a font is installed.
Definition: fonts.cpp:130
void configure_fonts()
Tries to choose good fonts for Freeciv21.
Definition: fonts.cpp:160
const char * name
Definition: inputfile.cpp:118
Definition: fonts.h:17
const char *const city_productions
Definition: fonts.h:24
const char *const chatline
Definition: fonts.h:22
const char *const default_font
Definition: fonts.h:18
const char *const notify_label
Definition: fonts.h:19
const char *const help_label
Definition: fonts.h:20
const char *const city_names
Definition: fonts.h:23
const char *const help_text
Definition: fonts.h:21
const char *const reqtree_text
Definition: fonts.h:25