MyGUI 3.4.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
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
51 bool isColour() const
52 {
53 return mIsColour;
54 }
55
56 float getWidth() const
57 {
58 return mMetrics.mWidth;
59 }
60
61 float getHeight() const
62 {
63 return mMetrics.mHeight;
64 }
65
66 float getAdvance() const
67 {
68 return mMetrics.mAdvance;
69 }
70
71 float getBearingX() const
72 {
73 return mMetrics.mBearingX;
74 }
75
76 float getBearingY() const
77 {
78 return mMetrics.mBearingY;
79 }
80
81 const FloatRect& getUVRect() const
82 {
83 return mUVRect;
84 }
85
87 {
88 return mColour;
89 }
90
91 private:
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 using VectorCharInfo = std::vector<CharInfo>;
112
113 struct LineInfo
114 {
115 void clear()
116 {
117 width = 0;
118 count = 0;
119 symbols.clear();
120 offset = 0;
121 }
122
123 int width{0};
124 int offset{0};
125 size_t count{0};
127 };
128
129 using VectorLineInfo = std::vector<LineInfo>;
130
131} // namespace MyGUI
132
133#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
uint32_t uint32
Definition MyGUI_Types.h:48
std::vector< LineInfo > VectorLineInfo
types::TRect< float > FloatRect
Definition MyGUI_Types.h:34
VectorCharInfo symbols