/* * call-seq: * size_text(text) -> [ width, height ] * * The width and height the text would be if * it were rendered, without the overhead of * actually rendering it. */ VALUE rbgm_ttf_sizetext(VALUE self, VALUE string) { TTF_Font *font; int w; int h; VALUE result; Data_Get_Struct(self, TTF_Font,font); result = rb_ary_new(); TTF_SizeText(font,StringValuePtr(string),&w,&h); rb_ary_push(result, INT2NUM(w)); rb_ary_push(result, INT2NUM(h)); return result; }