MyGUI: MyGUI_TextViewData.h Source File

MyGUI 3.4.2

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

- File List
- Globals

MyGUI_TextViewData.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_TEXT_VIEW_DATA_H_
8#define MYGUI_TEXT_VIEW_DATA_H_
9
10#include "MyGUI_Prerequest.h"
11
12namespace MyGUI
13{
14
15 class CharInfo
16 {
17 public:
18 CharInfo() :
19 mIsColour(false)
20 {
21 mMetrics.mWidth = 0.0f;
22 mMetrics.mHeight = 0.0f;
23 mMetrics.mAdvance = 0.0f;
24 mMetrics.mBearingX = 0.0f;
25 mMetrics.mBearingY = 0.0f;
26 }
27
28 CharInfo(
29 const FloatRect& _rect,
30 float _width,
31 float _height,
32 float _advance,
33 float _bearingX,
34 float _bearingY) :
35 mIsColour(false),
36 mUVRect(_rect)
37 {
38 mMetrics.mWidth = _width;
39 mMetrics.mHeight = _height;
40 mMetrics.mAdvance = _advance;
41 mMetrics.mBearingX = _bearingX;
42 mMetrics.mBearingY = _bearingY;
43 }
44
45 CharInfo(uint32 _colour) :
46 mIsColour(true),
47 mColour(_colour)
48 { }
49
50 bool isColour() const
51 {
52 return mIsColour;
53 }
54
55 float getWidth() const
56 {
57 return mMetrics.mWidth;
58 }
59
60 float getHeight() const
61 {
62 return mMetrics.mHeight;
63 }
64
65 float getAdvance() const
66 {
67 return mMetrics.mAdvance;
68 }
69
70 float getBearingX() const
71 {
72 return mMetrics.mBearingX;
73 }
74
75 float getBearingY() const
76 {
77 return mMetrics.mBearingY;
78 }
79
80 const FloatRect& getUVRect() const
81 {
82 return mUVRect;
83 }
84
85 uint32 getColour() const
86 {
87 return mColour;
88 }
89
90 private:
91
92 bool mIsColour;
93 FloatRect mUVRect;
94
95 struct Metrics
96 {
97 float mWidth;
98 float mHeight;
99 float mAdvance;
100 float mBearingX;
101 float mBearingY;
102 };
103
104 union
105 {
106 Metrics mMetrics;
107 uint32 mColour;
108 };
109
110 };
111
112 typedef std::vector<CharInfo> VectorCharInfo;
113
114 struct LineInfo
115 {
116 LineInfo() :
117 width(0),
118 offset(0),
119 count(0)
120 {
121 }
122
123 void clear()
124 {
125 width = 0;
126 count = 0;
127 symbols.clear();
128 offset = 0;
129 }
130
131 int width;
132 int offset;
133 size_t count;
134 VectorCharInfo symbols;
135 };
136
137 typedef std::vector<LineInfo> VectorLineInfo;
138
139} // namespace MyGUI
140
141#endif // MYGUI_TEXT_VIEW_DATA_H_
MyGUI_Prerequest.h
MyGUI::CharInfo
Definition MyGUI_TextViewData.h:16
MyGUI::CharInfo::getHeight
float getHeight() const
Definition MyGUI_TextViewData.h:60
MyGUI::CharInfo::getUVRect
const FloatRect & getUVRect() const
Definition MyGUI_TextViewData.h:80
MyGUI::CharInfo::getWidth
float getWidth() const
Definition MyGUI_TextViewData.h:55
MyGUI::CharInfo::getAdvance
float getAdvance() const
Definition MyGUI_TextViewData.h:65
MyGUI::CharInfo::isColour
bool isColour() const
Definition MyGUI_TextViewData.h:50
MyGUI::CharInfo::getBearingY
float getBearingY() const
Definition MyGUI_TextViewData.h:75
MyGUI::CharInfo::CharInfo
CharInfo(const FloatRect &_rect, float _width, float _height, float _advance, float _bearingX, float _bearingY)
Definition MyGUI_TextViewData.h:28
MyGUI::CharInfo::getColour
uint32 getColour() const
Definition MyGUI_TextViewData.h:85
MyGUI::CharInfo::CharInfo
CharInfo()
Definition MyGUI_TextViewData.h:18
MyGUI::CharInfo::mMetrics
Metrics mMetrics
Definition MyGUI_TextViewData.h:106
MyGUI::CharInfo::getBearingX
float getBearingX() const
Definition MyGUI_TextViewData.h:70
MyGUI::CharInfo::CharInfo
CharInfo(uint32 _colour)
Definition MyGUI_TextViewData.h:45
MyGUI::CharInfo::mColour
uint32 mColour
Definition MyGUI_TextViewData.h:107
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::uint32
uint32_t uint32
Definition MyGUI_Types.h:48
MyGUI::VectorCharInfo
std::vector< CharInfo > VectorCharInfo
Definition MyGUI_TextViewData.h:112
MyGUI::VectorLineInfo
std::vector< LineInfo > VectorLineInfo
Definition MyGUI_TextViewData.h:137
MyGUI::LineInfo
Definition MyGUI_TextViewData.h:115
MyGUI::LineInfo::width
int width
Definition MyGUI_TextViewData.h:131
MyGUI::LineInfo::clear
void clear()
Definition MyGUI_TextViewData.h:123
MyGUI::LineInfo::LineInfo
LineInfo()
Definition MyGUI_TextViewData.h:116
MyGUI::LineInfo::offset
int offset
Definition MyGUI_TextViewData.h:132
MyGUI::LineInfo::count
size_t count
Definition MyGUI_TextViewData.h:133
MyGUI::LineInfo::symbols
VectorCharInfo symbols
Definition MyGUI_TextViewData.h:134
MyGUI::types::TRect< float >