gcn::DefaultFont Class Reference

#include <defaultfont.hpp>

Inheritance diagram for gcn::DefaultFont:

gcn::Font List of all members.

Detailed Description

A font only capable of drawing rectangles.

It is used by default in Guichan if no font has been set merely to show that no font has been set.

Definition at line 70 of file defaultfont.hpp.

Public Member Functions

virtual int drawGlyph (Graphics *graphics, unsigned char glyph, int x, int y)
 Draws a glyph as a rectangle.
virtual void drawString (Graphics *graphics, const std::string &text, int x, int y)
 Draws a string.
virtual int getHeight () const
 Gets the height of the glyphs in the font.
virtual int getStringIndexAt (const std::string &text, int x)
virtual int getWidth (const std::string &text) const
 Gets the width of a string.
virtual ~DefaultFont ()
 Destructor.


Member Function Documentation

int gcn::DefaultFont::drawGlyph ( Graphics graphics,
unsigned char  glyph,
int  x,
int  y 
) [virtual]

Draws a glyph as a rectangle.

The glyphs will always be drawn as rectangles no matter the glyph.

NOTE: You normally won't use this function to draw text since the Graphics class contains better functions for drawing text.

Parameters:
graphics A Graphics object to be used for drawing.
glyph The glyph to draw.
x The x coordinate where to draw the glyph.
y The y coordinate where to draw the glyph.
Returns:
The width of the drawn glyph in pixels.

Definition at line 80 of file defaultfont.cpp.

References gcn::Graphics::drawRectangle().

Referenced by drawString().

void gcn::DefaultFont::drawString ( Graphics graphics,
const std::string &  text,
int  x,
int  y 
) [virtual]

Draws a string.

NOTE: You normally won't use this function to draw text since Graphics contains better functions for drawing text.

Parameters:
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.

Definition at line 87 of file defaultfont.cpp.

References drawGlyph(), and getWidth().

int gcn::DefaultFont::getHeight (  )  const [virtual]

Gets the height of the glyphs in the font.

Returns:
The height of the glyphs int the font.

Implements gcn::Font.

Definition at line 70 of file defaultfont.cpp.

int gcn::DefaultFont::getWidth ( const std::string &  text  )  const [virtual]

Gets the width of a string.

The width of a string is not necesserily the sum of all the widths of it's glyphs.

Parameters:
text The string to return the width of.
Returns:
The width of a string.

Implements gcn::Font.

Definition at line 75 of file defaultfont.cpp.

Referenced by drawString().


The documentation for this class was generated from the following files:
Generated on Sun Jan 20 21:48:14 2008 for Guichan by  doxygen 1.5.2