ScummVM API documentation
fontprovider.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 STARK_SERVICES_FONT_PROVIDER_H
23 #define STARK_SERVICES_FONT_PROVIDER_H
24 
25 #include "common/hash-str.h"
26 #include "common/ptr.h"
27 
28 namespace Common {
29 class INIFile;
30 }
31 
32 namespace Graphics {
33 class Font;
34 }
35 
36 namespace Stark {
37 
41 class FontProvider {
42 public:
43  FontProvider();
44  ~FontProvider();
45 
46  enum FontType {
47  kSmallFont,
48  kBigFont,
49  kCustomFont
50  };
51 
55  const Graphics::Font *getScaledFont(FontType type, int32 customFontIndex);
56 
60  uint getScaledFontHeight(FontType type, int32 customFontIndex);
61  uint getOriginalFontHeight(FontType type, int32 customFontIndex);
62 
64  void initFonts();
65 
66 private:
67  struct FontHolder {
68  Common::String _name;
69 
70  uint32 _originalHeight;
71  uint32 _scaledHeight;
72 
74 
75  FontHolder() : _originalHeight(0), _scaledHeight(0) {}
76  FontHolder(FontProvider *fontProvider, const Common::String &name, uint32 height);
77 
78  };
79 
80  void readFontEntry(const Common::INIFile *gui, FontHolder &holder, const char *nameKey, const char *sizeKey);
81  FontHolder *getFontHolder(FontType type, int32 customFontIndex);
82 
83  FontHolder _smallFont;
84  FontHolder _bigFont;
85  FontHolder _customFonts[8];
86 
87  Common::StringMap _ttfFileMap;
88 };
89 
90 } // End of namespace Stark
91 
92 #endif // STARK_SERVICES_FONT_PROVIDER_H
Definition: str.h:59
Definition: font.h:82
Definition: fontprovider.h:41
Definition: console.h:27
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: ini-file.h:58