FIFE
|
SDL True Type Font implementation of Font. More...
#include <truetypefont.h>
Public Member Functions | |
TrueTypeFont (const std::string &filename, int32_t size) | |
Constructor. More... | |
virtual | ~TrueTypeFont () |
Destructor. More... | |
virtual int32_t | getWidth (const std::string &text) const |
gets width of given text More... | |
virtual int32_t | getHeight () const |
gets height of this font More... | |
virtual SDL_Surface * | renderString (const std::string &text) |
virtual void | setColor (Uint8 r, Uint8 g, Uint8 b, Uint8 a=255) |
![]() | |
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 |
Image * | getAsImage (const std::string &text) |
Gets given text as Image The rsulting image is pooled, so it's not that time critical. More... | |
Image * | getAsImageMultiline (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 | ~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 Attributes | |
TTF_Font * | mFont |
int32_t | mHeight |
int32_t | mGlyphSpacing |
int32_t | mRowSpacing |
std::string | mFilename |
bool | mAntiAlias |
![]() | |
TextRenderPool | m_pool |
SDL_Color | mColor |
int32_t | mGlyphSpacing |
int32_t | mRowSpacing |
std::string | mFilename |
bool | m_antiAlias |
SDL True Type Font implementation of Font.
It uses the SDL_ttf library to display True Type Fonts with SDL.
NOTE: You must initialize the SDL_ttf library before using this class. Also, remember to call the SDL_ttf libraries quit function.
Original author of this class is Walluce Pinkham. Some modifications made by the Guichan team, and additonal modifications by the FIFE team.
Definition at line 51 of file truetypefont.h.
FIFE::TrueTypeFont::TrueTypeFont | ( | const std::string & | filename, |
int32_t | size | ||
) |
Constructor.
filename | the filename of the True Type Font. |
size | the size the font should be in. |
Definition at line 42 of file truetypefont.cpp.
References FIFE::FontBase::mColor, mFilename, and mFont.
|
virtual |
|
virtual |
gets height of this font
Implements FIFE::IFont.
Definition at line 66 of file truetypefont.cpp.
References FIFE::FontBase::getRowSpacing(), and mFont.
Referenced by renderString().
|
virtual |
gets width of given text
Implements FIFE::IFont.
Definition at line 59 of file truetypefont.cpp.
References utf8::is_valid(), and mFont.
|
virtual |
Implements FIFE::FontBase.
Definition at line 70 of file truetypefont.cpp.
References FIFE::AMASK, FIFE::BMASK, getHeight(), FIFE::GMASK, FIFE::FontBase::m_antiAlias, FIFE::FontBase::mColor, mFont, and FIFE::RMASK.
|
virtual |
Definition at line 97 of file truetypefont.cpp.
References FIFE::FontBase::mColor.
|
protected |
Definition at line 86 of file truetypefont.h.
|
protected |
Definition at line 85 of file truetypefont.h.
Referenced by TrueTypeFont().
|
protected |
Definition at line 79 of file truetypefont.h.
Referenced by getHeight(), getWidth(), renderString(), TrueTypeFont(), and ~TrueTypeFont().
|
protected |
Definition at line 82 of file truetypefont.h.
|
protected |
Definition at line 81 of file truetypefont.h.
|
protected |
Definition at line 83 of file truetypefont.h.