FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
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 void | setBoldStyle (bool style) |
Sets the use of bold style. More... | |
virtual void | setItalicStyle (bool style) |
Sets the use of italic style. More... | |
virtual void | setUnderlineStyle (bool style) |
Sets the use of underline style. More... | |
virtual void | setStrikethroughStyle (bool style) |
Sets the use of strikethrough style. More... | |
virtual int32_t | getFontStyleMask () const |
virtual SDL_Surface * | renderString (const std::string &text) |
virtual void | setColor (uint8_t r, uint8_t g, uint8_t b, uint8_t a=255) |
Set the color the text should be rendered in. More... | |
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... | |
virtual void | setAntiAlias (bool antiAlias) |
Sets the use of anti aliasing. More... | |
virtual bool | isAntiAlias () const |
Checks if anti aliasing is used. More... | |
virtual bool | isBoldStyle () const |
Checks if bold style is used. More... | |
virtual bool | isItalicStyle () const |
Checks if italic style is used. More... | |
virtual bool | isUnderlineStyle () const |
Checks if underline style is used. 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 |
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... | |
Public Member Functions inherited from FIFE::IFont | |
virtual | ~IFont () |
Protected Attributes | |
TTF_Font * | mFont |
int32_t | mFontStyle |
Protected Attributes inherited from FIFE::FontBase | |
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 |
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, FIFE::FontBase::mFilename, mFont, and mFontStyle.
|
virtual |
|
virtual |
Definition at line 123 of file truetypefont.cpp.
References mFontStyle.
|
virtual |
gets height of this font
Implements FIFE::IFont.
Definition at line 76 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 69 of file truetypefont.cpp.
References utf8::is_valid(), and mFont.
|
virtual |
Implements FIFE::FontBase.
Definition at line 127 of file truetypefont.cpp.
References FIFE::AMASK, FIFE::BMASK, getHeight(), FIFE::GMASK, FIFE::FontBase::m_antiAlias, FIFE::FontBase::mColor, mFont, and FIFE::RMASK.
|
virtual |
Sets the use of bold style.
stlye | True for use of bold style. |
Reimplemented from FIFE::FontBase.
Definition at line 80 of file truetypefont.cpp.
References FIFE::FontBase::m_boldStyle, mFont, and mFontStyle.
|
virtual |
Set the color the text should be rendered in.
Implements FIFE::IFont.
Definition at line 154 of file truetypefont.cpp.
References FIFE::FontBase::mColor.
|
virtual |
Sets the use of italic style.
stlye | True for use of italic style. |
Reimplemented from FIFE::FontBase.
Definition at line 92 of file truetypefont.cpp.
References FIFE::FontBase::m_italicStyle, mFont, and mFontStyle.
|
virtual |
Sets the use of strikethrough style.
stlye | True for use of strikethrough style. |
Reimplemented from FIFE::FontBase.
Definition at line 116 of file truetypefont.cpp.
References FIFE::FontBase::m_strikeStyle.
|
virtual |
Sets the use of underline style.
stlye | True for use of underline style. |
Reimplemented from FIFE::FontBase.
Definition at line 104 of file truetypefont.cpp.
References FIFE::FontBase::m_underlineStyle, mFont, and mFontStyle.
|
protected |
Definition at line 84 of file truetypefont.h.
Referenced by getHeight(), getWidth(), renderString(), setBoldStyle(), setItalicStyle(), setUnderlineStyle(), TrueTypeFont(), and ~TrueTypeFont().
|
protected |
Definition at line 86 of file truetypefont.h.
Referenced by getFontStyleMask(), setBoldStyle(), setItalicStyle(), setUnderlineStyle(), and TrueTypeFont().