Class: Cairo::TextExtents

Inherits:
Object
  • Object
show all
Defined in:
ext/cairo/rb_cairo_text_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
71
# File 'ext/cairo/rb_cairo_text_extents.c', line 55

static VALUE
cr_text_extents_initialize (VALUE self)
{
  cairo_text_extents_t *extents;

  extents = ALLOC (cairo_text_extents_t);
  extents->x_bearing = 0.0;
  extents->y_bearing = -1.0;
  extents->width = 0.0;
  extents->height = 1.0;
  extents->x_advance = 1.0;
  extents->y_advance = 0.0;

  DATA_PTR (self) = extents;

  return Qnil;
}

Instance Method Details

#heightObject



112
113
114
115
116
# File 'ext/cairo/rb_cairo_text_extents.c', line 112

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

#set_heightObject



118
119
120
121
122
123
# File 'ext/cairo/rb_cairo_text_extents.c', line 118

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

#set_widthObject



105
106
107
108
109
110
# File 'ext/cairo/rb_cairo_text_extents.c', line 105

static VALUE
cr_text_extents_set_width (VALUE self, VALUE width)
{
  _SELF(self)->width = NUM2DBL (width);
  return Qnil;
}

#set_x_advanceObject



131
132
133
134
135
136
# File 'ext/cairo/rb_cairo_text_extents.c', line 131

static VALUE
cr_text_extents_set_x_advance (VALUE self, VALUE x_advance)
{
  _SELF(self)->x_advance = NUM2DBL (x_advance);
  return Qnil;
}

#set_x_bearingObject



79
80
81
82
83
84
# File 'ext/cairo/rb_cairo_text_extents.c', line 79

static VALUE
cr_text_extents_set_x_bearing (VALUE self, VALUE x_bearing)
{
  _SELF(self)->x_bearing = NUM2DBL (x_bearing);
  return Qnil;
}

#set_y_advanceObject



144
145
146
147
148
149
# File 'ext/cairo/rb_cairo_text_extents.c', line 144

static VALUE
cr_text_extents_set_y_advance (VALUE self, VALUE y_advance)
{
  _SELF(self)->y_advance = NUM2DBL (y_advance);
  return Qnil;
}

#set_y_bearingObject



92
93
94
95
96
97
# File 'ext/cairo/rb_cairo_text_extents.c', line 92

static VALUE
cr_text_extents_set_y_bearing (VALUE self, VALUE y_bearing)
{
  _SELF(self)->y_bearing = NUM2DBL (y_bearing);
  return Qnil;
}

#to_sObject



151
152
153
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_text_extents.c', line 151

static VALUE
cr_text_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, "x_bearing=");
  rb_str_concat (ret, rb_inspect (cr_text_extents_x_bearing (self)));
  rb_str_cat2 (ret, ", ");
  rb_str_cat2 (ret, "y_bearing=");
  rb_str_concat (ret, rb_inspect (cr_text_extents_y_bearing (self)));
  rb_str_cat2 (ret, ", ");
  rb_str_cat2 (ret, "width=");
  rb_str_concat (ret, rb_inspect (cr_text_extents_width (self)));
  rb_str_cat2 (ret, ", ");
  rb_str_cat2 (ret, "height=");
  rb_str_concat (ret, rb_inspect (cr_text_extents_height (self)));
  rb_str_cat2 (ret, ", ");
  rb_str_cat2 (ret, "x_advance=");
  rb_str_concat (ret, rb_inspect (cr_text_extents_x_advance (self)));
  rb_str_cat2 (ret, ", ");
  rb_str_cat2 (ret, "y_advance=");
  rb_str_concat (ret, rb_inspect (cr_text_extents_y_advance (self)));
  rb_str_cat2 (ret, ">");

  return ret;
}

#widthObject



99
100
101
102
103
# File 'ext/cairo/rb_cairo_text_extents.c', line 99

static VALUE
cr_text_extents_width (VALUE self)
{
  return rb_float_new (_SELF(self)->width);
}

#x_advanceObject



125
126
127
128
129
# File 'ext/cairo/rb_cairo_text_extents.c', line 125

static VALUE
cr_text_extents_x_advance (VALUE self)
{
  return rb_float_new (_SELF(self)->x_advance);
}

#x_bearingObject



73
74
75
76
77
# File 'ext/cairo/rb_cairo_text_extents.c', line 73

static VALUE
cr_text_extents_x_bearing (VALUE self)
{
  return rb_float_new (_SELF(self)->x_bearing);
}

#y_advanceObject



138
139
140
141
142
# File 'ext/cairo/rb_cairo_text_extents.c', line 138

static VALUE
cr_text_extents_y_advance (VALUE self)
{
  return rb_float_new (_SELF(self)->y_advance);
}

#y_bearingObject



86
87
88
89
90
# File 'ext/cairo/rb_cairo_text_extents.c', line 86

static VALUE
cr_text_extents_y_bearing (VALUE self)
{
  return rb_float_new (_SELF(self)->y_bearing);
}