MyGUI: MyGUI_TextViewData.h Source File

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
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
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
86 uint32 getColour() const
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;
107 uint32 mColour;
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};
126 VectorCharInfo symbols;
127 };
128
129 using VectorLineInfo = std::vector<LineInfo>;
130
131} // namespace MyGUI
132
133#endif // MYGUI_TEXT_VIEW_DATA_H_
MyGUI_Prerequest.h
MyGUI::CharInfo::getHeight
float getHeight() const
Definition MyGUI_TextViewData.h:61
MyGUI::CharInfo::getUVRect
const FloatRect & getUVRect() const
Definition MyGUI_TextViewData.h:81
MyGUI::CharInfo::getWidth
float getWidth() const
Definition MyGUI_TextViewData.h:56
MyGUI::CharInfo::getAdvance
float getAdvance() const
Definition MyGUI_TextViewData.h:66
MyGUI::CharInfo::isColour
bool isColour() const
Definition MyGUI_TextViewData.h:51
MyGUI::CharInfo::getBearingY
float getBearingY() const
Definition MyGUI_TextViewData.h:76
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:86
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:71
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::VectorCharInfo
std::vector< CharInfo > VectorCharInfo
Definition MyGUI_TextViewData.h:111
MyGUI::uint32
uint32_t uint32
Definition MyGUI_Types.h:48
MyGUI::VectorLineInfo
std::vector< LineInfo > VectorLineInfo
Definition MyGUI_TextViewData.h:129
MyGUI::FloatRect
types::TRect< float > FloatRect
Definition MyGUI_Types.h:34
MyGUI::LineInfo
Definition MyGUI_TextViewData.h:114
MyGUI::LineInfo::width
int width
Definition MyGUI_TextViewData.h:123
MyGUI::LineInfo::clear
void clear()
Definition MyGUI_TextViewData.h:115
MyGUI::LineInfo::offset
int offset
Definition MyGUI_TextViewData.h:124
MyGUI::LineInfo::count
size_t count
Definition MyGUI_TextViewData.h:125
MyGUI::LineInfo::symbols
VectorCharInfo symbols
Definition MyGUI_TextViewData.h:126