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
- /************************************************
3
-
4
- rbpangolayoutiter.c -
5
-
6
- $Author: ggc $
7
- $Date: 2006/06/22 19:52:54 $
8
-
9
- Copyright (C) 2002-2005 Masao Mutoh
10
- ************************************************/
11
-
12
- #include "rbpango.h"
13
-
14
- #define _SELF(r) ((PangoLayoutIter*)RVAL2BOXED(r, PANGO_TYPE_LAYOUT_ITER))
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002-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"
23
+
24
+ #define RG_TARGET_NAMESPACE cLayoutIter
25
+ #define _SELF(r) (RVAL2PANGOLAYOUTITER(r))
15
26
 
16
27
  /**********************************/
17
28
  #ifndef HAVE_PANGO_LAYOUT_ITER_GET_TYPE
@@ -36,93 +47,93 @@ pango_layout_iter_get_type(void)
36
47
  /**********************************/
37
48
 
38
49
  static VALUE
39
- layout_iter_next_run(VALUE self)
50
+ rg_next_run_bang(VALUE self)
40
51
  {
41
52
  return CBOOL2RVAL(pango_layout_iter_next_run(_SELF(self)));
42
53
  }
43
54
 
44
55
  static VALUE
45
- layout_iter_next_char(VALUE self)
56
+ rg_next_char_bang(VALUE self)
46
57
  {
47
58
  return CBOOL2RVAL(pango_layout_iter_next_char(_SELF(self)));
48
59
  }
49
60
 
50
61
  static VALUE
51
- layout_iter_next_cluster(VALUE self)
62
+ rg_next_cluster_bang(VALUE self)
52
63
  {
53
64
  return CBOOL2RVAL(pango_layout_iter_next_cluster(_SELF(self)));
54
65
  }
55
66
 
56
67
  static VALUE
57
- layout_iter_next_line(VALUE self)
68
+ rg_next_line_bang(VALUE self)
58
69
  {
59
70
  return CBOOL2RVAL(pango_layout_iter_next_line(_SELF(self)));
60
71
  }
61
72
 
62
73
  static VALUE
63
- layout_iter_at_last_line(VALUE self)
74
+ rg_at_last_line_p(VALUE self)
64
75
  {
65
76
  return CBOOL2RVAL(pango_layout_iter_at_last_line(_SELF(self)));
66
77
  }
67
78
 
68
79
  static VALUE
69
- layout_iter_get_index(VALUE self)
80
+ rg_index(VALUE self)
70
81
  {
71
82
  return INT2NUM(pango_layout_iter_get_index(_SELF(self)));
72
83
  }
73
84
 
74
85
  static VALUE
75
- layout_iter_get_baseline(VALUE self)
86
+ rg_baseline(VALUE self)
76
87
  {
77
88
  return INT2NUM(pango_layout_iter_get_baseline(_SELF(self)));
78
89
  }
79
90
 
80
91
  static VALUE
81
- layout_iter_get_run(VALUE self)
92
+ rg_run(VALUE self)
82
93
  {
83
94
  PangoLayoutRun* run = pango_layout_iter_get_run(_SELF(self));
84
- return BOXED2RVAL(run, PANGO_TYPE_GLYPH_ITEM);
95
+ return PANGOGLYPHITEM2RVAL(run);
85
96
  }
86
97
 
87
98
  static VALUE
88
- layout_iter_get_line(VALUE self)
99
+ rg_line(VALUE self)
89
100
  {
90
- return BOXED2RVAL(pango_layout_iter_get_line(_SELF(self)), PANGO_TYPE_LAYOUT_LINE);
101
+ return PANGOLAYOUTLINE2RVAL(pango_layout_iter_get_line(_SELF(self)));
91
102
  }
92
103
 
93
104
  static VALUE
94
- layout_iter_get_char_extents(VALUE self)
105
+ rg_char_extents(VALUE self)
95
106
  {
96
107
  PangoRectangle logical_rect;
97
-
108
+
98
109
  pango_layout_iter_get_char_extents(_SELF(self), &logical_rect);
99
- return BOXED2RVAL(&logical_rect, PANGO_TYPE_RECTANGLE);
110
+ return PANGORECTANGLE2RVAL(&logical_rect);
100
111
  }
101
112
 
102
113
  static VALUE
103
- layout_iter_get_cluster_extents(VALUE self)
114
+ rg_cluster_extents(VALUE self)
104
115
  {
105
116
  PangoRectangle ink_rect, logical_rect;
106
117
 
107
118
  pango_layout_iter_get_cluster_extents(_SELF(self), &ink_rect, &logical_rect);
108
119
 
109
- return rb_assoc_new(BOXED2RVAL(&ink_rect, PANGO_TYPE_RECTANGLE),
110
- BOXED2RVAL(&logical_rect, PANGO_TYPE_RECTANGLE));
120
+ return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect),
121
+ PANGORECTANGLE2RVAL(&logical_rect));
111
122
  }
112
123
 
113
124
  static VALUE
114
- layout_iter_get_run_extents(VALUE self)
125
+ rg_run_extents(VALUE self)
115
126
  {
116
127
  PangoRectangle ink_rect, logical_rect;
117
128
 
118
129
  pango_layout_iter_get_run_extents(_SELF(self), &ink_rect, &logical_rect);
119
130
 
120
- return rb_assoc_new(BOXED2RVAL(&ink_rect, PANGO_TYPE_RECTANGLE),
121
- BOXED2RVAL(&logical_rect, PANGO_TYPE_RECTANGLE));
131
+ return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect),
132
+ PANGORECTANGLE2RVAL(&logical_rect));
122
133
  }
123
134
 
124
135
  static VALUE
125
- layout_iter_get_line_yrange(VALUE self)
136
+ rg_line_yrange(VALUE self)
126
137
  {
127
138
  int y0, y1;
128
139
  pango_layout_iter_get_line_yrange(_SELF(self), &y0, &y1);
@@ -130,49 +141,49 @@ layout_iter_get_line_yrange(VALUE self)
130
141
  }
131
142
 
132
143
  static VALUE
133
- layout_iter_get_line_extents(VALUE self)
144
+ rg_line_extents(VALUE self)
134
145
  {
135
146
  PangoRectangle ink_rect, logical_rect;
136
147
 
137
148
  pango_layout_iter_get_line_extents(_SELF(self), &ink_rect, &logical_rect);
138
149
 
139
- return rb_assoc_new(BOXED2RVAL(&ink_rect, PANGO_TYPE_RECTANGLE),
140
- BOXED2RVAL(&logical_rect, PANGO_TYPE_RECTANGLE));
150
+ return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect),
151
+ PANGORECTANGLE2RVAL(&logical_rect));
141
152
  }
142
153
  static VALUE
143
- layout_iter_get_layout_extents(VALUE self)
154
+ rg_layout_extents(VALUE self)
144
155
  {
145
156
  PangoRectangle ink_rect, logical_rect;
146
157
 
147
158
  pango_layout_iter_get_layout_extents(_SELF(self), &ink_rect, &logical_rect);
148
159
 
149
- return rb_assoc_new(BOXED2RVAL(&ink_rect, PANGO_TYPE_RECTANGLE),
150
- BOXED2RVAL(&logical_rect, PANGO_TYPE_RECTANGLE));
160
+ return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect),
161
+ PANGORECTANGLE2RVAL(&logical_rect));
151
162
  }
152
163
 
153
164
  void
154
- Init_pango_layout_iter()
165
+ Init_pango_layout_iter(VALUE mPango)
155
166
  {
156
- VALUE pIter = G_DEF_CLASS(PANGO_TYPE_LAYOUT_ITER, "LayoutIter", mPango);
167
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_LAYOUT_ITER, "LayoutIter", mPango);
157
168
 
158
169
  rbgobj_boxed_not_copy_obj(PANGO_TYPE_LAYOUT_ITER);
159
170
 
160
- rb_define_method(pIter, "next_run!", layout_iter_next_run, 0);
161
- rb_define_method(pIter, "next_char!", layout_iter_next_char, 0);
162
- rb_define_method(pIter, "next_cluster!", layout_iter_next_cluster, 0);
163
- rb_define_method(pIter, "next_line!", layout_iter_next_line, 0);
164
- rb_define_method(pIter, "at_last_line?", layout_iter_at_last_line, 0);
171
+ RG_DEF_METHOD_BANG(next_run, 0);
172
+ RG_DEF_METHOD_BANG(next_char, 0);
173
+ RG_DEF_METHOD_BANG(next_cluster, 0);
174
+ RG_DEF_METHOD_BANG(next_line, 0);
175
+ RG_DEF_METHOD_P(at_last_line, 0);
165
176
  /* for backword compatibility. :< */
166
- rb_define_alias(pIter, "at_last_line!", "at_last_line?");
167
- rb_define_method(pIter, "index", layout_iter_get_index, 0);
168
- rb_define_method(pIter, "baseline", layout_iter_get_baseline, 0);
169
- rb_define_method(pIter, "run", layout_iter_get_run, 0);
170
- rb_define_method(pIter, "line", layout_iter_get_line, 0);
171
- rb_define_method(pIter, "char_extents", layout_iter_get_char_extents, 0);
172
- rb_define_method(pIter, "cluster_extents", layout_iter_get_cluster_extents, 0);
173
- rb_define_method(pIter, "run_extents", layout_iter_get_run_extents, 0);
174
- rb_define_method(pIter, "line_yrange", layout_iter_get_line_yrange, 0);
175
- rb_define_method(pIter, "line_extents", layout_iter_get_line_extents, 0);
176
- rb_define_method(pIter, "layout_extents", layout_iter_get_layout_extents, 0);
177
-
177
+ RG_DEF_ALIAS("at_last_line!", "at_last_line?");
178
+ RG_DEF_METHOD(index, 0);
179
+ RG_DEF_METHOD(baseline, 0);
180
+ RG_DEF_METHOD(run, 0);
181
+ RG_DEF_METHOD(line, 0);
182
+ RG_DEF_METHOD(char_extents, 0);
183
+ RG_DEF_METHOD(cluster_extents, 0);
184
+ RG_DEF_METHOD(run_extents, 0);
185
+ RG_DEF_METHOD(line_yrange, 0);
186
+ RG_DEF_METHOD(line_extents, 0);
187
+ RG_DEF_METHOD(layout_extents, 0);
188
+
178
189
  }
@@ -1,18 +1,28 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbpangolayoutline.c -
5
-
6
- $Author: ggc $
7
- $Date: 2007/07/13 16:07:33 $
8
-
9
- Copyright (C) 2002-2005 Masao Mutoh
10
- ************************************************/
11
-
12
- #include "rbpango.h"
13
-
14
-
15
- #define _SELF(r) ((PangoLayoutLine*)RVAL2BOXED(r, PANGO_TYPE_LAYOUT_LINE))
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002-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"
23
+
24
+ #define RG_TARGET_NAMESPACE cLayoutLine
25
+ #define _SELF(r) (RVAL2PANGOLAYOUTLINE(r))
16
26
 
17
27
  /**********************************/
18
28
  #if !PANGO_CHECK_VERSION(1,9,0)
@@ -39,29 +49,29 @@ pango_layout_line_get_type(void)
39
49
  /**********************************/
40
50
 
41
51
  static VALUE
42
- layout_line_get_extents(VALUE self)
52
+ rg_extents(VALUE self)
43
53
  {
44
54
  PangoRectangle ink_rect, logical_rect;
45
55
 
46
56
  pango_layout_line_get_extents(_SELF(self), &ink_rect, &logical_rect);
47
57
 
48
- return rb_assoc_new(BOXED2RVAL(&ink_rect, PANGO_TYPE_RECTANGLE),
49
- BOXED2RVAL(&logical_rect, PANGO_TYPE_RECTANGLE));
58
+ return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect),
59
+ PANGORECTANGLE2RVAL(&logical_rect));
50
60
  }
51
61
 
52
62
  static VALUE
53
- layout_line_get_pixel_extents(VALUE self)
63
+ rg_pixel_extents(VALUE self)
54
64
  {
55
65
  PangoRectangle ink_rect, logical_rect;
56
66
 
57
67
  pango_layout_line_get_pixel_extents(_SELF(self), &ink_rect, &logical_rect);
58
68
 
59
- return rb_assoc_new(BOXED2RVAL(&ink_rect, PANGO_TYPE_RECTANGLE),
60
- BOXED2RVAL(&logical_rect, PANGO_TYPE_RECTANGLE));
69
+ return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect),
70
+ PANGORECTANGLE2RVAL(&logical_rect));
61
71
  }
62
72
 
63
73
  static VALUE
64
- layout_line_index_to_x(VALUE self, VALUE index, VALUE trailing)
74
+ rg_index_to_x(VALUE self, VALUE index, VALUE trailing)
65
75
  {
66
76
  int x_pos;
67
77
  pango_layout_line_index_to_x(_SELF(self), NUM2INT(index),
@@ -70,17 +80,17 @@ layout_line_index_to_x(VALUE self, VALUE index, VALUE trailing)
70
80
  }
71
81
 
72
82
  static VALUE
73
- layout_line_x_to_index(VALUE self, VALUE x_pos)
83
+ rg_x_to_index(VALUE self, VALUE x_pos)
74
84
  {
75
85
  int index, trailing;
76
-
86
+
77
87
  gboolean ret = pango_layout_line_x_to_index(_SELF(self), NUM2INT(x_pos),
78
88
  &index, &trailing);
79
89
  return rb_ary_new3(CBOOL2RVAL(ret), INT2NUM(index), INT2NUM(trailing));
80
90
  }
81
91
 
82
92
  static VALUE
83
- layout_line_get_x_ranges(VALUE self, VALUE start_index, VALUE end_index)
93
+ rg_get_x_ranges(VALUE self, VALUE start_index, VALUE end_index)
84
94
  {
85
95
  int* ranges;
86
96
  int i, n_ranges;
@@ -100,39 +110,39 @@ layout_line_get_x_ranges(VALUE self, VALUE start_index, VALUE end_index)
100
110
 
101
111
  /* Structure members */
102
112
  static VALUE
103
- layout_line_get_layout(VALUE self)
113
+ rg_layout(VALUE self)
104
114
  {
105
115
  return GOBJ2RVAL(_SELF(self)->layout);
106
116
  }
107
117
 
108
118
  static VALUE
109
- layout_line_set_layout(VALUE self, VALUE val)
119
+ rg_set_layout(VALUE self, VALUE val)
110
120
  {
111
- _SELF(self)->layout = PANGO_LAYOUT(RVAL2GOBJ(val));
121
+ _SELF(self)->layout = RVAL2PANGOLAYOUT(val);
112
122
  return self;
113
123
  }
114
124
 
115
125
  static VALUE
116
- layout_line_get_start_index(VALUE self)
126
+ rg_start_index(VALUE self)
117
127
  {
118
128
  return INT2NUM(_SELF(self)->start_index);
119
129
  }
120
130
 
121
131
  static VALUE
122
- layout_line_set_start_index(VALUE self, VALUE val)
132
+ rg_set_start_index(VALUE self, VALUE val)
123
133
  {
124
134
  _SELF(self)->start_index = NUM2INT(val);
125
135
  return self;
126
136
  }
127
137
 
128
138
  static VALUE
129
- layout_line_get_length(VALUE self)
139
+ rg_length(VALUE self)
130
140
  {
131
141
  return INT2NUM(_SELF(self)->length);
132
142
  }
133
143
 
134
144
  static VALUE
135
- layout_line_set_length(VALUE self, VALUE val)
145
+ rg_set_length(VALUE self, VALUE val)
136
146
  {
137
147
  _SELF(self)->length = NUM2INT(val);
138
148
  return self;
@@ -140,7 +150,7 @@ layout_line_set_length(VALUE self, VALUE val)
140
150
 
141
151
  #if PANGO_CHECK_VERSION(1,2,0)
142
152
  static VALUE
143
- layout_line_get_runs(VALUE self)
153
+ rg_runs(VALUE self)
144
154
  {
145
155
  GSList* list = _SELF(self)->runs;
146
156
  VALUE ary = rb_ary_new();
@@ -151,56 +161,81 @@ layout_line_get_runs(VALUE self)
151
161
  new_item.item = pango_item_copy(old_item->item);
152
162
  new_item.glyphs = pango_glyph_string_copy(old_item->glyphs);
153
163
 
154
- rb_ary_push(ary, BOXED2RVAL(&new_item, PANGO_TYPE_GLYPH_ITEM));
164
+ rb_ary_push(ary, PANGOGLYPHITEM2RVAL(&new_item));
155
165
  list = list->next;
156
166
  }
157
167
  return ary;
158
168
  }
159
169
  #endif
160
170
 
171
+ struct layout_line_set_runs_args {
172
+ PangoLayoutLine *line;
173
+ VALUE ary;
174
+ long n;
175
+ GSList *result;
176
+ };
177
+
161
178
  static VALUE
162
- layout_line_set_runs(VALUE self, VALUE ary)
179
+ layout_line_set_runs_body(VALUE value)
163
180
  {
164
- int i, len;
165
- GSList* list = NULL;
181
+ struct layout_line_set_runs_args *args = (struct layout_line_set_runs_args *)value;
182
+ long i;
166
183
 
167
- len = RARRAY_LEN(ary);
184
+ for (i = 0; i < args->n; i++)
185
+ args->result = g_slist_append(args->result,
186
+ RVAL2PANGOGLYPHITEM(RARRAY_PTR(args->ary)[i]));
168
187
 
169
- for (i = 0; i < len; i++) {
170
- list = g_slist_append(list, RVAL2BOXED(RARRAY_PTR(ary)[i],
171
- PANGO_TYPE_GLYPH_ITEM));
172
- }
188
+ g_slist_free(args->line->runs);
189
+ args->line->runs = args->result;
173
190
 
174
- if (_SELF(self)->runs) {
175
- g_slist_free(_SELF(self)->runs);
176
- }
177
- _SELF(self)->runs = list;
191
+ return Qnil;
192
+ }
193
+
194
+ static G_GNUC_NORETURN VALUE
195
+ layout_line_set_runs_rescue(VALUE value)
196
+ {
197
+ g_slist_free(((struct layout_line_set_runs_args *)value)->result);
198
+
199
+ rb_exc_raise(rb_errinfo());
200
+ }
201
+
202
+ static VALUE
203
+ rg_set_runs(VALUE self, VALUE attrs)
204
+ {
205
+ struct layout_line_set_runs_args args;
206
+ args.line = _SELF(self);
207
+ args.ary = rb_ary_to_ary(attrs);
208
+ args.n = RARRAY_LEN(args.ary);
209
+ args.result = NULL;
210
+
211
+ rb_rescue(layout_line_set_runs_body, (VALUE)&args,
212
+ layout_line_set_runs_rescue, (VALUE)&args);
178
213
 
179
214
  return self;
180
215
  }
181
216
 
182
217
  #if PANGO_CHECK_VERSION(1,4,0)
183
218
  static VALUE
184
- layout_line_is_paragraph_start(VALUE self)
219
+ rg_paragraph_start_p(VALUE self)
185
220
  {
186
221
  return CBOOL2RVAL(_SELF(self)->is_paragraph_start);
187
222
  }
188
223
 
189
224
  static VALUE
190
- layout_line_set_paragraph_start(VALUE self, VALUE val)
225
+ rg_set_paragraph_start(VALUE self, VALUE val)
191
226
  {
192
227
  _SELF(self)->is_paragraph_start = RVAL2CBOOL(val);
193
228
  return self;
194
229
  }
195
230
 
196
231
  static VALUE
197
- layout_line_get_resolved_dir(VALUE self)
232
+ rg_resolved_dir(VALUE self)
198
233
  {
199
234
  return UINT2NUM(_SELF(self)->resolved_dir);
200
235
  }
201
236
 
202
237
  static VALUE
203
- layout_line_set_resolved_dir(VALUE self, VALUE val)
238
+ rg_set_resolved_dir(VALUE self, VALUE val)
204
239
  {
205
240
  _SELF(self)->resolved_dir = NUM2UINT(val);
206
241
  return self;
@@ -208,31 +243,31 @@ layout_line_set_resolved_dir(VALUE self, VALUE val)
208
243
  #endif
209
244
 
210
245
  void
211
- Init_pango_layout_line()
212
- {
213
- VALUE pLine = G_DEF_CLASS(PANGO_TYPE_LAYOUT_LINE, "LayoutLine", mPango);
214
-
215
- rb_define_method(pLine, "extents", layout_line_get_extents, 0);
216
- rb_define_method(pLine, "pixel_extents", layout_line_get_pixel_extents, 0);
217
- rb_define_method(pLine, "index_to_x", layout_line_index_to_x, 2);
218
- rb_define_method(pLine, "x_to_index", layout_line_x_to_index, 1);
219
- rb_define_method(pLine, "get_x_ranges", layout_line_get_x_ranges, 2);
220
- rb_define_method(pLine, "layout", layout_line_get_layout, 0);
221
- rb_define_method(pLine, "set_layout", layout_line_set_layout, 1);
222
- rb_define_method(pLine, "start_index", layout_line_get_start_index, 0);
223
- rb_define_method(pLine, "set_start_index", layout_line_set_start_index, 1);
224
- rb_define_method(pLine, "length", layout_line_get_length, 0);
225
- rb_define_method(pLine, "set_length", layout_line_set_length, 1);
246
+ Init_pango_layout_line(VALUE mPango)
247
+ {
248
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_LAYOUT_LINE, "LayoutLine", mPango);
249
+
250
+ RG_DEF_METHOD(extents, 0);
251
+ RG_DEF_METHOD(pixel_extents, 0);
252
+ RG_DEF_METHOD(index_to_x, 2);
253
+ RG_DEF_METHOD(x_to_index, 1);
254
+ RG_DEF_METHOD(get_x_ranges, 2);
255
+ RG_DEF_METHOD(layout, 0);
256
+ RG_DEF_METHOD(set_layout, 1);
257
+ RG_DEF_METHOD(start_index, 0);
258
+ RG_DEF_METHOD(set_start_index, 1);
259
+ RG_DEF_METHOD(length, 0);
260
+ RG_DEF_METHOD(set_length, 1);
226
261
  #if PANGO_CHECK_VERSION(1,2,0)
227
- rb_define_method(pLine, "runs", layout_line_get_runs, 0);
262
+ RG_DEF_METHOD(runs, 0);
228
263
  #endif
229
- rb_define_method(pLine, "set_runs", layout_line_set_runs, 1);
264
+ RG_DEF_METHOD(set_runs, 1);
230
265
 
231
266
  #if PANGO_CHECK_VERSION(1,4,0)
232
- rb_define_method(pLine, "paragraph_start?", layout_line_is_paragraph_start, 0);
233
- rb_define_method(pLine, "set_paragraph_start", layout_line_set_paragraph_start, 1);
234
- rb_define_method(pLine, "resolved_dir", layout_line_get_resolved_dir, 0);
235
- rb_define_method(pLine, "set_resolved_dir", layout_line_set_resolved_dir, 1);
267
+ RG_DEF_METHOD_P(paragraph_start, 0);
268
+ RG_DEF_METHOD(set_paragraph_start, 1);
269
+ RG_DEF_METHOD(resolved_dir, 0);
270
+ RG_DEF_METHOD(set_resolved_dir, 1);
236
271
  #endif
237
- G_DEF_SETTERS(pLine);
272
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
238
273
  }