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