class Cairo::FontExtents - cairo-1.14.1 Documentation

# class Cairo::FontExtents

### Public Class Methods

new() click to toggle source

    static VALUE
    cr_font_extents_initialize (VALUE self)
    {
      cairo_font_extents_t *extents;

      extents = ALLOC (cairo_font_extents_t);
      extents->ascent = 1.0;
      extents->descent = 0.0;
      extents->height = 1.0;
      extents->max_x_advance = 1.0;
      extents->max_y_advance = 0.0;

      DATA_PTR (self) = extents;

      return Qnil;
    }

### Public Instance Methods

ascent() click to toggle source

    static VALUE
    cr_font_extents_ascent (VALUE self)
    {
      return rb_float_new (_SELF(self)->ascent);
    }

descent() click to toggle source

    static VALUE
    cr_font_extents_descent (VALUE self)
    {
      return rb_float_new (_SELF(self)->descent);
    }

height() click to toggle source

    static VALUE
    cr_font_extents_height (VALUE self)
    {
      return rb_float_new (_SELF(self)->height);
    }

max_x_advance() click to toggle source

    static VALUE
    cr_font_extents_max_x_advance (VALUE self)
    {
      return rb_float_new (_SELF(self)->max_x_advance);
    }

max_y_advance() click to toggle source

    static VALUE
    cr_font_extents_max_y_advance (VALUE self)
    {
      return rb_float_new (_SELF(self)->max_y_advance);
    }

set_ascent(p1) click to toggle source

    static VALUE
    cr_font_extents_set_ascent (VALUE self, VALUE ascent)
    {
      _SELF(self)->ascent = NUM2DBL (ascent);
      return self;
    }

set_descent(p1) click to toggle source

    static VALUE
    cr_font_extents_set_descent (VALUE self, VALUE descent)
    {
      _SELF(self)->descent = NUM2DBL (descent);
      return self;
    }

set_height(p1) click to toggle source

    static VALUE
    cr_font_extents_set_height (VALUE self, VALUE height)
    {
      _SELF(self)->height = NUM2DBL (height);
      return self;
    }

set_max_x_advance(p1) click to toggle source

    static VALUE
    cr_font_extents_set_max_x_advance (VALUE self, VALUE max_x_advance)
    {
      _SELF(self)->max_x_advance = NUM2DBL (max_x_advance);
      return self;
    }

set_max_y_advance(p1) click to toggle source

    static VALUE
    cr_font_extents_set_max_y_advance (VALUE self, VALUE max_y_advance)
    {
      _SELF(self)->max_y_advance = NUM2DBL (max_y_advance);
      return self;
    }

to_s() click to toggle source

    static VALUE
    cr_font_extents_to_s (VALUE self)
    {
      VALUE ret;

      ret = rb_str_new2 ("#<");
      rb_str_cat2 (ret, rb_class2name (CLASS_OF (self)));
      rb_str_cat2 (ret, ": ");
      rb_str_cat2 (ret, "ascent=");
      rb_str_concat (ret, rb_inspect (cr_font_extents_ascent (self)));
      rb_str_cat2 (ret, ", ");
      rb_str_cat2 (ret, "descent=");
      rb_str_concat (ret, rb_inspect (cr_font_extents_descent (self)));
      rb_str_cat2 (ret, ", ");
      rb_str_cat2 (ret, "height=");
      rb_str_concat (ret, rb_inspect (cr_font_extents_height (self)));
      rb_str_cat2 (ret, ", ");
      rb_str_cat2 (ret, "max_x_advance=");
      rb_str_concat (ret, rb_inspect (cr_font_extents_max_x_advance (self)));
      rb_str_cat2 (ret, ", ");
      rb_str_cat2 (ret, "max_y_advance=");
      rb_str_concat (ret, rb_inspect (cr_font_extents_max_y_advance (self)));
      rb_str_cat2 (ret, ">");

      return ret;
    }