MyGUI
3.0.1
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
File List
Globals
MyGUIEngine
include
MyGUI_FontData.h
Go to the documentation of this file.
1
7
/*
8
This file is part of MyGUI.
9
10
MyGUI is free software: you can redistribute it and/or modify
11
it under the terms of the GNU Lesser General Public License as published by
12
the Free Software Foundation, either version 3 of the License, or
13
(at your option) any later version.
14
15
MyGUI is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU Lesser General Public License for more details.
19
20
You should have received a copy of the GNU Lesser General Public License
21
along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22
*/
23
#ifndef __MYGUI_FONT_DATA_H__
24
#define __MYGUI_FONT_DATA_H__
25
26
#include "
MyGUI_Prerequest.h
"
27
28
namespace
MyGUI
29
{
30
31
struct
MYGUI_EXPORT
FontCodeType
32
{
33
enum
Enum
34
{
35
Selected = 6,
36
SelectedBack = 7,
37
Cursor = 8,
38
Tab
= 9,
39
LF = 0x000A,
40
CR = 0x000D,
41
Space = 0x0020,
42
LatinStart = 0x0021,
43
NEL = 0x0085,
44
LatinEnd = 0x00A6,
45
MAX
46
};
47
48
FontCodeType
(
Enum
_value = MAX) : value(_value) { }
49
50
friend
bool
operator ==
(
FontCodeType
const
& a,
FontCodeType
const
& b) {
return
a.value == b.value; }
51
friend
bool
operator !=
(
FontCodeType
const
& a,
FontCodeType
const
& b) {
return
a.value != b.value; }
52
53
private
:
54
Enum value;
55
};
56
57
// информация об одном символе
58
struct
GlyphInfo
59
{
60
FloatRect
uvRect
;
61
Char
codePoint
;
62
int
width
;
63
64
GlyphInfo
() :
codePoint
(0),
width
(0) { }
65
};
66
67
typedef
std::vector<GlyphInfo>
VectorGlyphInfo
;
68
69
// информация об диапазоне
70
//FIXME move to std::pair
71
class
PairCodePoint
72
{
73
public
:
74
PairCodePoint
() :
first
(0),
last
(0) { }
75
PairCodePoint
(
Char
_first,
Char
_last) :
first
(_first),
last
(_last) { }
76
77
// проверяет входит ли символ в диапазон
78
bool
isExist
(
Char
_code)
const
{
return
_code >=
first
&& _code <=
last
; }
79
80
public
:
81
Char
first
;
82
Char
last
;
83
};
84
85
// инфомация о диапазоне символов
86
class
RangeInfo
87
{
88
public
:
89
RangeInfo
() :
first
(0),
last
(0) { }
90
RangeInfo
(
Char
_first,
Char
_last) :
91
first
(_first),
92
last
(_last)
93
{
94
range
.resize(
last
-
first
+ 1);
95
}
96
97
// проверяет входит ли символ в диапазон
98
bool
isExist
(
Char
_code)
const
{
return
_code >=
first
&& _code <=
last
; }
99
100
// возвращает указатель на глиф, или 0, если код не входит в диапазон
101
GlyphInfo
*
getInfo
(
Char
_code) {
return
isExist
(_code) ? &
range
[_code -
first
] :
nullptr
; }
102
void
setInfo
(
Char
_code,
GlyphInfo
* _value) {
if
(
isExist
(_code))
range
[_code -
first
] = *_value; }
103
104
public
:
105
Char
first
;
106
Char
last
;
107
VectorGlyphInfo
range
;
108
};
109
110
// FIXME move to resource font
111
class
PairCodeCoord
112
{
113
public
:
114
PairCodeCoord
() :
code
(0) { }
115
PairCodeCoord
(
Char
_code,
const
IntCoord
& _coord) :
116
code
(_code),
117
coord
(_coord)
118
{
119
}
120
121
bool
operator <
(
const
PairCodeCoord
& _value)
const
{
return
code
< _value.
code
; }
122
123
Char
code
;
124
IntCoord
coord
;
125
};
126
127
}
// namespace MyGUI
128
129
#endif // __MYGUI_FONT_DATA_H__
Generated by
1.8.1.2