~ubuntu-branches/ubuntu/karmic/libcairo-ruby/karmic

« back to all changes in this revision

Viewing changes to src/rb_cairo_font_extents.c

  • Committer: Bazaar Package Importer
  • Author(s): Paul van Tilburg, Gunnar Wolf, Paul van Tilburg
  • Date: 2009-05-05 12:14:31 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090505121431-n803uyjz51je38l0
Tags: 1.8.0-1
[ Gunnar Wolf ]
* Changed section to Ruby as per ftp-masters' request

[ Paul van Tilburg ]
* New upstream release.
* debian/patches:
  - Dropped patch 01_fix-st.h-ruby1.9-paths: fixed by upstream. 
* debian/control:
  - Bumped standards version to 3.8.1; no changes required.
  - Added ${misc:Depends} to the depends of libcairo-ruby (binary).

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 * Ruby Cairo Binding
4
4
 *
5
5
 * $Author: kou $
6
 
 * $Date: 2007-05-03 02:47:39 $
 
6
 * $Date: 2008-08-17 05:12:37 $
7
7
 *
8
8
 * Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
9
9
 * Copyright 2004-2005 MenTaLguY <mental@rydia.com>
46
46
    }
47
47
}
48
48
 
49
 
static    VALUE
 
49
static VALUE
 
50
cr_font_extents_allocate (VALUE klass)
 
51
{
 
52
  return Data_Wrap_Struct (klass, NULL, -1, NULL);
 
53
}
 
54
 
 
55
static VALUE
 
56
cr_font_extents_initialize (VALUE self)
 
57
{
 
58
  cairo_font_extents_t *extents;
 
59
 
 
60
  extents = ALLOC (cairo_font_extents_t);
 
61
  extents->ascent = 1.0;
 
62
  extents->descent = 0.0;
 
63
  extents->height = 1.0;
 
64
  extents->max_x_advance = 1.0;
 
65
  extents->max_y_advance = 0.0;
 
66
 
 
67
  DATA_PTR (self) = extents;
 
68
 
 
69
  return Qnil;
 
70
}
 
71
 
 
72
static VALUE
50
73
cr_font_extents_ascent (VALUE self)
51
74
{
52
75
  return rb_float_new (_SELF(self)->ascent);
53
76
}
54
77
 
55
 
static    VALUE
 
78
static VALUE
 
79
cr_font_extents_set_ascent (VALUE self, VALUE ascent)
 
80
{
 
81
  _SELF(self)->ascent = NUM2DBL (ascent);
 
82
  return self;
 
83
}
 
84
 
 
85
static VALUE
56
86
cr_font_extents_descent (VALUE self)
57
87
{
58
88
  return rb_float_new (_SELF(self)->descent);
59
89
}
60
90
 
61
 
static    VALUE
 
91
static VALUE
 
92
cr_font_extents_set_descent (VALUE self, VALUE descent)
 
93
{
 
94
  _SELF(self)->descent = NUM2DBL (descent);
 
95
  return self;
 
96
}
 
97
 
 
98
static VALUE
62
99
cr_font_extents_height (VALUE self)
63
100
{
64
101
  return rb_float_new (_SELF(self)->height);
65
102
}
66
103
 
67
 
static    VALUE
 
104
static VALUE
 
105
cr_font_extents_set_height (VALUE self, VALUE height)
 
106
{
 
107
  _SELF(self)->height = NUM2DBL (height);
 
108
  return self;
 
109
}
 
110
 
 
111
static VALUE
68
112
cr_font_extents_max_x_advance (VALUE self)
69
113
{
70
114
  return rb_float_new (_SELF(self)->max_x_advance);
71
115
}
72
116
 
73
 
static    VALUE
 
117
static VALUE
 
118
cr_font_extents_set_max_x_advance (VALUE self, VALUE max_x_advance)
 
119
{
 
120
  _SELF(self)->max_x_advance = NUM2DBL (max_x_advance);
 
121
  return self;
 
122
}
 
123
 
 
124
static VALUE
74
125
cr_font_extents_max_y_advance (VALUE self)
75
126
{
76
127
  return rb_float_new (_SELF(self)->max_y_advance);
77
128
}
78
129
 
79
130
static VALUE
 
131
cr_font_extents_set_max_y_advance (VALUE self, VALUE max_y_advance)
 
132
{
 
133
  _SELF(self)->max_y_advance = NUM2DBL (max_y_advance);
 
134
  return self;
 
135
}
 
136
 
 
137
static VALUE
80
138
cr_font_extents_to_s (VALUE self)
81
139
{
82
140
  VALUE ret;
110
168
  rb_cCairo_FontExtents =
111
169
    rb_define_class_under (rb_mCairo, "FontExtents", rb_cObject);
112
170
 
 
171
  rb_define_alloc_func (rb_cCairo_FontExtents, cr_font_extents_allocate);
 
172
 
 
173
  rb_define_method (rb_cCairo_FontExtents, "initialize",
 
174
                    cr_font_extents_initialize, 0);
 
175
 
113
176
  rb_define_method (rb_cCairo_FontExtents, "ascent",
114
177
                    cr_font_extents_ascent, 0);
 
178
  rb_define_method (rb_cCairo_FontExtents, "set_ascent",
 
179
                    cr_font_extents_set_ascent, 1);
115
180
  rb_define_method (rb_cCairo_FontExtents, "descent",
116
181
                    cr_font_extents_descent, 0);
 
182
  rb_define_method (rb_cCairo_FontExtents, "set_descent",
 
183
                    cr_font_extents_set_descent, 1);
117
184
  rb_define_method (rb_cCairo_FontExtents, "height",
118
185
                    cr_font_extents_height, 0);
 
186
  rb_define_method (rb_cCairo_FontExtents, "set_height",
 
187
                    cr_font_extents_set_height, 1);
119
188
  rb_define_method (rb_cCairo_FontExtents, "max_x_advance",
120
189
                    cr_font_extents_max_x_advance, 0);
 
190
  rb_define_method (rb_cCairo_FontExtents, "set_max_x_advance",
 
191
                    cr_font_extents_set_max_x_advance, 1);
121
192
  rb_define_method (rb_cCairo_FontExtents, "max_y_advance",
122
193
                    cr_font_extents_max_y_advance, 0);
 
194
  rb_define_method (rb_cCairo_FontExtents, "set_max_y_advance",
 
195
                    cr_font_extents_set_max_y_advance, 1);
123
196
 
124
197
  rb_define_method (rb_cCairo_FontExtents, "to_s", cr_font_extents_to_s, 0);
 
198
 
 
199
  RB_CAIRO_DEF_SETTERS (rb_cCairo_FontExtents);
125
200
}