ScummVM API documentation
font_manager.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 ULTIMA8_GFX_FONTS_FONTMANAGER_H
23 #define ULTIMA8_GFX_FONTS_FONTMANAGER_H
24 
25 #include "common/hashmap.h"
26 #include "common/hash-str.h"
27 #include "common/path.h"
28 #include "graphics/font.h"
29 
30 namespace Ultima {
31 namespace Ultima8 {
32 
33 class Font;
34 
35 // This is TTF_Font struct
36 typedef struct _TTF_Font TTF_Font;
37 
38 class TTFont;
39 
40 
41 class FontManager {
42 private:
44 
47  Graphics::Font *getTTF_Font(const Common::Path &filename, int pointsize, bool antialiasing);
48 
50  void setOverride(unsigned int fontnum, Font *newFont);
51 
52  Common::Array<Font *> _overrides;
53 
54  Common::Array<Font *> _ttFonts;
55 
56  static FontManager *_fontManager;
57 public:
58  FontManager();
59  ~FontManager();
60 
61  static FontManager *get_instance() {
62  return _fontManager;
63  }
64 
68  Font *getGameFont(unsigned int fontnum,
69  bool allowOverride = false);
70 
72  Font *getTTFont(unsigned int ttfnum);
73 
81  bool addTTFOverride(unsigned int fontnum, const Common::Path &filename,
82  int pointsize, uint32 rgb, int bordersize,
83  bool SJIS = false);
84 
89  bool addJPOverride(unsigned int fontnum, unsigned int jpfont, uint32 rgb);
90 
92  bool loadTTFont(unsigned int ttfnum, const Common::Path &filename,
93  int pointsize, uint32 rgb, int bordersize);
94 
95  // Reset the game fonts
96  void resetGameFonts();
97 };
98 
99 } // End of namespace Ultima8
100 } // End of namespace Ultima // End of namespace Ultima8
101 
102 #endif
Definition: font.h:41
bool addJPOverride(unsigned int fontnum, unsigned int jpfont, uint32 rgb)
Definition: font.h:83
Definition: array.h:52
Font * getGameFont(unsigned int fontnum, bool allowOverride=false)
Definition: path.h:52
Definition: font_manager.h:41
Definition: detection.h:27
Definition: hashmap.h:85
Font * getTTFont(unsigned int ttfnum)
get a TTF font (for non-game fonts)
bool addTTFOverride(unsigned int fontnum, const Common::Path &filename, int pointsize, uint32 rgb, int bordersize, bool SJIS=false)
bool loadTTFont(unsigned int ttfnum, const Common::Path &filename, int pointsize, uint32 rgb, int bordersize)
load a TTF (for non-game fonts)