48 mFont = TTF_OpenFont(filename.c_str(), size);
51 throw FIFE::CannotOpenFile(filename +
" (" + TTF_GetError() +
")");
72 TTF_SizeUTF8(
mFont, text.c_str(), &w, &h);
129 SDL_Surface *surface = SDL_CreateRGBSurface(0,
132 SDL_FillRect(surface,0,0x00000000);
136 SDL_Surface* renderedText = 0;
138 renderedText = TTF_RenderUTF8_Blended(
mFont, text.c_str(),
mColor);
140 renderedText = TTF_RenderUTF8_Solid(
mFont, text.c_str(),
mColor);
145 renderedText = TTF_RenderUTF8_Blended(
mFont, text.c_str(),
mColor);
148 if (renderedText == 0) {
149 throw FIFE::SDLException(TTF_GetError());
virtual void setItalicStyle(bool style)
Sets the use of italic style.
virtual SDL_Surface * renderString(const std::string &text)
virtual void setStrikethroughStyle(bool style)
Sets the use of strikethrough style.
virtual int32_t getHeight() const
gets height of this font
virtual int32_t getWidth(const std::string &text) const
gets width of given text
virtual int32_t getFontStyleMask() const
TrueTypeFont(const std::string &filename, int32_t size)
Constructor.
Abstract Font Base Class Uses a pool for rendered strings.
virtual ~TrueTypeFont()
Destructor.
virtual void setBoldStyle(bool style)
Sets the use of bold style.
bool is_valid(octet_iterator start, octet_iterator end)
virtual void setUnderlineStyle(bool style)
Sets the use of underline style.
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.
int32_t getRowSpacing() const
Gets the spacing between rows in pixels.