MyGUI 3.4.1
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
16 {
17 public:
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
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
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;
108 };
109
110 };
111
112 typedef std::vector<CharInfo> VectorCharInfo;
113
114 struct LineInfo
115 {
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;
133 size_t count;
135 };
136
137 typedef std::vector<LineInfo> VectorLineInfo;
138
139} // namespace MyGUI
140
141#endif // MYGUI_TEXT_VIEW_DATA_H_
float getHeight() const
const FloatRect & getUVRect() const
float getWidth() const
float getAdvance() const
bool isColour() const
float getBearingY() const
CharInfo(const FloatRect &_rect, float _width, float _height, float _advance, float _bearingX, float _bearingY)
uint32 getColour() const
float getBearingX() const
CharInfo(uint32 _colour)
std::vector< CharInfo > VectorCharInfo
std::vector< LineInfo > VectorLineInfo
uint32_t uint32
Definition: MyGUI_Types.h:47
VectorCharInfo symbols