pango 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/ext/pango/extconf.rb +3 -0
  2. data/ext/pango/rbpango.c +312 -12
  3. data/ext/pango/rbpango.h +33 -22
  4. data/ext/pango/rbpangoanalysis.c +98 -58
  5. data/ext/pango/rbpangoattribute.c +94 -85
  6. data/ext/pango/rbpangoattriterator.c +39 -28
  7. data/ext/pango/rbpangoattrlist.c +42 -32
  8. data/ext/pango/rbpangocairo.c +38 -172
  9. data/ext/pango/rbpangocairocontext.c +151 -0
  10. data/ext/pango/rbpangocolor.c +49 -38
  11. data/ext/pango/rbpangocontext.c +109 -102
  12. data/ext/pango/rbpangoconversions.h +111 -0
  13. data/ext/pango/rbpangocoverage.c +45 -37
  14. data/ext/pango/rbpangoengine.c +22 -12
  15. data/ext/pango/rbpangofont.c +52 -43
  16. data/ext/pango/rbpangofontdescription.c +102 -91
  17. data/ext/pango/rbpangofontface.c +32 -21
  18. data/ext/pango/rbpangofontfamily.c +31 -20
  19. data/ext/pango/rbpangofontmap.c +44 -36
  20. data/ext/pango/rbpangofontmetrics.c +41 -30
  21. data/ext/pango/rbpangofontset.c +32 -21
  22. data/ext/pango/rbpangofontsetsimple.c +34 -24
  23. data/ext/pango/rbpangoglyphinfo.c +48 -35
  24. data/ext/pango/rbpangoglyphitem.c +43 -33
  25. data/ext/pango/rbpangoglyphstring.c +59 -59
  26. data/ext/pango/rbpangogravity.c +34 -23
  27. data/ext/pango/rbpangoitem.c +43 -34
  28. data/ext/pango/rbpangolanguage.c +44 -34
  29. data/ext/pango/rbpangolayout.c +167 -160
  30. data/ext/pango/rbpangolayoutiter.c +70 -59
  31. data/ext/pango/rbpangolayoutline.c +106 -71
  32. data/ext/pango/rbpangologattr.c +42 -31
  33. data/ext/pango/rbpangomatrix.c +47 -35
  34. data/ext/pango/rbpangoprivate.h +53 -0
  35. data/ext/pango/rbpangorectangle.c +58 -49
  36. data/ext/pango/rbpangorenderer.c +81 -70
  37. data/ext/pango/rbpangoscript.c +37 -27
  38. data/ext/pango/rbpangoscriptiter.c +32 -22
  39. data/ext/pango/rbpangotabarray.c +48 -37
  40. metadata +12 -12
  41. data/ChangeLog +0 -721
  42. data/ext/pango/rbpangoinits.c +0 -72
  43. data/ext/pango/rbpangomain.c +0 -202
@@ -1,17 +1,28 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2003 Masao Mutoh
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
3
21
 
4
- rbpangologattr.c -
22
+ #include "rbpangoprivate.h"
5
23
 
6
- $Author: ggc $
7
- $Date: 2007/07/13 16:07:33 $
8
-
9
- Copyright (C) 2003 Masao Mutoh
10
- ************************************************/
11
-
12
- #include "rbpango.h"
13
-
14
- #define _SELF(s) ((PangoLogAttr*)RVAL2BOXED(s, PANGO_TYPE_LOG_ATTR))
24
+ #define RG_TARGET_NAMESPACE cLogAttr
25
+ #define _SELF(s) (RVAL2PANGOLOGATTR(s))
15
26
 
16
27
  /**********************************/
17
28
  static PangoLogAttr*
@@ -23,12 +34,12 @@ log_copy(const PangoLogAttr* val)
23
34
  *new_val = *val;
24
35
  return new_val;
25
36
  }
26
-
37
+
27
38
  GType
28
39
  pango_log_attr_get_type(void)
29
40
  {
30
41
  static GType our_type = 0;
31
-
42
+
32
43
  if (our_type == 0)
33
44
  our_type = g_boxed_type_register_static ("PangoLogAttr",
34
45
  (GBoxedCopyFunc)log_copy,
@@ -51,7 +62,7 @@ log_set_ ## name (VALUE self, VALUE val)\
51
62
  }
52
63
 
53
64
  static VALUE
54
- log_initialize(VALUE self)
65
+ rg_initialize(VALUE self)
55
66
  {
56
67
  PangoLogAttr log;
57
68
  G_INITIALIZE(self, &log);
@@ -78,27 +89,27 @@ ATTR_BOOL(backspace_deletes_character);
78
89
  #endif
79
90
 
80
91
  void
81
- Init_pango_logattr()
92
+ Init_pango_logattr(VALUE mPango)
82
93
  {
83
- VALUE logattr = G_DEF_CLASS(PANGO_TYPE_LOG_ATTR, "LogAttr", mPango);
84
-
85
- rb_define_method(logattr, "initialize", log_initialize, 0);
94
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_LOG_ATTR, "LogAttr", mPango);
95
+
96
+ RG_DEF_METHOD(initialize, 0);
86
97
 
87
- DEFINE_ACCESSOR(logattr, line_break);
88
- DEFINE_ACCESSOR(logattr, mandatory_break);
89
- DEFINE_ACCESSOR(logattr, char_break);
90
- DEFINE_ACCESSOR(logattr, white);
91
- DEFINE_ACCESSOR(logattr, cursor_position);
92
- DEFINE_ACCESSOR(logattr, word_start);
93
- DEFINE_ACCESSOR(logattr, word_end);
94
- DEFINE_ACCESSOR(logattr, sentence_boundary);
95
- DEFINE_ACCESSOR(logattr, sentence_start);
96
- DEFINE_ACCESSOR(logattr, sentence_end);
98
+ DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, line_break);
99
+ DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, mandatory_break);
100
+ DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, char_break);
101
+ DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, white);
102
+ DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, cursor_position);
103
+ DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, word_start);
104
+ DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, word_end);
105
+ DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, sentence_boundary);
106
+ DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, sentence_start);
107
+ DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, sentence_end);
97
108
 
98
109
  #if PANGO_CHECK_VERSION(1,4,0)
99
- rb_define_method(logattr, "backspace_deletes_character?", log_get_backspace_deletes_character, 0);
100
- rb_define_method(logattr, "set_backspace_deletes_character", log_set_backspace_deletes_character, 1);
110
+ rb_define_method(RG_TARGET_NAMESPACE, "backspace_deletes_character?", log_get_backspace_deletes_character, 0);
111
+ rb_define_method(RG_TARGET_NAMESPACE, "set_backspace_deletes_character", log_set_backspace_deletes_character, 1);
101
112
  #endif
102
113
 
103
- G_DEF_SETTERS(logattr);
114
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
104
115
  }
@@ -1,18 +1,30 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbpangomatrix.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2006/12/10 15:13:10 $
8
-
9
- Copyright (C) 2005 Masao Mutoh
10
- ************************************************/
11
-
12
- #include "rbpango.h"
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2005 Masao Mutoh
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbpangoprivate.h"
13
23
 
14
24
  #if PANGO_CHECK_VERSION(1,6,0)
15
- #define _SELF(self) ((PangoMatrix*)(RVAL2BOXED(self, PANGO_TYPE_MATRIX)))
25
+
26
+ #define RG_TARGET_NAMESPACE cMatrix
27
+ #define _SELF(self) (RVAL2PANGOMATRIX(self))
16
28
 
17
29
  #define ATTR_FLOAT(name)\
18
30
  static VALUE \
@@ -28,11 +40,11 @@ matrix_set_ ## name (VALUE self, VALUE val)\
28
40
  }
29
41
 
30
42
  #define DEFINE_ACCESSOR(name) \
31
- rb_define_method(matrix, G_STRINGIFY(name), matrix_get_ ## name, 0);\
32
- rb_define_method(matrix, G_STRINGIFY(set_ ## name), matrix_set_## name, 1);
43
+ rb_define_method(RG_TARGET_NAMESPACE, G_STRINGIFY(name), matrix_get_ ## name, 0);\
44
+ rb_define_method(RG_TARGET_NAMESPACE, G_STRINGIFY(set_ ## name), matrix_set_## name, 1);
33
45
 
34
46
  static VALUE
35
- matrix_initialize(int argc, VALUE *argv, VALUE self)
47
+ rg_initialize(int argc, VALUE *argv, VALUE self)
36
48
  {
37
49
  PangoMatrix matrix = PANGO_MATRIX_INIT;
38
50
  VALUE xx, xy, yx, yy, x0, y0;
@@ -52,21 +64,21 @@ matrix_initialize(int argc, VALUE *argv, VALUE self)
52
64
  }
53
65
 
54
66
  static VALUE
55
- matrix_translate(VALUE self, VALUE tx, VALUE ty)
67
+ rg_translate_bang(VALUE self, VALUE tx, VALUE ty)
56
68
  {
57
69
  pango_matrix_translate(_SELF(self), NUM2DBL(tx), NUM2DBL(ty));
58
70
  return self;
59
71
  }
60
72
 
61
73
  static VALUE
62
- matrix_scale(VALUE self, VALUE scale_x, VALUE scale_y)
74
+ rg_scale_bang(VALUE self, VALUE scale_x, VALUE scale_y)
63
75
  {
64
76
  pango_matrix_scale(_SELF(self), NUM2DBL(scale_x), NUM2DBL(scale_y));
65
77
  return self;
66
78
  }
67
79
 
68
80
  static VALUE
69
- matrix_rotate(VALUE self, VALUE degrees)
81
+ rg_rotate_bang(VALUE self, VALUE degrees)
70
82
  {
71
83
  pango_matrix_rotate(_SELF(self), NUM2DBL(degrees));
72
84
  return self;
@@ -74,14 +86,14 @@ matrix_rotate(VALUE self, VALUE degrees)
74
86
 
75
87
  #if PANGO_CHECK_VERSION(1,16,0)
76
88
  static VALUE
77
- matrix_get_gravity(VALUE self)
89
+ rg_gravity(VALUE self)
78
90
  {
79
- return GENUM2RVAL(pango_gravity_get_for_matrix(_SELF(self)), PANGO_TYPE_GRAVITY);
91
+ return PANGOGRAVITY2RVAL(pango_gravity_get_for_matrix(_SELF(self)));
80
92
  }
81
93
  #endif
82
94
 
83
95
  static VALUE
84
- matrix_concat(VALUE self, VALUE new_matrix)
96
+ rg_concat_bang(VALUE self, VALUE new_matrix)
85
97
  {
86
98
  pango_matrix_concat(_SELF(self), _SELF(new_matrix));
87
99
  return self;
@@ -89,7 +101,7 @@ matrix_concat(VALUE self, VALUE new_matrix)
89
101
 
90
102
  #if PANGO_CHECK_VERSION(1,12,0)
91
103
  static VALUE
92
- matrix_get_font_scale_factor(VALUE self)
104
+ rg_font_scale_factor(VALUE self)
93
105
  {
94
106
  return rb_float_new(pango_matrix_get_font_scale_factor(_SELF(self)));
95
107
  }
@@ -103,7 +115,7 @@ ATTR_FLOAT(x0);
103
115
  ATTR_FLOAT(y0);
104
116
 
105
117
  static VALUE
106
- matrix_to_a(VALUE self)
118
+ rg_to_a(VALUE self)
107
119
  {
108
120
  PangoMatrix* matrix = _SELF(self);
109
121
  return rb_ary_new3(6, INT2NUM(matrix->xx), INT2NUM(matrix->xy), INT2NUM(matrix->yx),
@@ -113,23 +125,23 @@ matrix_to_a(VALUE self)
113
125
  #endif
114
126
 
115
127
  void
116
- Init_pango_matrix()
128
+ Init_pango_matrix(VALUE mPango)
117
129
  {
118
130
  #if PANGO_CHECK_VERSION(1,6,0)
119
- VALUE matrix = G_DEF_CLASS(PANGO_TYPE_MATRIX, "Matrix", mPango);
120
-
121
- rb_define_method(matrix, "initialize", matrix_initialize, -1);
122
- rb_define_method(matrix, "translate!", matrix_translate, 2);
123
- rb_define_method(matrix, "scale!", matrix_scale, 2);
124
- rb_define_method(matrix, "rotate!", matrix_rotate, 1);
125
- rb_define_method(matrix, "concat!", matrix_concat, 1);
131
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_MATRIX, "Matrix", mPango);
132
+
133
+ RG_DEF_METHOD(initialize, -1);
134
+ RG_DEF_METHOD_BANG(translate, 2);
135
+ RG_DEF_METHOD_BANG(scale, 2);
136
+ RG_DEF_METHOD_BANG(rotate, 1);
137
+ RG_DEF_METHOD_BANG(concat, 1);
126
138
  #if PANGO_CHECK_VERSION(1,12,0)
127
- rb_define_method(matrix, "font_scale_factor", matrix_get_font_scale_factor, 0);
139
+ RG_DEF_METHOD(font_scale_factor, 0);
128
140
  #endif
129
141
  #if PANGO_CHECK_VERSION(1,16,0)
130
- rb_define_method(matrix, "gravity", matrix_get_gravity, 0);
142
+ RG_DEF_METHOD(gravity, 0);
131
143
  #endif
132
- rb_define_method(matrix, "to_a", matrix_to_a, 0);
144
+ RG_DEF_METHOD(to_a, 0);
133
145
 
134
146
  DEFINE_ACCESSOR(xx);
135
147
  DEFINE_ACCESSOR(xy);
@@ -138,7 +150,7 @@ Init_pango_matrix()
138
150
  DEFINE_ACCESSOR(x0);
139
151
  DEFINE_ACCESSOR(y0);
140
152
 
141
- G_DEF_SETTERS(matrix);
153
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
142
154
 
143
155
  #endif
144
156
  }
@@ -0,0 +1,53 @@
1
+ #ifndef RB_PANGO_PRIVATE_H
2
+ #define RB_PANGO_PRIVATE_H
3
+
4
+ #include "rbpango.h"
5
+
6
+ #ifndef HAVE_RB_ERRINFO
7
+ # define rb_errinfo() (ruby_errinfo)
8
+ #endif
9
+
10
+ #if PANGO_CHECK_VERSION(1,10,0) && defined(HAVE_RB_CAIRO_H)
11
+ # define CAIRO_AVAILABLE 1
12
+ #endif
13
+
14
+ G_BEGIN_DECLS
15
+
16
+ G_GNUC_INTERNAL void Init_pango_analysis(VALUE mPango);
17
+ G_GNUC_INTERNAL void Init_pango_attribute(VALUE mPango);
18
+ G_GNUC_INTERNAL void Init_pango_attriterator(VALUE mPango);
19
+ G_GNUC_INTERNAL void Init_pango_attrlist(VALUE mPango);
20
+ G_GNUC_INTERNAL void Init_pango_cairo(VALUE mPango);
21
+ G_GNUC_INTERNAL void Init_pango_cairo_context(VALUE mPango);
22
+ G_GNUC_INTERNAL void Init_pango_color(VALUE mPango);
23
+ G_GNUC_INTERNAL void Init_pango_context(VALUE mPango);
24
+ G_GNUC_INTERNAL void Init_pango_coverage(VALUE mPango);
25
+ G_GNUC_INTERNAL void Init_pango_engine(VALUE mPango);
26
+ G_GNUC_INTERNAL void Init_pango_font(VALUE mPango);
27
+ G_GNUC_INTERNAL void Init_pango_font_description(VALUE mPango);
28
+ G_GNUC_INTERNAL void Init_pango_font_face(VALUE mPango);
29
+ G_GNUC_INTERNAL void Init_pango_font_family(VALUE mPango);
30
+ G_GNUC_INTERNAL void Init_pango_font_map(VALUE mPango);
31
+ G_GNUC_INTERNAL void Init_pango_font_metrics(VALUE mPango);
32
+ G_GNUC_INTERNAL void Init_pango_fontset(VALUE mPango);
33
+ G_GNUC_INTERNAL void Init_pango_fontset_simple(VALUE mPango);
34
+ G_GNUC_INTERNAL void Init_pango_glyph_info(VALUE mPango);
35
+ G_GNUC_INTERNAL void Init_pango_glyph_item(VALUE mPango);
36
+ G_GNUC_INTERNAL void Init_pango_glyph_string(VALUE mPango);
37
+ G_GNUC_INTERNAL void Init_pango_gravity(VALUE mPango);
38
+ G_GNUC_INTERNAL void Init_pango_item(VALUE mPango);
39
+ G_GNUC_INTERNAL void Init_pango_language(VALUE mPango);
40
+ G_GNUC_INTERNAL void Init_pango_layout(VALUE mPango);
41
+ G_GNUC_INTERNAL void Init_pango_layout_iter(VALUE mPango);
42
+ G_GNUC_INTERNAL void Init_pango_layout_line(VALUE mPango);
43
+ G_GNUC_INTERNAL void Init_pango_logattr(VALUE mPango);
44
+ G_GNUC_INTERNAL void Init_pango_matrix(VALUE mPango);
45
+ G_GNUC_INTERNAL void Init_pango_rectangle(VALUE mPango);
46
+ G_GNUC_INTERNAL void Init_pangorenderer(VALUE mPango);
47
+ G_GNUC_INTERNAL void Init_pango_script(VALUE mPango);
48
+ G_GNUC_INTERNAL void Init_pango_script_iter(VALUE mPango);
49
+ G_GNUC_INTERNAL void Init_pango_array(VALUE mPango);
50
+
51
+ G_END_DECLS
52
+
53
+ #endif /* RB_PANGO_PRIVATE_H */
@@ -1,17 +1,28 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbpangolayoutline.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2005/02/13 17:31:33 $
8
-
9
- Copyright (C) 2002,2003 Masao Mutoh
10
- ************************************************/
11
-
12
- #include "rbpango.h"
13
-
14
- #define _SELF(s) ((PangoRectangle*)RVAL2BOXED(s, PANGO_TYPE_RECTANGLE))
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002,2003 Masao Mutoh
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbpangoprivate.h"
23
+
24
+ #define RG_TARGET_NAMESPACE cRectangle
25
+ #define _SELF(s) (RVAL2PANGORECTANGLE(s))
15
26
 
16
27
  /**********************************/
17
28
  static PangoRectangle*
@@ -38,7 +49,7 @@ pango_rectangle_get_type(void)
38
49
  /**********************************/
39
50
 
40
51
  static VALUE
41
- pango_rectangle_initialize(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
52
+ rg_initialize(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
42
53
  {
43
54
  PangoRectangle new;
44
55
 
@@ -51,59 +62,58 @@ pango_rectangle_initialize(VALUE self, VALUE x, VALUE y, VALUE width, VALUE heig
51
62
  return Qnil;
52
63
  }
53
64
 
54
-
55
65
  static VALUE
56
- pango_rectangle_x(VALUE self)
66
+ rg_x(VALUE self)
57
67
  {
58
68
  return INT2NUM(_SELF(self)->x);
59
69
  }
60
70
 
61
71
  static VALUE
62
- pango_rectangle_y(VALUE self)
72
+ rg_y(VALUE self)
63
73
  {
64
74
  return INT2NUM(_SELF(self)->y);
65
75
  }
66
76
 
67
77
  static VALUE
68
- pango_rectangle_w(VALUE self)
78
+ rg_width(VALUE self)
69
79
  {
70
80
  return INT2NUM(_SELF(self)->width);
71
81
  }
72
82
 
73
83
  static VALUE
74
- pango_rectangle_h(VALUE self)
84
+ rg_height(VALUE self)
75
85
  {
76
86
  return INT2NUM(_SELF(self)->height);
77
87
  }
78
88
 
79
89
  static VALUE
80
- pango_rectangle_set_x(VALUE self, VALUE x)
90
+ rg_set_x(VALUE self, VALUE x)
81
91
  {
82
92
  _SELF(self)->x = NUM2INT(x);
83
93
  return self;
84
94
  }
85
95
 
86
96
  static VALUE
87
- pango_rectangle_set_y(VALUE self, VALUE y)
97
+ rg_set_y(VALUE self, VALUE y)
88
98
  {
89
99
  _SELF(self)->y = NUM2INT(y);
90
100
  return self;
91
101
  }
92
102
  static VALUE
93
- pango_rectangle_set_w(VALUE self, VALUE width)
103
+ rg_set_width(VALUE self, VALUE width)
94
104
  {
95
105
  _SELF(self)->width = NUM2INT(width);
96
106
  return self;
97
107
  }
98
108
 
99
109
  static VALUE
100
- pango_rectangle_set_h(VALUE self, VALUE height)
110
+ rg_set_height(VALUE self, VALUE height)
101
111
  {
102
112
  _SELF(self)->height = NUM2INT(height);
103
113
  return self;
104
114
  }
105
115
  static VALUE
106
- pango_rectangle_to_a(VALUE self)
116
+ rg_to_a(VALUE self)
107
117
  {
108
118
  PangoRectangle* a = _SELF(self);
109
119
  return rb_ary_new3(4, INT2FIX(a->x), INT2FIX(a->y),
@@ -111,53 +121,52 @@ pango_rectangle_to_a(VALUE self)
111
121
  }
112
122
 
113
123
  static VALUE
114
- pango_rectangle_ascent(VALUE self)
124
+ rg_ascent(VALUE self)
115
125
  {
116
126
  PangoRectangle* r =_SELF(self);
117
127
  return INT2NUM(PANGO_ASCENT(*r));
118
128
  }
119
129
 
120
130
  static VALUE
121
- pango_rectangle_descent(VALUE self)
131
+ rg_descent(VALUE self)
122
132
  {
123
133
  PangoRectangle* r =_SELF(self);
124
134
  return INT2NUM(PANGO_DESCENT(*r));
125
135
  }
126
136
 
127
137
  static VALUE
128
- pango_rectangle_lbearing(VALUE self)
138
+ rg_lbearing(VALUE self)
129
139
  {
130
140
  PangoRectangle* r =_SELF(self);
131
141
  return INT2NUM(PANGO_LBEARING(*r));
132
142
  }
133
143
 
134
144
  static VALUE
135
- pango_rectangle_rbearing(VALUE self)
145
+ rg_rbearing(VALUE self)
136
146
  {
137
147
  PangoRectangle* r =_SELF(self);
138
148
  return INT2NUM(PANGO_RBEARING(*r));
139
149
  }
140
150
 
141
-
142
151
  void
143
- Init_pango_rectangle()
144
- {
145
- VALUE pRectangle = G_DEF_CLASS(PANGO_TYPE_RECTANGLE, "Rectangle", mPango);
146
- rb_define_method(pRectangle, "initialize", pango_rectangle_initialize, 4);
147
- rb_define_method(pRectangle, "x", pango_rectangle_x, 0);
148
- rb_define_method(pRectangle, "y", pango_rectangle_y, 0);
149
- rb_define_method(pRectangle, "width", pango_rectangle_w, 0);
150
- rb_define_method(pRectangle, "height", pango_rectangle_h, 0);
151
- rb_define_method(pRectangle, "set_x", pango_rectangle_set_x, 1);
152
- rb_define_method(pRectangle, "set_y", pango_rectangle_set_y, 1);
153
- rb_define_method(pRectangle, "set_width", pango_rectangle_set_w, 1);
154
- rb_define_method(pRectangle, "set_height", pango_rectangle_set_h, 1);
155
- rb_define_method(pRectangle, "to_a", pango_rectangle_to_a, 0);
156
-
157
- rb_define_method(pRectangle, "ascent", pango_rectangle_ascent, 0);
158
- rb_define_method(pRectangle, "descent", pango_rectangle_descent, 0);
159
- rb_define_method(pRectangle, "lbearing", pango_rectangle_lbearing, 0);
160
- rb_define_method(pRectangle, "rbearing", pango_rectangle_rbearing, 0);
161
-
162
- G_DEF_SETTERS(pRectangle);
152
+ Init_pango_rectangle(VALUE mPango)
153
+ {
154
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_RECTANGLE, "Rectangle", mPango);
155
+ RG_DEF_METHOD(initialize, 4);
156
+ RG_DEF_METHOD(x, 0);
157
+ RG_DEF_METHOD(y, 0);
158
+ RG_DEF_METHOD(width, 0);
159
+ RG_DEF_METHOD(height, 0);
160
+ RG_DEF_METHOD(set_x, 1);
161
+ RG_DEF_METHOD(set_y, 1);
162
+ RG_DEF_METHOD(set_width, 1);
163
+ RG_DEF_METHOD(set_height, 1);
164
+ RG_DEF_METHOD(to_a, 0);
165
+
166
+ RG_DEF_METHOD(ascent, 0);
167
+ RG_DEF_METHOD(descent, 0);
168
+ RG_DEF_METHOD(lbearing, 0);
169
+ RG_DEF_METHOD(rbearing, 0);
170
+
171
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
163
172
  }