Go to the documentation of this file.00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __MYGUI_FONT_DATA_H__
00024 #define __MYGUI_FONT_DATA_H__
00025
00026 #include "MyGUI_Prerequest.h"
00027
00028 namespace MyGUI
00029 {
00030
00031 struct MYGUI_EXPORT FontCodeType
00032 {
00033 enum Enum
00034 {
00035 Selected = 6,
00036 SelectedBack = 7,
00037 Cursor = 8,
00038 Tab = 9,
00039 LF = 0x000A,
00040 CR = 0x000D,
00041 Space = 0x0020,
00042 LatinStart = 0x0021,
00043 NEL = 0x0085,
00044 LatinEnd = 0x00A6,
00045 MAX
00046 };
00047
00048 FontCodeType(Enum _value = MAX) : value(_value) { }
00049
00050 friend bool operator == (FontCodeType const& a, FontCodeType const& b) { return a.value == b.value; }
00051 friend bool operator != (FontCodeType const& a, FontCodeType const& b) { return a.value != b.value; }
00052
00053 private:
00054 Enum value;
00055 };
00056
00057
00058 struct GlyphInfo
00059 {
00060 FloatRect uvRect;
00061 Char codePoint;
00062 int width;
00063
00064 GlyphInfo() : codePoint(0), width(0) { }
00065 };
00066
00067 typedef std::vector<GlyphInfo> VectorGlyphInfo;
00068
00069
00070
00071 class PairCodePoint
00072 {
00073 public:
00074 PairCodePoint() : first(0), last(0) { }
00075 PairCodePoint(Char _first, Char _last) : first(_first), last(_last) { }
00076
00077
00078 bool isExist(Char _code) { return _code >= first && _code <= last; }
00079
00080 public:
00081 Char first;
00082 Char last;
00083 };
00084
00085
00086 class RangeInfo
00087 {
00088 public:
00089 RangeInfo() : first(0), last(0) { }
00090 RangeInfo(Char _first, Char _last) :
00091 first(_first),
00092 last(_last)
00093 {
00094 range.resize(last - first + 1);
00095 }
00096
00097
00098 bool isExist(Char _code) { return _code >= first && _code <= last; }
00099
00100
00101 GlyphInfo* getInfo(Char _code) { return isExist(_code) ? &range[_code - first] : nullptr; }
00102 void setInfo(Char _code, GlyphInfo* _value) { if (isExist(_code)) range[_code - first] = *_value; }
00103
00104 public:
00105 Char first;
00106 Char last;
00107 VectorGlyphInfo range;
00108 };
00109
00110
00111 class PairCodeCoord
00112 {
00113 public:
00114 PairCodeCoord() : code(0) { }
00115 PairCodeCoord(Char _code, const IntCoord& _coord) :
00116 code(_code),
00117 coord(_coord)
00118 {
00119 }
00120
00121 bool operator < (const PairCodeCoord& _value) const { return code < _value.code; }
00122
00123 Char code;
00124 IntCoord coord;
00125 };
00126
00127 }
00128
00129 #endif // __MYGUI_FONT_DATA_H__