ScummVM API documentation
fontman.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef GRAPHICS_FONTMAN_H
23 #define GRAPHICS_FONTMAN_H
24 
25 #include "common/scummsys.h"
26 #include "common/singleton.h"
27 #include "common/str.h"
28 #include "common/hashmap.h"
29 #include "common/hash-str.h"
30 
31 
32 namespace Graphics {
33 
43 class Font;
44 class BdfFont;
45 
46 class FontManager : public Common::Singleton<FontManager> {
47 public:
48  enum FontUsage {
49  kLocalizedFont = 0,
50  kConsoleFont = 1,
51  kGUIFont = 2,
52  kBigGUIFont = 3
53  };
54 
61  bool setLocalizedFont(const Common::String &name);
62 
69  const Font *getFontByName(const Common::String &name) const;
70 
80  bool assignFontToName(const Common::String &name, const Font *font);
81 
89  bool setFont(FontUsage usage, const BdfFont *font);
90 
96  void removeFontName(const Common::String &name);
97 
105  const Font *getFontByUsage(FontUsage usage) const;
106 
107  //const Font *getFontBySize(int size???) const;
108 
109 private:
110  friend class Common::Singleton<SingletonBaseType>;
111  FontManager();
112  ~FontManager();
113 
115  Common::Array<const Font *> _ownedFonts;
116  Common::String _localizedFontName;
117 };
118 
120 } // End of namespace Graphics
121 
127 #define FontMan (Graphics::FontManager::instance())
128 
129 #endif
Definition: str.h:59
Definition: font.h:83
Definition: fontman.h:46
Definition: array.h:52
const Font * getFontByName(const Common::String &name) const
bool setFont(FontUsage usage, const BdfFont *font)
void removeFontName(const Common::String &name)
Definition: hashmap.h:85
bool setLocalizedFont(const Common::String &name)
Definition: formatinfo.h:28
Definition: bdf.h:60
const Font * getFontByUsage(FontUsage usage) const
bool assignFontToName(const Common::String &name, const Font *font)
Definition: singleton.h:42