MyGUI: MyGUI_ResourceManualFont.h Source File

MyGUI 3.2.2

MyGUI_ResourceManualFont.h
Go to the documentation of this file.
1 /*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7 #ifndef MYGUI_RESOURCE_MANUAL_FONT_H_
8 #define MYGUI_RESOURCE_MANUAL_FONT_H_
9
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_ITexture.h"
12 #include "MyGUI_IFont.h"
13
14 namespace MyGUI
15 {
16
17 class MYGUI_EXPORT ResourceManualFont :
18 public IFont
19 {
20 MYGUI_RTTI_DERIVED( ResourceManualFont )
21
22 public:
23 ResourceManualFont();
24 virtual ~ResourceManualFont();
25
26 virtual void deserialization(xml::ElementPtr _node, Version _version);
27
28 // Returns the glyph info for the specified code point, or the glyph info for a substitute glyph if the code point does not
29 // exist in this font. Returns nullptr if the code point does not exist and there is no substitute glyph available.
30 virtual GlyphInfo* getGlyphInfo(Char _id);
31
32 virtual ITexture* getTextureFont();
33
34 // дефолтная высота, указанная в настройках шрифта
35 virtual int getDefaultHeight();
36
37 // Manual loading methods, not needed when loading from XML
38 // Set the source texture name
39 void setSource(const std::string& value);
40 // Set the default height of the font
41 void setDefaultHeight(int value);
42 // Add a glyph for character 'id'
43 void addGlyphInfo(Char id, const GlyphInfo& info);
44
45 private:
46 // Loads the texture specified by mSource.
47 void loadTexture();
48
49 // A map of code points to glyph info objects.
50 typedef std::map<Char, GlyphInfo> CharMap;
51
52 // The following variables are set directly from values specified by the user.
53 std::string mSource; // Source (filename) of the font.
54
55 // The following variables are calculated automatically.
56 int mDefaultHeight; // The nominal height of the font in pixels.
57 GlyphInfo* mSubstituteGlyphInfo; // The glyph info to use as a substitute for code points that don't exist in the font.
58 MyGUI::ITexture* mTexture; // The texture that contains all of the rendered glyphs in the font.
59
60 CharMap mCharMap; // A map of code points to glyph info objects.
61 };
62
63 } // namespace MyGUI
64
65 #endif // MYGUI_RESOURCE_MANUAL_FONT_H_
MyGUI::ResourceManualFont
Definition: MyGUI_ResourceManualFont.h:17
MyGUI_IFont.h
MyGUI_ITexture.h
MyGUI::xml::Element
Definition: MyGUI_XmlDocument.h:158
MyGUI::GlyphInfo
Definition: MyGUI_FontData.h:38
MyGUI::Version
Definition: MyGUI_Version.h:17
MyGUI_Prerequest.h
MyGUI::IFont
Definition: MyGUI_IFont.h:20
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition: MyGUI_RTTI.h:65
MyGUI::ITexture
Definition: MyGUI_ITexture.h:26
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:103
MyGUI::Char
unsigned int Char
Definition: MyGUI_Types.h:51
MyGUI
Definition: MyGUI_ActionController.h:14