Crazy Eddie's GUI System 0.8.7
FontGlyph.h
1/***********************************************************************
2 created: Sun Jul 19 2009
3 author: Paul D Turner <paul@cegui.org.uk>
4*************************************************************************/
5/***************************************************************************
6 * Copyright (C) 2004 - 2011 Paul D Turner & The CEGUI Development Team
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 ***************************************************************************/
27#ifndef _CEGUIFontGlyph_h_
28#define _CEGUIFontGlyph_h_
29
30#include "CEGUI/Image.h"
31
32// Start of CEGUI namespace section
33namespace CEGUI
34{
42class CEGUIEXPORT FontGlyph:
43 public AllocatedObject<FontGlyph>
44{
45public:
47 FontGlyph(float advance = 0.0f, Image* image = 0, bool valid = false) :
48 d_image(image),
49 d_advance(advance),
50 d_valid(valid)
51 {}
52
54 Image* getImage() const
55 { return d_image; }
56
58 Sizef getSize(float x_scale, float y_scale) const
59 { return Sizef(getWidth(x_scale), getHeight(y_scale)); }
60
62 float getWidth(float x_scale) const
63 { return d_image->getRenderedSize().d_width * x_scale; }
64
66 float getHeight(float y_scale) const
67 { return d_image->getRenderedSize().d_height * y_scale; }
68
76 float getRenderedAdvance(float x_scale) const
77 { return (d_image->getRenderedSize().d_width +
78 d_image->getRenderedOffset().d_x) * x_scale; }
79
89 float getAdvance(float x_scale = 1.0) const
90 { return d_advance * x_scale; }
91
93 void setAdvance(float advance)
94 { d_advance = advance; }
95
97 void setImage(Image* image)
98 { d_image = image; }
99
101 void setValid(bool valid)
102 { d_valid = valid; }
103
105 bool isValid() const
106 { return d_valid; }
107
108private:
110 Image* d_image;
112 float d_advance;
114 bool d_valid;
115};
116
117} // End of CEGUI namespace section
118
119#endif // end of guard _CEGUIFontGlyph_h_
Definition: MemoryAllocatedObject.h:110
internal class representing a single font glyph.
Definition: FontGlyph.h:44
float getHeight(float y_scale) const
Return the scaled height of the glyph.
Definition: FontGlyph.h:66
void setValid(bool valid)
mark the FontGlyph as valid
Definition: FontGlyph.h:101
void setImage(Image *image)
Set the CEGUI::Image object rendered for this glyph.
Definition: FontGlyph.h:97
float getWidth(float x_scale) const
Return the scaled width of the glyph.
Definition: FontGlyph.h:62
bool isValid() const
return whether the FontGlyph is marked as valid
Definition: FontGlyph.h:105
FontGlyph(float advance=0.0f, Image *image=0, bool valid=false)
Constructor.
Definition: FontGlyph.h:47
void setAdvance(float advance)
Set the horizontal advance value for the glyph.
Definition: FontGlyph.h:93
float getAdvance(float x_scale=1.0) const
Return the horizontal advance value for the glyph.
Definition: FontGlyph.h:89
Image * getImage() const
Return the CEGUI::Image object rendered for this glyph.
Definition: FontGlyph.h:54
Sizef getSize(float x_scale, float y_scale) const
Return the scaled pixel size of the glyph.
Definition: FontGlyph.h:58
float getRenderedAdvance(float x_scale) const
Return the rendered advance value for this glyph.
Definition: FontGlyph.h:76
Interface for Image.
Definition: Image.h:161
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1