FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
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...
 
virtual void setAntiAlias (bool antiAlias)
 Sets the use of anti aliasing. More...
 
virtual bool isAntiAlias () const
 Checks if anti aliasing is used. More...
 
virtual void setBoldStyle (bool style)
 Sets the use of bold style. More...
 
virtual bool isBoldStyle () const
 Checks if bold style is used. More...
 
virtual void setItalicStyle (bool style)
 Sets the use of italic style. More...
 
virtual bool isItalicStyle () const
 Checks if italic style is used. More...
 
virtual void setUnderlineStyle (bool style)
 Sets the use of underline style. More...
 
virtual bool isUnderlineStyle () const
 Checks if underline style is used. More...
 
virtual void setStrikethroughStyle (bool style)
 Sets the use of strikethrough style. More...
 
virtual bool isStrikethroughStyle () const
 Checks if strikethrough style is used. More...
 
virtual void setDynamicColoring (bool coloring)
 
virtual bool isDynamicColoring () const
 
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
 
bool m_boldStyle
 
bool m_italicStyle
 
bool m_underlineStyle
 
bool m_strikeStyle
 
bool m_coloring
 

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.

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 157 of file fontbase.cpp.

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

Referenced by ~FontBase().

+ Here is the caller graph for this function:

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

Gets given text as Image.

Text is splitted on multiple lines based "\n" marks The rsulting image is pooled, so it's not that time critical

Implements FIFE::IFont.

Definition at line 167 of file fontbase.cpp.

References FIFE::TextRenderPool::addRenderedText(), FIFE::AMASK, utf8::append(), FIFE::BMASK, FIFE::RenderBackend::createImage(), FIFE::IFont::getHeight(), FIFE::TextRenderPool::getRenderedText(), getRowSpacing(), FIFE::GMASK, FIFE::DynamicSingleton< RenderBackend >::instance(), m_pool, utf8::next(), renderString(), FIFE::RMASK, and utf8::utf8to32().

Referenced by ~FontBase().

+ Here is the caller graph for this function:

SDL_Color FIFE::FontBase::getColor ( ) const
virtual

Get the color the text was rendered in.

Implements FIFE::IFont.

Definition at line 125 of file fontbase.cpp.

References mColor.

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

+ 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 73 of file fontbase.cpp.

References mGlyphSpacing.

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

+ 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 65 of file fontbase.cpp.

References mRowSpacing.

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

+ 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 129 of file fontbase.cpp.

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

Referenced by ~FontBase().

+ Here is the caller graph for this function:

void FIFE::FontBase::invalidate ( )
virtual

Implements FIFE::IFont.

Definition at line 57 of file fontbase.cpp.

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

Referenced by ~FontBase().

+ Here is the caller graph for this function:

bool FIFE::FontBase::isAntiAlias ( ) const
virtual

Checks if anti aliasing is used.

Returns
true if anti aliasing is used.

Implements FIFE::IFont.

Definition at line 81 of file fontbase.cpp.

References m_antiAlias.

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

+ Here is the caller graph for this function:

bool FIFE::FontBase::isBoldStyle ( ) const
virtual

Checks if bold style is used.

Returns
true if bold style is used.

Implements FIFE::IFont.

Definition at line 89 of file fontbase.cpp.

References m_boldStyle.

Referenced by ~FontBase().

+ Here is the caller graph for this function:

bool FIFE::FontBase::isDynamicColoring ( ) const
virtual

Implements FIFE::IFont.

Definition at line 121 of file fontbase.cpp.

References m_coloring.

Referenced by ~FontBase().

+ Here is the caller graph for this function:

bool FIFE::FontBase::isItalicStyle ( ) const
virtual

Checks if italic style is used.

Returns
true if italic style is used.

Implements FIFE::IFont.

Definition at line 97 of file fontbase.cpp.

References m_italicStyle.

Referenced by ~FontBase().

+ Here is the caller graph for this function:

bool FIFE::FontBase::isStrikethroughStyle ( ) const
virtual

Checks if strikethrough style is used.

Returns
true if strikethrough style is used.

Implements FIFE::IFont.

Definition at line 113 of file fontbase.cpp.

References m_strikeStyle.

Referenced by ~FontBase().

+ Here is the caller graph for this function:

bool FIFE::FontBase::isUnderlineStyle ( ) const
virtual

Checks if underline style is used.

Returns
true if underline style is used.

Implements FIFE::IFont.

Definition at line 105 of file fontbase.cpp.

References m_underlineStyle.

Referenced by ~FontBase().

+ 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(), getAsImageMultiline(), and ~FontBase().

+ 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 77 of file fontbase.cpp.

References m_antiAlias.

Referenced by ~FontBase().

+ Here is the caller graph for this function:

void FIFE::FontBase::setBoldStyle ( bool  style)
virtual

Sets the use of bold style.

Parameters
stlyeTrue for use of bold style.

Implements FIFE::IFont.

Reimplemented in FIFE::TrueTypeFont.

Definition at line 85 of file fontbase.cpp.

References m_boldStyle.

Referenced by ~FontBase().

+ Here is the caller graph for this function:

void FIFE::FontBase::setDynamicColoring ( bool  coloring)
virtual

Implements FIFE::IFont.

Definition at line 117 of file fontbase.cpp.

References m_coloring.

Referenced by ~FontBase().

+ Here is the caller graph for this function:

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 69 of file fontbase.cpp.

References mGlyphSpacing.

Referenced by ~FontBase().

+ Here is the caller graph for this function:

void FIFE::FontBase::setItalicStyle ( bool  style)
virtual

Sets the use of italic style.

Parameters
stlyeTrue for use of italic style.

Implements FIFE::IFont.

Reimplemented in FIFE::TrueTypeFont.

Definition at line 93 of file fontbase.cpp.

References m_italicStyle.

Referenced by ~FontBase().

+ Here is the caller graph for this function:

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 61 of file fontbase.cpp.

References mRowSpacing.

Referenced by ~FontBase().

+ Here is the caller graph for this function:

void FIFE::FontBase::setStrikethroughStyle ( bool  style)
virtual

Sets the use of strikethrough style.

Parameters
stlyeTrue for use of strikethrough style.

Implements FIFE::IFont.

Reimplemented in FIFE::TrueTypeFont.

Definition at line 109 of file fontbase.cpp.

References m_strikeStyle.

Referenced by ~FontBase().

+ Here is the caller graph for this function:

void FIFE::FontBase::setUnderlineStyle ( bool  style)
virtual

Sets the use of underline style.

Parameters
stlyeTrue for use of underline style.

Implements FIFE::IFont.

Reimplemented in FIFE::TrueTypeFont.

Definition at line 101 of file fontbase.cpp.

References m_underlineStyle.

Referenced by ~FontBase().

+ Here is the caller graph for this function:

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

Implements FIFE::IFont.

Definition at line 221 of file fontbase.cpp.

References utf8::append(), utf8::distance(), FIFE::IFont::getWidth(), utf8::next(), and utf8::utf8to32().

Referenced by ~FontBase().

+ Here is the caller graph for this function:

Member Data Documentation

bool FIFE::FontBase::m_antiAlias
protected

Definition at line 91 of file fontbase.h.

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

bool FIFE::FontBase::m_boldStyle
protected

Definition at line 92 of file fontbase.h.

Referenced by isBoldStyle(), setBoldStyle(), and FIFE::TrueTypeFont::setBoldStyle().

bool FIFE::FontBase::m_coloring
protected

Definition at line 96 of file fontbase.h.

Referenced by isDynamicColoring(), and setDynamicColoring().

bool FIFE::FontBase::m_italicStyle
protected

Definition at line 93 of file fontbase.h.

Referenced by isItalicStyle(), setItalicStyle(), and FIFE::TrueTypeFont::setItalicStyle().

TextRenderPool FIFE::FontBase::m_pool
protected

Definition at line 84 of file fontbase.h.

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

bool FIFE::FontBase::m_strikeStyle
protected
bool FIFE::FontBase::m_underlineStyle
protected
SDL_Color FIFE::FontBase::mColor
protected
std::string FIFE::FontBase::mFilename
protected

Definition at line 90 of file fontbase.h.

Referenced by FIFE::TrueTypeFont::TrueTypeFont().

int32_t FIFE::FontBase::mGlyphSpacing
protected

Definition at line 87 of file fontbase.h.

Referenced by getGlyphSpacing(), and setGlyphSpacing().

int32_t FIFE::FontBase::mRowSpacing
protected

Definition at line 88 of file fontbase.h.

Referenced by getRowSpacing(), and setRowSpacing().


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