/*
* call-seq:
* new( file, size ) -> TTF
*
* Create a new TTF object, which can render text to a Surface with a
* particular font style and size.
*
* This function takes these arguments:
* file:: filename of the TrueType font to use. Should be a +TTF+ or
* +FON+ file.
* size:: point size (based on 72DPI). Or, the height in pixels from the
* bottom of the descent to the top of the ascent.
*/
VALUE rbgm_ttf_new(int argc, VALUE *argv, VALUE class)
{
VALUE self;
TTF_Font *font;
if(!TTF_WasInit())
rb_raise(eSDLError,"Font module must be initialized before making new font.");
font = TTF_OpenFont(StringValuePtr(argv[0]), NUM2INT(argv[1]));
if(font == NULL)
rb_raise(eSDLError,"could not load font: %s",TTF_GetError());
self = Data_Wrap_Struct(cTTF,0,TTF_CloseFont,font);
rb_obj_call_init(self,argc,argv);
return self;
}