_________ __ __
/ _____// |_____________ _/ |______ ____ __ __ ______
\_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
/ \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
/_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
\/ \/ \//_____/ \/
______________________ ______________________
T H E W A R B E G I N S
Stratagus - A free fantasy real time strategy game engine
Font definition. More...
#include <font.h>
Public Member Functions | |
| virtual int | getHeight () const |
| virtual int | getWidth (const std::string &text) const |
Public Member Functions inherited from gcn::Font | |
| virtual | ~Font () |
| virtual int | getStringIndexAt (const std::string &text, int x) |
font.cpp - The color fonts. | |
| virtual | ~CFont () |
| int | Height () const |
| int | Width (const std::string &text) const |
| int | Width (const int number) const |
| bool | IsLoaded () const |
| virtual void | drawString (gcn::Graphics *graphics, const std::string &text, int x, int y, bool is_normal=true) |
| void | Load () |
| void | Reload () const |
| void | Clean () |
| CGraphic * | GetFontColorGraphic (const CFontColor &fontColor) const |
| template<bool CLIP> | |
| unsigned int | DrawChar (CGraphic &g, int utf8, int x, int y, const CFontColor &fc) const |
| void | DynamicLoad () const |
| static CFont * | New (const std::string &ident, CGraphic *g) |
| static CFont * | Get (const std::string &ident) |
Font definition.
#include "font.h"
Defines the fonts used in the Stratagus engine. We support proportional multicolor fonts of 9 colors. (Currently the fonts aren't packed)
CFont::CharWidth[]
The width of each font glyph in pixels. The index 0 is the width of the SPACE (' ', 0x20).
CFont::G
Contains the graphics of the font, Only 9 colors are supported.
|
virtual |
| void CFont::Clean | ( | ) |
| unsigned int CFont::DrawChar | ( | CGraphic & | g, |
| int | utf8, | ||
| int | x, | ||
| int | y, | ||
| const CFontColor & | fc | ||
| ) | const |
|
virtual |
Draws a string.
NOTE: You normally won't use this function to draw text since Graphics contains better functions for drawing text.
| graphics | a Graphics object to use for drawing. |
| text | the string to draw. |
| x | the x coordinate where to draw the string. |
| y | the y coordinate where to draw the string. |
Implements gcn::Font.
| void CFont::DynamicLoad | ( | ) | const |
|
static |
Get a font
| ident | Font identifier |
| CGraphic * CFont::GetFontColorGraphic | ( | const CFontColor & | fontColor | ) | const |
|
inlinevirtual |
Gets the height of the glyphs in the font.
Implements gcn::Font.
|
inlinevirtual |
Gets the width of a string. The width of a string is not necesserily the sum of all the widths of it's glyphs.
| text | the string to return the width of. |
Implements gcn::Font.
| int CFont::Height | ( | ) | const |
| bool CFont::IsLoaded | ( | ) | const |
| void CFont::Load | ( | ) |
Create a new font
| ident | Font identifier |
| g | Graphic |
| void CFont::Reload | ( | ) | const |
| int CFont::Width | ( | const int | number | ) | const |
Returns the pixel width of text. This is intimately tied to FormatNumber
| number | number to calculate the width of. |
| int CFont::Width | ( | const std::string & | text | ) | const |
Returns the pixel width of text.
| text | Text to calculate the width of. |
1.8.17
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.