git.asbjorn.biz
/
swftools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1503f01
)
added .bbox method to glyph in ruby interface
author
Matthias Kramm
<kramm@quiss.org>
Wed, 6 Jan 2010 20:36:53 +0000
(12:36 -0800)
committer
Matthias Kramm
<kramm@quiss.org>
Wed, 6 Jan 2010 20:36:53 +0000
(12:36 -0800)
lib/ruby/gfx.c
patch
|
blob
|
history
diff --git
a/lib/ruby/gfx.c
b/lib/ruby/gfx.c
index
11addd2
..
661d8ef
100644
(file)
--- a/
lib/ruby/gfx.c
+++ b/
lib/ruby/gfx.c
@@
-281,6
+281,16
@@
static VALUE glyph_advance(VALUE cls)
return rb_float_new(glyph->font->font->glyphs[glyph->nr].advance);
}
return rb_float_new(glyph->font->font->glyphs[glyph->nr].advance);
}
+static VALUE glyph_bbox(VALUE cls)
+{
+ Get_Glyph(glyph,cls);
+ gfxbbox_t bbox = gfxline_getbbox(glyph->font->font->glyphs[glyph->nr].line);
+ return rb_ary_new3(4, rb_float_new(bbox.xmin),
+ rb_float_new(bbox.ymin),
+ rb_float_new(bbox.xmax),
+ rb_float_new(bbox.ymax));
+}
+
static VALUE glyph_unicode(VALUE cls)
{
Get_Glyph(glyph,cls);
static VALUE glyph_unicode(VALUE cls)
{
Get_Glyph(glyph,cls);
@@
-646,6
+656,7
@@
void Init_gfx()
rb_define_method(Glyph, "polygon", glyph_polygon, 0);
rb_define_method(Glyph, "unicode", glyph_unicode, 0);
rb_define_method(Glyph, "advance", glyph_advance, 0);
rb_define_method(Glyph, "polygon", glyph_polygon, 0);
rb_define_method(Glyph, "unicode", glyph_unicode, 0);
rb_define_method(Glyph, "advance", glyph_advance, 0);
+ rb_define_method(Glyph, "bbox", glyph_bbox, 0);
Font = rb_define_class_under(GFX, "Font", rb_cObject);
rb_define_method(Font, "name", font_name, 0);
Font = rb_define_class_under(GFX, "Font", rb_cObject);
rb_define_method(Font, "name", font_name, 0);