[cairo-commit] rcairo/packages/cairo/ext rb_cairo_context.c, 1.29,
1.30
Kouhei Sutou
commit at pdx.freedesktop.org
Fri Oct 20 07:41:52 PDT 2006
Committed by: kou
Update of /cvs/cairo/rcairo/packages/cairo/ext
In directory kemper:/tmp/cvs-serv1550/packages/cairo/ext
Modified Files:
rb_cairo_context.c
Log Message:
* packages/cairo/ext/rb_cairo_context.c (cr_select_font_face):
made slang and weight arguments of Cairo::Context#select_font_face
optional.
* samples/text2.rb: added --fade-out option.
Index: rb_cairo_context.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_context.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- rb_cairo_context.c 15 Oct 2006 07:12:33 -0000 1.29
+++ rb_cairo_context.c 20 Oct 2006 14:41:49 -0000 1.30
@@ -818,10 +818,25 @@
/* Font/Text functions */
static VALUE
-cr_select_font_face (VALUE self, VALUE family, VALUE slant, VALUE weight)
+cr_select_font_face (int argc, VALUE *argv, VALUE self)
{
- cairo_select_font_face (_SELF, StringValuePtr (family),
- RVAL2CRFONTSLANT (slant), RVAL2CRFONTWEIGHT (weight));
+ VALUE family, rb_slant, rb_weight;
+ cairo_font_slant_t slant;
+ cairo_font_weight_t weight;
+
+ rb_scan_args(argc, argv, "12", &family, &rb_slant, &rb_weight);
+
+ if (NIL_P (rb_slant))
+ slant = CAIRO_FONT_SLANT_NORMAL;
+ else
+ slant = RVAL2CRFONTSLANT (rb_slant);
+
+ if (NIL_P (rb_weight))
+ weight = CAIRO_FONT_WEIGHT_NORMAL;
+ else
+ weight = RVAL2CRFONTWEIGHT (rb_weight);
+
+ cairo_select_font_face (_SELF, StringValueCStr (family), slant, weight);
cr_check_status (_SELF);
return self;
}
@@ -1188,7 +1203,7 @@
/* Font/Text functions */
rb_define_method (rb_cCairo_Context, "select_font_face",
- cr_select_font_face, 3);
+ cr_select_font_face, -1);
rb_define_method (rb_cCairo_Context, "set_font_size", cr_set_font_size, 1);
rb_define_method (rb_cCairo_Context, "set_font_matrix",
cr_set_font_matrix, 1);
More information about the cairo-commit
mailing list