Class: Cairo::FontExtents

Inherits:
Object
  • Object
show all
Defined in:
ext/cairo/rb_cairo_font_extents.c

Instance Method Summary collapse

Constructor Details

#initializeObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'ext/cairo/rb_cairo_font_extents.c', line 55

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;
}

Instance Method Details

#ascentObject



72
73
74
75
76
# File 'ext/cairo/rb_cairo_font_extents.c', line 72

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

#descentObject



85
86
87
88
89
# File 'ext/cairo/rb_cairo_font_extents.c', line 85

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

#heightObject



98
99
100
101
102
# File 'ext/cairo/rb_cairo_font_extents.c', line 98

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

#max_x_advanceObject



111
112
113
114
115
# File 'ext/cairo/rb_cairo_font_extents.c', line 111

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

#max_y_advanceObject



124
125
126
127
128
# File 'ext/cairo/rb_cairo_font_extents.c', line 124

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

#set_ascentObject



78
79
80
81
82
83
# File 'ext/cairo/rb_cairo_font_extents.c', line 78

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

#set_descentObject



91
92
93
94
95
96
# File 'ext/cairo/rb_cairo_font_extents.c', line 91

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

#set_heightObject



104
105
106
107
108
109
# File 'ext/cairo/rb_cairo_font_extents.c', line 104

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

#set_max_x_advanceObject



117
118
119
120
121
122
# File 'ext/cairo/rb_cairo_font_extents.c', line 117

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_advanceObject



130
131
132
133
134
135
# File 'ext/cairo/rb_cairo_font_extents.c', line 130

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_sObject



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'ext/cairo/rb_cairo_font_extents.c', line 137

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;
}