MyGUI
3.4.0
MyGUIEngine
include
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
#include <unordered_map>
15
16
namespace
MyGUI
17
{
18
19
class
MYGUI_EXPORT
ResourceManualFont
:
20
public
IFont
21
{
22
MYGUI_RTTI_DERIVED
(
ResourceManualFont
)
23
24
public
:
25
ResourceManualFont
();
26
27
void
deserialization(
xml::ElementPtr
_node,
Version
_version)
override
;
28
29
// Returns the glyph info for the specified code point, or the glyph info for a substitute glyph if the code point does not
30
// exist in this font. Returns nullptr if the code point does not exist and there is no substitute glyph available.
31
GlyphInfo
* getGlyphInfo(
Char
_id)
override
;
32
33
ITexture
* getTextureFont()
override
;
34
35
// дефолтная высота, указанная в настройках шрифта
36
int
getDefaultHeight()
override
;
37
38
// Manual loading methods, not needed when loading from XML
39
// Set the source texture by name
40
void
setSource(
const
std::string& value);
41
// Set the source texture directly
42
// Note: the user is responsible for deallocation of the texture.
43
void
setTexture(
MyGUI::ITexture
* texture);
44
// Set the default height of the font
45
void
setDefaultHeight(
int
value);
46
// Add a glyph for character 'id'
47
void
addGlyphInfo(
Char
id
,
const
GlyphInfo
& info);
48
49
private
:
50
// Loads the texture specified by mSource.
51
void
loadTexture();
52
53
// A map of code points to glyph info objects.
54
typedef
std::unordered_map<Char, GlyphInfo> CharMap;
55
56
// The following variables are set directly from values specified by the user.
57
std::string mSource;
// Source (filename) of the font.
58
59
// The following variables are calculated automatically.
60
int
mDefaultHeight;
// The nominal height of the font in pixels.
61
GlyphInfo
* mSubstituteGlyphInfo;
// The glyph info to use as a substitute for code points that don't exist in the font.
62
MyGUI::ITexture
* mTexture;
// The texture that contains all of the rendered glyphs in the font.
63
64
CharMap mCharMap;
// A map of code points to glyph info objects.
65
};
66
67
}
// namespace MyGUI
68
69
#endif // MYGUI_RESOURCE_MANUAL_FONT_H_
MyGUI::Char
unsigned int Char
Definition:
MyGUI_Types.h:48
MyGUI::ResourceManualFont
Definition:
MyGUI_ResourceManualFont.h:21
MyGUI_IFont.h
MyGUI_ITexture.h
MyGUI::xml::Element
Definition:
MyGUI_XmlDocument.h:159
MyGUI::GlyphInfo
Definition:
MyGUI_FontData.h:40
MyGUI::Version
Definition:
MyGUI_Version.h:18
MyGUI_Prerequest.h
MyGUI::IFont
Definition:
MyGUI_IFont.h:22
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition:
MyGUI_RTTI.h:48
MyGUI::ITexture
Definition:
MyGUI_ITexture.h:28
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition:
MyGUI_Platform.h:89
MyGUI
Definition:
MyGUI_ActionController.h:15
Generated by
1.8.18