game/sdlpp/sdlpp_font.cpp

34 lines
841 B
C++

#include "sdlpp_font.hpp"
namespace SDLPP {
Font::Font( const std::string &font, int size ) {
font_ptr = TTF_OpenFont( font.c_str(), size );
if ( font_ptr == NULL ) {
std::cerr << "Unable to load font '" << font
<< "': TTF Error: " << TTF_GetError() << std::endl;
throw "TTF_OpenFont error";
}
}
Font::~Font() {
TTF_CloseFont( font_ptr );
}
const TTF_Font *Font::getFont() const {
return font_ptr;
}
TTF_Font *Font::getFont() {
return font_ptr;
}
void Font::setOutline( int size ) {
TTF_SetFontOutline( font_ptr, size );
}
int Font::getOutline() {
return TTF_GetFontOutline( font_ptr );
}
void Font::setStyle( int style ) {
TTF_SetFontStyle( font_ptr, style );
}
void Font::setHinting( int hinting ) {
TTF_SetFontHinting( font_ptr, hinting );
}
} // namespace SDLPP