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