From 1503f016b8d04b374c0e2290d37a4f2f91e63688 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Tue, 5 Jan 2010 18:34:54 -0800 Subject: [PATCH] added font->ascent/font->descent to ruby interface --- lib/ruby/gfx.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/ruby/gfx.c b/lib/ruby/gfx.c index 687e38a..11addd2 100644 --- a/lib/ruby/gfx.c +++ b/lib/ruby/gfx.c @@ -310,6 +310,18 @@ static VALUE font_allocate(VALUE cls) return v; } +static VALUE font_ascent(VALUE cls) +{ + Get_Font(font,cls); + return rb_float_new(font->font->ascent); +} + +static VALUE font_descent(VALUE cls) +{ + Get_Font(font,cls); + return rb_float_new(font->font->descent); +} + static VALUE font_name(VALUE cls) { Get_Font(font,cls); @@ -637,6 +649,8 @@ void Init_gfx() Font = rb_define_class_under(GFX, "Font", rb_cObject); rb_define_method(Font, "name", font_name, 0); + rb_define_method(Font, "ascent", font_ascent, 0); + rb_define_method(Font, "descent", font_descent, 0); rb_define_method(Font, "glyphs", font_glyphs, 0); Device = rb_define_class_under(GFX, "Device", rb_cObject); -- 1.7.10.4