FIFE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
FIFE::FontBase Class Referenceabstract

Abstract Font Base Class Uses a pool for rendered strings. More...

#include <fontbase.h>

+ Inheritance diagram for FIFE::FontBase:
+ Collaboration diagram for FIFE::FontBase:

Public Member Functions

 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...
 
virtual SDL_Surface * renderString (const std::string &text)=0
 
- 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...
 
virtual int32_t getWidth (const std::string &text) const =0
 gets width of given text More...
 
virtual int32_t getHeight () const =0
 gets height of this font More...
 

Protected Attributes

TextRenderPool m_pool
 
SDL_Color mColor
 
int32_t mGlyphSpacing
 
int32_t mRowSpacing
 
std::string mFilename
 
bool m_antiAlias
 

Detailed Description

Abstract Font Base Class Uses a pool for rendered strings.

See Also
TextRenderPool

Definition at line 48 of file fontbase.h.

Constructor & Destructor Documentation

FIFE::FontBase::FontBase ( )

Definition at line 43 of file fontbase.cpp.

virtual FIFE::FontBase::~FontBase ( )
inlinevirtual

Definition at line 51 of file fontbase.h.

Member Function Documentation

Image * FIFE::FontBase::getAsImage ( const std::string &  text)
virtual

Gets given text as Image The rsulting image is pooled, so it's not that time critical.

Implements FIFE::IFont.

Definition at line 112 of file fontbase.cpp.

References FIFE::TextRenderPool::addRenderedText(), FIFE::RenderBackend::createImage(), FIFE::TextRenderPool::getRenderedText(), FIFE::DynamicSingleton< RenderBackend >::instance(), m_pool, and renderString().

Image * FIFE::FontBase::getAsImageMultiline ( const std::string &  text)
virtual
SDL_Color FIFE::FontBase::getColor ( ) const
virtual

Get the color the text was rendered in.

Implements FIFE::IFont.

Definition at line 80 of file fontbase.cpp.

References mColor.

Referenced by FIFE::TextRenderPool::addRenderedText(), and FIFE::TextRenderPool::getRenderedText().

+ Here is the caller graph for this function:

int32_t FIFE::FontBase::getGlyphSpacing ( ) const
virtual

Gets the spacing between letters in pixels.

Returns
the spacing.

Implements FIFE::IFont.

Definition at line 68 of file fontbase.cpp.

References mGlyphSpacing.

Referenced by FIFE::TextRenderPool::addRenderedText(), FIFE::TextRenderPool::getRenderedText(), FIFE::ImageFontBase::getWidth(), and FIFE::ImageFontBase::renderString().

+ Here is the caller graph for this function:

int32_t FIFE::FontBase::getRowSpacing ( ) const
virtual

Gets the spacing between rows in pixels.

Returns
the spacing.

Implements FIFE::IFont.

Definition at line 60 of file fontbase.cpp.

References mRowSpacing.

Referenced by FIFE::TextRenderPool::addRenderedText(), getAsImageMultiline(), FIFE::TrueTypeFont::getHeight(), and FIFE::TextRenderPool::getRenderedText().

+ Here is the caller graph for this function:

int32_t FIFE::FontBase::getStringIndexAt ( const std::string &  text,
int32_t  x 
) const
virtual

Implements FIFE::IFont.

Definition at line 84 of file fontbase.cpp.

References FIFE::IFont::getWidth(), utf8::is_valid(), and utf8::next().

void FIFE::FontBase::invalidate ( )
virtual

Implements FIFE::IFont.

Definition at line 52 of file fontbase.cpp.

References FIFE::TextRenderPool::invalidateCachedText(), and m_pool.

bool FIFE::FontBase::isAntiAlias ( )
virtual

Checks if anti aliasing is used.

Returns
true if anti aliasing is used.

Implements FIFE::IFont.

Definition at line 76 of file fontbase.cpp.

References m_antiAlias.

Referenced by FIFE::TextRenderPool::addRenderedText(), and FIFE::TextRenderPool::getRenderedText().

+ Here is the caller graph for this function:

virtual SDL_Surface* FIFE::FontBase::renderString ( const std::string &  text)
pure virtual

Implemented in FIFE::TrueTypeFont, and FIFE::ImageFontBase.

Referenced by getAsImage(), and getAsImageMultiline().

+ Here is the caller graph for this function:

void FIFE::FontBase::setAntiAlias ( bool  antiAlias)
virtual

Sets the use of anti aliasing.

Parameters
antiAliastrue for use of anti aliasing.

Implements FIFE::IFont.

Definition at line 72 of file fontbase.cpp.

References m_antiAlias.

void FIFE::FontBase::setGlyphSpacing ( int32_t  spacing)
virtual

Sets the spacing between letters in pixels.

Default is 0 pixels. The spacing can be negative.

Parameters
spacingthe spacing in pixels.

Implements FIFE::IFont.

Definition at line 64 of file fontbase.cpp.

References mGlyphSpacing.

void FIFE::FontBase::setRowSpacing ( int32_t  spacing)
virtual

Sets the spacing between rows in pixels.

Default is 0 pixels. The spacing can be negative.

Parameters
spacingthe spacing in pixels.

Implements FIFE::IFont.

Definition at line 56 of file fontbase.cpp.

References mRowSpacing.

std::string FIFE::FontBase::splitTextToWidth ( const std::string &  text,
int32_t  render_width 
)
virtual

Member Data Documentation

bool FIFE::FontBase::m_antiAlias
protected

Definition at line 78 of file fontbase.h.

Referenced by isAntiAlias(), FIFE::TrueTypeFont::renderString(), and setAntiAlias().

TextRenderPool FIFE::FontBase::m_pool
protected

Definition at line 71 of file fontbase.h.

Referenced by getAsImage(), getAsImageMultiline(), and invalidate().

SDL_Color FIFE::FontBase::mColor
protected
std::string FIFE::FontBase::mFilename
protected

Definition at line 77 of file fontbase.h.

int32_t FIFE::FontBase::mGlyphSpacing
protected

Definition at line 74 of file fontbase.h.

Referenced by getGlyphSpacing(), and setGlyphSpacing().

int32_t FIFE::FontBase::mRowSpacing
protected

Definition at line 75 of file fontbase.h.

Referenced by getRowSpacing(), and setRowSpacing().


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