Class: Cairo::FontExtents

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

Instance Method Summary collapse

Constructor Details

#initializeObject



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'ext/cairo/rb_cairo_font_extents.c', line 72

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;

  RTYPEDDATA_DATA (self) = extents;

  return Qnil;
}

Instance Method Details

#ascentObject



89
90
91
92
93
# File 'ext/cairo/rb_cairo_font_extents.c', line 89

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

#descentObject



102
103
104
105
106
# File 'ext/cairo/rb_cairo_font_extents.c', line 102

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

#heightObject



115
116
117
118
119
# File 'ext/cairo/rb_cairo_font_extents.c', line 115

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

#max_x_advanceObject



128
129
130
131
132
# File 'ext/cairo/rb_cairo_font_extents.c', line 128

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

#max_y_advanceObject



141
142
143
144
145
# File 'ext/cairo/rb_cairo_font_extents.c', line 141

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

#set_ascentObject



95
96
97
98
99
100
# File 'ext/cairo/rb_cairo_font_extents.c', line 95

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

#set_descentObject



108
109
110
111
112
113
# File 'ext/cairo/rb_cairo_font_extents.c', line 108

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

#set_heightObject



121
122
123
124
125
126
# File 'ext/cairo/rb_cairo_font_extents.c', line 121

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

#set_max_x_advanceObject



134
135
136
137
138
139
# File 'ext/cairo/rb_cairo_font_extents.c', line 134

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



147
148
149
150
151
152
# File 'ext/cairo/rb_cairo_font_extents.c', line 147

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



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'ext/cairo/rb_cairo_font_extents.c', line 154

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