44 #include "UI/uienumerations.h"
45 #include "UI/kerning.h"
47 #include "UI/textureatlas.h"
48 #include "exception.h"
62 typedef std::vector<KerningInfo> KerningContainer;
63 typedef KerningContainer::iterator KerningIterator;
64 typedef KerningContainer::const_iterator ConstKerningIterator;
82 Atlas(Data->GetAtlas()), Font(Data), GlyphID(0), GlyphAdvance(0), VerticalOffset(0) { }
90 Atlas(TexAtlas), Font(Data), GlyphID(ID), GlyphAdvance(Advance), VerticalOffset(VertOffset) { }
93 { this->Kernings.clear(); }
119 {
return this->Atlas->GetName(); }
126 Whole NumKernings = this->Kernings.size();
127 if( NumKernings == 0 || Previous == 0 )
130 for(
Whole Index = 0 ; Index < NumKernings ; ++Index )
132 if( this->Kernings[Index].
Character == Previous )
133 return this->Kernings[Index].Kerning;
143 {
return (this->GlyphID == HT); }
146 {
return (this->GlyphID == LF); }
149 {
return (this->GlyphID == VT); }
152 {
return (this->GlyphID == CR); }
155 {
return (this->GlyphID == Space); }
158 {
return (this->GlyphID == NEL); }
162 {
return this->IsHorizontalTab() || this->IsVerticalTab(); }
165 {
return this->IsLineFeed() || this->IsCarriageReturn() || this->IsNextLine(); }
168 {
return this->IsTab() || this->IsNewLine() || this->IsSpace(); }
175 {
return this->AtlasCoords[UI::QC_TopLeft].Y * this->Atlas->GetTextureSize().Y; }
178 {
return this->AtlasCoords[UI::QC_BottomRight].Y * this->Atlas->GetTextureSize().Y; }
181 {
return this->AtlasCoords[UI::QC_TopLeft].X * this->Atlas->GetTextureSize().X; }
184 {
return this->AtlasCoords[UI::QC_BottomRight].X * this->Atlas->GetTextureSize().X; }
187 {
return this->GetSize().Y; }
190 {
return this->GetSize().X; }
193 {
return this->AtlasCoords[UI::QC_TopLeft] * this->Atlas->GetTextureSize(); }
197 if( this->IsNewLine() )
return Vector2(0,0);
198 else if( this->IsSpace() || this->IsTab() )
return Vector2(this->GlyphAdvance,this->Font->GetBaseLine());
199 else return (this->AtlasCoords[UI::QC_BottomRight] - this->AtlasCoords[UI::QC_TopLeft]) * this->Atlas->GetTextureSize();
208 case UI::QC_TopLeft:
return this->AtlasCoords[UI::QC_TopLeft] * this->Atlas->GetTextureSize();
break;
209 case UI::QC_TopRight:
return this->AtlasCoords[UI::QC_TopRight] * this->Atlas->GetTextureSize();
break;
210 case UI::QC_BottomLeft:
return this->AtlasCoords[UI::QC_BottomLeft] * this->Atlas->GetTextureSize();
break;
211 case UI::QC_BottomRight:
return this->AtlasCoords[UI::QC_BottomRight] * this->Atlas->GetTextureSize();
break;
222 case UI::QC_TopLeft:
return this->AtlasCoords[UI::QC_TopLeft];
break;
223 case UI::QC_TopRight:
return this->AtlasCoords[UI::QC_TopRight];
break;
224 case UI::QC_BottomLeft:
return this->AtlasCoords[UI::QC_BottomLeft];
break;
225 case UI::QC_BottomRight:
return this->AtlasCoords[UI::QC_BottomRight];
break;