MyGUI
3.2.1
|
00001 /* 00002 * This source file is part of MyGUI. For the latest info, see http://mygui.info/ 00003 * Distributed under the MIT License 00004 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT) 00005 */ 00006 00007 #ifndef __MYGUI_TEXT_VIEW_DATA_H__ 00008 #define __MYGUI_TEXT_VIEW_DATA_H__ 00009 00010 #include "MyGUI_Prerequest.h" 00011 00012 namespace MyGUI 00013 { 00014 00015 class CharInfo 00016 { 00017 public: 00018 CharInfo() : 00019 mIsColour(false) 00020 { 00021 mMetrics.mWidth = 0.0f; 00022 mMetrics.mHeight = 0.0f; 00023 mMetrics.mAdvance = 0.0f; 00024 mMetrics.mBearingX = 0.0f; 00025 mMetrics.mBearingY = 0.0f; 00026 } 00027 00028 CharInfo( 00029 const FloatRect& _rect, 00030 float _width, 00031 float _height, 00032 float _advance, 00033 float _bearingX, 00034 float _bearingY) : 00035 mIsColour(false), 00036 mUVRect(_rect) 00037 { 00038 mMetrics.mWidth = _width; 00039 mMetrics.mHeight = _height; 00040 mMetrics.mAdvance = _advance; 00041 mMetrics.mBearingX = _bearingX; 00042 mMetrics.mBearingY = _bearingY; 00043 } 00044 00045 CharInfo(uint32 _colour) : 00046 mIsColour(true), 00047 mColour(_colour) 00048 { } 00049 00050 bool isColour() const 00051 { 00052 return mIsColour; 00053 } 00054 00055 float getWidth() const 00056 { 00057 return mMetrics.mWidth; 00058 } 00059 00060 float getHeight() const 00061 { 00062 return mMetrics.mHeight; 00063 } 00064 00065 float getAdvance() const 00066 { 00067 return mMetrics.mAdvance; 00068 } 00069 00070 float getBearingX() const 00071 { 00072 return mMetrics.mBearingX; 00073 } 00074 00075 float getBearingY() const 00076 { 00077 return mMetrics.mBearingY; 00078 } 00079 00080 const FloatRect& getUVRect() const 00081 { 00082 return mUVRect; 00083 } 00084 00085 uint32 getColour() const 00086 { 00087 return mColour; 00088 } 00089 00090 private: 00091 00092 bool mIsColour; 00093 FloatRect mUVRect; 00094 00095 struct Metrics 00096 { 00097 float mWidth; 00098 float mHeight; 00099 float mAdvance; 00100 float mBearingX; 00101 float mBearingY; 00102 }; 00103 00104 union 00105 { 00106 Metrics mMetrics; 00107 uint32 mColour; 00108 }; 00109 00110 }; 00111 00112 typedef std::vector<CharInfo> VectorCharInfo; 00113 00114 struct LineInfo 00115 { 00116 LineInfo() : 00117 width(0), 00118 offset(0), 00119 count(0) 00120 { 00121 } 00122 00123 void clear() 00124 { 00125 width = 0; 00126 count = 0; 00127 simbols.clear(); 00128 offset = 0; 00129 } 00130 00131 int width; 00132 int offset; 00133 size_t count; 00134 VectorCharInfo simbols; 00135 }; 00136 00137 typedef std::vector<LineInfo> VectorLineInfo; 00138 00139 } // namespace MyGUI 00140 00141 #endif // __MYGUI_TEXT_VIEW_DATA_H__