47 mFont = TTF_OpenFont(filename.c_str(), size);
50 throw FIFE::CannotOpenFile(filename +
" (" + TTF_GetError() +
")");
62 TTF_SizeUTF8(
mFont, text.c_str(), &w, &h);
72 SDL_Surface *surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
75 SDL_FillRect(surface,0,0x00000000);
79 SDL_Surface* renderedText = 0;
81 renderedText = TTF_RenderUTF8_Blended(
mFont, text.c_str(),
mColor);
83 renderedText = TTF_RenderUTF8_Solid(
mFont, text.c_str(),
mColor);
88 renderedText = TTF_RenderUTF8_Blended(
mFont, text.c_str(),
mColor);
91 if (renderedText == 0) {
92 throw FIFE::SDLException(TTF_GetError());
virtual SDL_Surface * renderString(const std::string &text)
virtual void setColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a=255)
TrueTypeFont(const std::string &filename, int32_t size)
Constructor.
Abstract Font Base Class Uses a pool for rendered strings.
virtual ~TrueTypeFont()
Destructor.
bool is_valid(octet_iterator start, octet_iterator end)
int32_t getRowSpacing() const
Gets the spacing between rows in pixels.
virtual int32_t getHeight() const
gets height of this font
virtual int32_t getWidth(const std::string &text) const
gets width of given text