FIFE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
FIFE::ImageFontBase Class Reference

ImageFont base class. More...

#include <imagefontbase.h>

+ Inheritance diagram for FIFE::ImageFontBase:
+ Collaboration diagram for FIFE::ImageFontBase:

Classes

struct  s_glyph
 

Public Member Functions

 ImageFontBase ()
 Constructor. More...
 
virtual ~ImageFontBase ()
 Destructor. More...
 
virtual int32_t getWidth (const std::string &text) const
 Get the width in pixels a given text would occupy. More...
 
virtual int32_t getHeight () const
 Get the height in pixels a text line would occupy. More...
 
virtual SDL_Surface * renderString (const std::string &text)
 
virtual void setColor (Uint8 r, Uint8 g, Uint8 b, Uint8 a=255)
 
- Public Member Functions inherited from FIFE::FontBase
 FontBase ()
 
virtual ~FontBase ()
 
void invalidate ()
 
void setRowSpacing (int32_t spacing)
 Sets the spacing between rows in pixels. More...
 
int32_t getRowSpacing () const
 Gets the spacing between rows in pixels. More...
 
void setGlyphSpacing (int32_t spacing)
 Sets the spacing between letters in pixels. More...
 
int32_t getGlyphSpacing () const
 Gets the spacing between letters in pixels. More...
 
void setAntiAlias (bool antiAlias)
 Sets the use of anti aliasing. More...
 
bool isAntiAlias ()
 Checks if anti aliasing is used. More...
 
virtual int32_t getStringIndexAt (const std::string &text, int32_t x) const
 
ImagegetAsImage (const std::string &text)
 Gets given text as Image The rsulting image is pooled, so it's not that time critical. More...
 
ImagegetAsImageMultiline (const std::string &text)
 Gets given text as Image. More...
 
std::string splitTextToWidth (const std::string &text, int32_t render_width)
 
SDL_Color getColor () const
 Get the color the text was rendered in. More...
 
- Public Member Functions inherited from FIFE::IFont
virtual ~IFont ()
 
virtual void setColor (uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Set the color the text should be rendered in. More...
 

Protected Types

typedef std::map< int32_t,
s_glyph
type_glyphs
 

Protected Attributes

type_glyphs m_glyphs
 
s_glyph m_placeholder
 
int32_t mHeight
 
int32_t mGlyphSpacing
 
int32_t mRowSpacing
 
std::string mFilename
 
bool mAntiAlias
 
- Protected Attributes inherited from FIFE::FontBase
TextRenderPool m_pool
 
SDL_Color mColor
 
int32_t mGlyphSpacing
 
int32_t mRowSpacing
 
std::string mFilename
 
bool m_antiAlias
 

Detailed Description

ImageFont base class.

Just set the glyphs/placeholder in any derived class and the rendering is handled by this class. Also frees all glyph surfaces on destruction.

Definition at line 46 of file imagefontbase.h.

Member Typedef Documentation

typedef std::map<int32_t,s_glyph> FIFE::ImageFontBase::type_glyphs
protected

Definition at line 81 of file imagefontbase.h.

Constructor & Destructor Documentation

FIFE::ImageFontBase::ImageFontBase ( )

Constructor.

Definition at line 43 of file imagefontbase.cpp.

FIFE::ImageFontBase::~ImageFontBase ( )
virtual

Destructor.

Definition at line 46 of file imagefontbase.cpp.

References m_glyphs.

Member Function Documentation

int32_t FIFE::ImageFontBase::getHeight ( ) const
virtual

Get the height in pixels a text line would occupy.

Implements FIFE::IFont.

Definition at line 73 of file imagefontbase.cpp.

References mHeight.

Referenced by renderString().

+ Here is the caller graph for this function:

int32_t FIFE::ImageFontBase::getWidth ( const std::string &  text) const
virtual

Get the width in pixels a given text would occupy.

Parameters
textThe text that should be measured.

Implements FIFE::IFont.

Definition at line 54 of file imagefontbase.cpp.

References FIFE::FontBase::getGlyphSpacing(), m_glyphs, m_placeholder, utf8::next(), and FIFE::ImageFontBase::s_glyph::surface.

Referenced by renderString().

+ Here is the caller graph for this function:

void FIFE::ImageFontBase::setColor ( Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a = 255 
)
virtual

Definition at line 111 of file imagefontbase.cpp.

Member Data Documentation

type_glyphs FIFE::ImageFontBase::m_glyphs
protected
s_glyph FIFE::ImageFontBase::m_placeholder
protected

Definition at line 86 of file imagefontbase.h.

Referenced by getWidth(), renderString(), and FIFE::SubImageFont::SubImageFont().

bool FIFE::ImageFontBase::mAntiAlias
protected

Definition at line 93 of file imagefontbase.h.

std::string FIFE::ImageFontBase::mFilename
protected

Definition at line 92 of file imagefontbase.h.

int32_t FIFE::ImageFontBase::mGlyphSpacing
protected

Definition at line 89 of file imagefontbase.h.

int32_t FIFE::ImageFontBase::mHeight
protected

Definition at line 88 of file imagefontbase.h.

Referenced by getHeight(), and FIFE::SubImageFont::SubImageFont().

int32_t FIFE::ImageFontBase::mRowSpacing
protected

Definition at line 90 of file imagefontbase.h.


The documentation for this class was generated from the following files: