277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
|
# File 'ext/cairo/rb_cairo_font_face.c', line 277
static VALUE
cr_toy_font_face_initialize (int argc, VALUE *argv, VALUE self)
{
cairo_font_face_t *face;
VALUE rb_family, rb_slant, rb_weight;
const char *family;
cairo_font_slant_t slant;
cairo_font_weight_t weight;
rb_scan_args (argc, argv, "03", &rb_family, &rb_slant, &rb_weight);
if (NIL_P (rb_family))
{
family = "";
}
else if (rb_cairo__is_kind_of (rb_family, rb_cString))
{
family = RSTRING_PTR (rb_family);
}
else if (rb_cairo__is_kind_of (rb_family, rb_cSymbol))
{
family = rb_id2name (SYM2ID (rb_family));
}
else
{
rb_raise (rb_eArgError,
"family name should be nil, String or Symbol: %s",
rb_cairo__inspect (rb_family));
}
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);
face = cairo_toy_font_face_create (family, slant, weight);
cr_font_face_check_status (face);
DATA_PTR (self) = face;
return Qnil;
}
|