MyGUI_TextViewData.h
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_TEXT_VIEW_DATA_H_
#define MYGUI_TEXT_VIEW_DATA_H_
#include "MyGUI_Prerequest.h"
namespace MyGUI
{
class CharInfo
{
public:
CharInfo() :
mIsColour(false)
{
mMetrics.mWidth = 0.0f;
mMetrics.mHeight = 0.0f;
mMetrics.mAdvance = 0.0f;
mMetrics.mBearingX = 0.0f;
mMetrics.mBearingY = 0.0f;
}
CharInfo(
const FloatRect& _rect,
float _width,
float _height,
float _advance,
float _bearingX,
float _bearingY) :
mIsColour(false),
mUVRect(_rect)
{
mMetrics.mWidth = _width;
mMetrics.mHeight = _height;
mMetrics.mAdvance = _advance;
mMetrics.mBearingX = _bearingX;
mMetrics.mBearingY = _bearingY;
}
CharInfo(uint32 _colour) :
mIsColour(true),
mColour(_colour)
{
}
bool isColour() const
{
return mIsColour;
}
float getWidth() const
{
return mMetrics.mWidth;
}
float getHeight() const
{
return mMetrics.mHeight;
}
float getAdvance() const
{
return mMetrics.mAdvance;
}
float getBearingX() const
{
return mMetrics.mBearingX;
}
float getBearingY() const
{
return mMetrics.mBearingY;
}
const FloatRect& getUVRect() const
{
return mUVRect;
}
uint32 getColour() const
{
return mColour;
}
private:
bool mIsColour;
FloatRect mUVRect;
struct Metrics
{
float mWidth;
float mHeight;
float mAdvance;
float mBearingX;
float mBearingY;
};
union
{
Metrics mMetrics;
uint32 mColour;
};
};
using VectorCharInfo = std::vector<CharInfo>;
struct LineInfo
{
void clear()
{
width = 0;
count = 0;
symbols.clear();
offset = 0;
}
int width{0};
int offset{0};
size_t count{0};
VectorCharInfo symbols;
};
using VectorLineInfo = std::vector<LineInfo>;
} // namespace MyGUI
#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