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