/* * 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). (That means the height in pixels from * the bottom of the descent to the top of the ascent.) */ VALUE rbgm_ttf_new(VALUE class, VALUE vfile, VALUE vsize) { VALUE self; TTF_Font *font; if(!TTF_WasInit()) rb_raise(eSDLError,"Font module must be initialized before making new font."); font = TTF_OpenFont(StringValuePtr(vfile), NUM2INT(vsize)); if(font == NULL) rb_raise(eSDLError,"could not load font: %s",TTF_GetError()); self = Data_Wrap_Struct(cTTF,0,TTF_CloseFont,font); return self; }