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,43 +1,54 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbpangoprivate.h"
3
22
 
4
- rbpangogravity.c -
5
-
6
- $Author: ito $
7
- $Date: 2010/01/17 03:00:50 $
8
-
9
- ************************************************/
10
-
11
- #include "rbpango.h"
23
+ #if PANGO_CHECK_VERSION(1,16,0)
12
24
 
25
+ #define RG_TARGET_NAMESPACE mGravity
13
26
 
14
- #if PANGO_CHECK_VERSION(1,16,0)
15
27
  static VALUE
16
- to_rotation(VALUE self, VALUE gravity)
28
+ rg_s_to_rotation(G_GNUC_UNUSED VALUE self, VALUE gravity)
17
29
  {
18
- return rb_float_new(pango_gravity_to_rotation(RVAL2GENUM(gravity, PANGO_TYPE_GRAVITY)));
30
+ return rb_float_new(pango_gravity_to_rotation(RVAL2PANGOGRAVITY(gravity)));
19
31
  }
20
32
 
21
33
  static VALUE
22
- is_vertical(VALUE self, VALUE gravity)
34
+ rg_s_vertical_p(G_GNUC_UNUSED VALUE self, VALUE gravity)
23
35
  {
24
- return CBOOL2RVAL(PANGO_GRAVITY_IS_VERTICAL(RVAL2GENUM(gravity, PANGO_TYPE_GRAVITY)));
36
+ return CBOOL2RVAL(PANGO_GRAVITY_IS_VERTICAL(RVAL2PANGOGRAVITY(gravity)));
25
37
  }
26
38
  #endif
27
39
 
28
40
  void
29
- Init_pango_gravity()
41
+ Init_pango_gravity(VALUE mPango)
30
42
  {
31
43
  #if PANGO_CHECK_VERSION(1,16,0)
32
- VALUE mGravity = rb_define_module_under(mPango, "Gravity");
44
+ VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mPango, "Gravity");
33
45
 
34
- rb_define_singleton_method(mGravity, "to_rotation", to_rotation, 1);
35
- rb_define_singleton_method(mGravity, "vertical?", is_vertical, 1);
46
+ RG_DEF_SMETHOD(to_rotation, 1);
47
+ RG_DEF_SMETHOD_P(vertical, 1);
36
48
 
37
- G_DEF_CLASS(PANGO_TYPE_GRAVITY, "Gravity", mGravity);
38
- G_DEF_CONSTANTS(mGravity, PANGO_TYPE_GRAVITY, "PANGO_GRAVITY_");
39
- G_DEF_CLASS(PANGO_TYPE_GRAVITY_HINT, "Hint", mGravity);
40
- G_DEF_CONSTANTS(mGravity, PANGO_TYPE_GRAVITY_HINT, "PANGO_GRAVITY_");
49
+ G_DEF_CLASS(PANGO_TYPE_GRAVITY, "Gravity", RG_TARGET_NAMESPACE);
50
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_GRAVITY, "PANGO_GRAVITY_");
51
+ G_DEF_CLASS(PANGO_TYPE_GRAVITY_HINT, "Hint", RG_TARGET_NAMESPACE);
52
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_GRAVITY_HINT, "PANGO_GRAVITY_");
41
53
  #endif
42
54
  }
43
-
@@ -1,17 +1,28 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbpangoitem.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2005/09/17 18:30:05 $
8
-
9
- Copyright (C) 2002-2005 Masao Mutoh
10
- ************************************************/
11
-
12
- #include "rbpango.h"
13
-
14
- #define _SELF(self) ((PangoItem*)RVAL2BOXED(self, PANGO_TYPE_ITEM))
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 cItem
25
+ #define _SELF(self) (RVAL2PANGOITEM(self))
15
26
 
16
27
  #define ATTR_INT(name)\
17
28
  static VALUE \
@@ -27,8 +38,8 @@ item_int_set_ ## name (VALUE self, VALUE val)\
27
38
  }
28
39
 
29
40
  #define DEF_INT_ACCESSOR(name) \
30
- rb_define_method(pItem, G_STRINGIFY(name), item_int_ ## name, 0);\
31
- rb_define_method(pItem, G_STRINGIFY(set_ ## name), item_int_set_ ## name, 1);
41
+ rb_define_method(RG_TARGET_NAMESPACE, G_STRINGIFY(name), item_int_ ## name, 0);\
42
+ rb_define_method(RG_TARGET_NAMESPACE, G_STRINGIFY(set_ ## name), item_int_set_ ## name, 1);
32
43
 
33
44
  /**********************************/
34
45
  #if ! PANGO_CHECK_VERSION(1,9,0)
@@ -47,19 +58,18 @@ pango_item_get_type(void)
47
58
  /**********************************/
48
59
 
49
60
  static VALUE
50
- item_initialize(VALUE self)
61
+ rg_initialize(VALUE self)
51
62
  {
52
63
  G_INITIALIZE(self, pango_item_new());
53
64
  return Qnil;
54
65
  }
55
66
 
56
67
  static VALUE
57
- item_split(VALUE self, VALUE split_index, VALUE split_offset)
68
+ rg_split(VALUE self, VALUE split_index, VALUE split_offset)
58
69
  {
59
- return BOXED2RVAL(pango_item_split(_SELF(self),
60
- NUM2INT(split_index),
61
- NUM2INT(split_offset)),
62
- PANGO_TYPE_ITEM);
70
+ return PANGOITEM2RVAL(pango_item_split(_SELF(self),
71
+ NUM2INT(split_index),
72
+ NUM2INT(split_offset)));
63
73
  }
64
74
  /* Move to Pango module (rbpangomain.c)
65
75
  GList* pango_reorder_items (GList *logical_items);
@@ -69,36 +79,35 @@ ATTR_INT(offset);
69
79
  ATTR_INT(length);
70
80
  ATTR_INT(num_chars);
71
81
 
72
-
73
82
  static VALUE
74
- item_get_analysis(VALUE self)
83
+ rg_analysis(VALUE self)
75
84
  {
76
85
  PangoAnalysis ana = _SELF(self)->analysis;
77
- return BOXED2RVAL(&ana, PANGO_TYPE_ANALYSIS);
86
+ return PANGOANALYSIS2RVAL(&ana);
78
87
  }
79
88
 
80
89
  static VALUE
81
- item_set_analysis(VALUE self, VALUE val)
90
+ rg_set_analysis(VALUE self, VALUE val)
82
91
  {
83
- PangoAnalysis* ana = (PangoAnalysis*)RVAL2BOXED(val, PANGO_TYPE_ANALYSIS);
92
+ PangoAnalysis* ana = RVAL2PANGOANALYSIS(val);
84
93
  _SELF(self)->analysis = *ana;
85
94
  return self;
86
95
  }
87
96
 
88
97
  void
89
- Init_pango_item()
98
+ Init_pango_item(VALUE mPango)
90
99
  {
91
- VALUE pItem = G_DEF_CLASS(PANGO_TYPE_ITEM, "Item", mPango);
92
-
93
- rb_define_method(pItem, "initialize", item_initialize, 0);
94
- rb_define_method(pItem, "split", item_split, 2);
100
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_ITEM, "Item", mPango);
101
+
102
+ RG_DEF_METHOD(initialize, 0);
103
+ RG_DEF_METHOD(split, 2);
95
104
 
96
105
  DEF_INT_ACCESSOR(offset);
97
106
  DEF_INT_ACCESSOR(length);
98
107
  DEF_INT_ACCESSOR(num_chars);
99
108
 
100
- rb_define_method(pItem, "analysis", item_get_analysis, 0);
101
- rb_define_method(pItem, "set_analysis", item_set_analysis, 1);
109
+ RG_DEF_METHOD(analysis, 0);
110
+ RG_DEF_METHOD(set_analysis, 1);
102
111
 
103
- G_DEF_SETTERS(pItem);
112
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
104
113
  }
@@ -1,52 +1,62 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /************************************************
3
-
4
- rbpangolanguage.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2005/09/17 17:09:13 $
8
-
9
- Copyright (C) 2009 Ruby-GNOME2 Project Team
10
- Copyright (C) 2002,2003 Masao Mutoh <mutoh@highway.ne.jp>
11
- ************************************************/
12
-
13
- #include "rbpango.h"
14
-
15
- #define _SELF(self) ((PangoLanguage*)RVAL2BOXED(self, PANGO_TYPE_LANGUAGE))
16
- #define LANG2RVAL(lang) (BOXED2RVAL(lang, PANGO_TYPE_LANGUAGE))
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2009 Ruby-GNOME2 Project Team
5
+ * Copyright (C) 2002,2003 Masao Mutoh <mutoh@highway.ne.jp>
6
+ *
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * This library is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
+ * MA 02110-1301 USA
21
+ */
22
+
23
+ #include "rbpangoprivate.h"
24
+
25
+ #define RG_TARGET_NAMESPACE cLanguage
26
+ #define _SELF(self) (RVAL2PANGOLANGUAGE(self))
17
27
 
18
28
  static VALUE
19
- language_s_default(VALUE self)
29
+ rg_s_default(G_GNUC_UNUSED VALUE self)
20
30
  {
21
- return LANG2RVAL(pango_language_get_default());
31
+ return PANGOLANGUAGE2RVAL(pango_language_get_default());
22
32
  }
23
33
 
24
34
  static VALUE
25
- language_initialize(VALUE self, VALUE language)
35
+ rg_initialize(VALUE self, VALUE language)
26
36
  {
27
37
  G_INITIALIZE(self, pango_language_from_string(RVAL2CSTR(language)));
28
38
  return Qnil;
29
39
  }
30
40
 
31
41
  static VALUE
32
- language_s_to_string(VALUE self, VALUE language)
42
+ rg_s_to_string(G_GNUC_UNUSED VALUE self, VALUE language)
33
43
  {
34
44
  return CSTR2RVAL(pango_language_to_string(RVAL2CSTR(language)));
35
45
  }
36
46
 
37
47
  static VALUE
38
- language_matches(int argc, VALUE *argv, VALUE self)
48
+ rg_matches(int argc, VALUE *argv, VALUE self)
39
49
  {
40
50
  VALUE range_list;
41
51
 
42
52
  rb_scan_args(argc, argv, "01", &range_list);
43
53
 
44
54
  return CBOOL2RVAL(pango_language_matches(_SELF(self),
45
- NIL_P(range_list) ? NULL : RVAL2CSTR(range_list)));
55
+ RVAL2CSTR_ACCEPT_NIL(range_list)));
46
56
  }
47
57
 
48
58
  static VALUE
49
- language_to_str(VALUE self)
59
+ rg_to_str(VALUE self)
50
60
  {
51
61
  return CSTR2RVAL(pango_language_to_string(_SELF(self)));
52
62
  }
@@ -54,28 +64,28 @@ language_to_str(VALUE self)
54
64
  #if PANGO_CHECK_VERSION(1,4,0)
55
65
  /* Moved from Pango::Script */
56
66
  static VALUE
57
- language_includes_script(VALUE self, VALUE script)
67
+ rg_includes_script(VALUE self, VALUE script)
58
68
  {
59
69
  return CBOOL2RVAL(pango_language_includes_script(_SELF(self),
60
- RVAL2GENUM(script, PANGO_TYPE_SCRIPT)));
70
+ RVAL2PANGOSCRIPT(script)));
61
71
  }
62
72
  #endif
63
73
 
64
74
  void
65
- Init_pango_language()
75
+ Init_pango_language(VALUE mPango)
66
76
  {
67
- VALUE pLanguage = G_DEF_CLASS(PANGO_TYPE_LANGUAGE, "Language", mPango);
77
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_LANGUAGE, "Language", mPango);
68
78
 
69
- rb_define_singleton_method(pLanguage, "default", language_s_default, 0);
79
+ RG_DEF_SMETHOD(default, 0);
70
80
 
71
- rb_define_method(pLanguage, "initialize", language_initialize, 1);
72
- rb_define_singleton_method(pLanguage, "to_string", language_s_to_string, 1);
73
- rb_define_method(pLanguage, "matches", language_matches, -1);
74
- rb_define_method(pLanguage, "to_str", language_to_str, 0);
75
- rb_define_alias(pLanguage, "to_s", "to_str");
81
+ RG_DEF_METHOD(initialize, 1);
82
+ RG_DEF_SMETHOD(to_string, 1);
83
+ RG_DEF_METHOD(matches, -1);
84
+ RG_DEF_METHOD(to_str, 0);
85
+ RG_DEF_ALIAS("to_s", "to_str");
76
86
 
77
87
  #if PANGO_CHECK_VERSION(1,4,0)
78
- rb_define_method(pLanguage, "includes_script", language_includes_script, 1);
88
+ RG_DEF_METHOD(includes_script, 1);
79
89
  #endif
80
90
 
81
91
  }
@@ -1,47 +1,57 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbpangolayout.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
- #define _SELF(self) (PANGO_LAYOUT(RVAL2GOBJ(self)))
15
- #define RVAL2CONTEXT(v) (PANGO_CONTEXT(RVAL2GOBJ(v)))
16
-
17
- static VALUE
18
- layout_initialize(VALUE self, VALUE context)
19
- {
20
- G_INITIALIZE(self, pango_layout_new(RVAL2CONTEXT(context)));
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 cLayout
25
+ #define _SELF(self) (RVAL2PANGOLAYOUT(self))
26
+
27
+ static VALUE
28
+ rg_initialize(VALUE self, VALUE context)
29
+ {
30
+ G_INITIALIZE(self, pango_layout_new(RVAL2PANGOCONTEXT(context)));
21
31
  return Qnil;
22
32
  }
23
33
 
24
34
  static VALUE
25
- layout_copy(VALUE self)
35
+ rg_copy(VALUE self)
26
36
  {
27
37
  return GOBJ2RVAL_UNREF(pango_layout_copy(_SELF(self)));
28
38
  }
29
39
 
30
40
  static VALUE
31
- layout_get_context(VALUE self)
41
+ rg_context(VALUE self)
32
42
  {
33
43
  return GOBJ2RVAL(pango_layout_get_context(_SELF(self)));
34
44
  }
35
45
 
36
46
  static VALUE
37
- layout_context_changed(VALUE self)
47
+ rg_context_changed(VALUE self)
38
48
  {
39
49
  pango_layout_context_changed(_SELF(self));
40
50
  return Qnil;
41
51
  }
42
52
 
43
53
  static VALUE
44
- layout_set_text(VALUE self, VALUE text)
54
+ rg_set_text(VALUE self, VALUE text)
45
55
  {
46
56
  StringValue(text);
47
57
 
@@ -51,13 +61,13 @@ layout_set_text(VALUE self, VALUE text)
51
61
  }
52
62
 
53
63
  static VALUE
54
- layout_get_text(VALUE self)
64
+ rg_text(VALUE self)
55
65
  {
56
66
  return CSTR2RVAL(pango_layout_get_text(_SELF(self)));
57
67
  }
58
68
 
59
69
  static VALUE
60
- layout_set_markup(int argc, VALUE *argv, VALUE self)
70
+ rg_set_markup(int argc, VALUE *argv, VALUE self)
61
71
  {
62
72
  VALUE markup, accel_marker;
63
73
  gunichar accel_char = 0;
@@ -80,7 +90,7 @@ layout_set_markup(int argc, VALUE *argv, VALUE self)
80
90
  }
81
91
 
82
92
  static VALUE
83
- layout_set_markup_eq(VALUE self, VALUE markup)
93
+ rg_operator_layout_set_markup_eq(VALUE self, VALUE markup)
84
94
  {
85
95
  StringValue(markup);
86
96
 
@@ -90,191 +100,190 @@ layout_set_markup_eq(VALUE self, VALUE markup)
90
100
  }
91
101
 
92
102
  static VALUE
93
- layout_set_attributes(VALUE self, VALUE attrs)
103
+ rg_set_attributes(VALUE self, VALUE attrs)
94
104
  {
95
105
  pango_layout_set_attributes(_SELF(self),
96
- (PangoAttrList*)(RVAL2BOXED(attrs, PANGO_TYPE_ATTR_LIST)));
106
+ RVAL2PANGOATTRLIST(attrs));
97
107
  return self;
98
108
  }
99
109
 
100
110
  static VALUE
101
- layout_get_attributes(VALUE self)
111
+ rg_attributes(VALUE self)
102
112
  {
103
- return BOXED2RVAL(pango_layout_get_attributes(_SELF(self)), PANGO_TYPE_ATTR_LIST);
113
+ return PANGOATTRLIST2RVAL(pango_layout_get_attributes(_SELF(self)));
104
114
  }
105
115
 
106
116
  static VALUE
107
- layout_set_font_description(VALUE self, VALUE rb_desc)
117
+ rg_set_font_description(VALUE self, VALUE rb_desc)
108
118
  {
109
119
  PangoFontDescription *desc;
110
120
  gboolean desc_created = FALSE;
111
121
 
112
122
  if (RVAL2CBOOL(rb_obj_is_kind_of(rb_desc, rb_cString))) {
113
- desc = pango_font_description_from_string(RVAL2CSTR(rb_desc));
114
- desc_created = TRUE;
123
+ desc = pango_font_description_from_string(RVAL2CSTR(rb_desc));
124
+ desc_created = TRUE;
115
125
  } else {
116
- desc = RVAL2BOXED(rb_desc, PANGO_TYPE_FONT_DESCRIPTION);
126
+ desc = RVAL2PANGOFONTDESCRIPTION(rb_desc);
117
127
  }
118
128
 
119
129
  pango_layout_set_font_description(_SELF(self), desc);
120
130
 
121
131
  if (desc_created)
122
- pango_font_description_free(desc);
132
+ pango_font_description_free(desc);
123
133
 
124
134
  return self;
125
135
  }
126
136
 
127
137
  #ifdef HAVE_PANGO_LAYOUT_GET_FONT_DESCRIPTION
128
138
  static VALUE
129
- layout_get_font_description(VALUE self)
139
+ rg_font_description(VALUE self)
130
140
  {
131
141
  const PangoFontDescription* desc = pango_layout_get_font_description(_SELF(self));
132
- return BOXED2RVAL((gpointer)desc, PANGO_TYPE_FONT_DESCRIPTION);
142
+ return PANGOFONTDESCRIPTION2RVAL((gpointer)desc);
133
143
  }
134
144
  #endif
135
145
 
136
146
  static VALUE
137
- layout_set_width(VALUE self, VALUE width)
147
+ rg_set_width(VALUE self, VALUE width)
138
148
  {
139
149
  pango_layout_set_width(_SELF(self), NUM2INT(width));
140
150
  return self;
141
151
  }
142
152
 
143
153
  static VALUE
144
- layout_get_width(VALUE self)
154
+ rg_width(VALUE self)
145
155
  {
146
156
  return INT2NUM(pango_layout_get_width(_SELF(self)));
147
157
  }
148
158
 
149
159
  static VALUE
150
- layout_set_wrap(VALUE self, VALUE wrap)
160
+ rg_set_wrap(VALUE self, VALUE wrap)
151
161
  {
152
- pango_layout_set_wrap(_SELF(self), RVAL2GENUM(wrap, PANGO_TYPE_WRAP_MODE));
162
+ pango_layout_set_wrap(_SELF(self), RVAL2PANGOWRAPMODE(wrap));
153
163
  return self;
154
164
  }
155
165
 
156
166
  static VALUE
157
- layout_get_wrap(VALUE self)
167
+ rg_wrap(VALUE self)
158
168
  {
159
- return GENUM2RVAL(pango_layout_get_wrap(_SELF(self)), PANGO_TYPE_WRAP_MODE);
169
+ return PANGOWRAPMODE2RVAL(pango_layout_get_wrap(_SELF(self)));
160
170
  }
161
171
 
162
172
  #ifdef HAVE_PANGO_LAYOUT_SET_ELLIPSIZE
163
173
  static VALUE
164
- layout_set_ellipsize(VALUE self, VALUE ellipsize)
174
+ rg_set_ellipsize(VALUE self, VALUE ellipsize)
165
175
  {
166
- pango_layout_set_ellipsize(_SELF(self), RVAL2GENUM(ellipsize,
167
- PANGO_TYPE_ELLIPSIZE_MODE));
176
+ pango_layout_set_ellipsize(_SELF(self), RVAL2PANGOELLIPSIZEMODE(ellipsize));
168
177
  return self;
169
178
  }
170
179
  static VALUE
171
- layout_get_ellipsize(VALUE self)
180
+ rg_ellipsize(VALUE self)
172
181
  {
173
- return GENUM2RVAL(pango_layout_get_ellipsize(_SELF(self)), PANGO_TYPE_ELLIPSIZE_MODE);
182
+ return PANGOELLIPSIZEMODE2RVAL(pango_layout_get_ellipsize(_SELF(self)));
174
183
  }
175
184
  #endif
176
185
 
177
186
  static VALUE
178
- layout_set_indent(VALUE self, VALUE indent)
187
+ rg_set_indent(VALUE self, VALUE indent)
179
188
  {
180
189
  pango_layout_set_indent(_SELF(self), NUM2INT(indent));
181
190
  return self;
182
191
  }
183
192
 
184
193
  static VALUE
185
- layout_get_indent(VALUE self)
194
+ rg_indent(VALUE self)
186
195
  {
187
196
  return INT2NUM(pango_layout_get_indent(_SELF(self)));
188
197
  }
189
198
 
190
199
  static VALUE
191
- layout_get_spacing(VALUE self)
200
+ rg_spacing(VALUE self)
192
201
  {
193
202
  return INT2NUM(pango_layout_get_spacing(_SELF(self)));
194
203
  }
195
204
 
196
205
  static VALUE
197
- layout_set_spacing(VALUE self, VALUE spacing)
206
+ rg_set_spacing(VALUE self, VALUE spacing)
198
207
  {
199
208
  pango_layout_set_spacing(_SELF(self), NUM2INT(spacing));
200
209
  return self;
201
210
  }
202
211
 
203
212
  static VALUE
204
- layout_set_justify(VALUE self, VALUE justify)
213
+ rg_set_justify(VALUE self, VALUE justify)
205
214
  {
206
215
  pango_layout_set_justify(_SELF(self), RVAL2CBOOL(justify));
207
216
  return self;
208
217
  }
209
218
  static VALUE
210
- layout_get_justify(VALUE self)
219
+ rg_justify_p(VALUE self)
211
220
  {
212
221
  return CBOOL2RVAL(pango_layout_get_justify(_SELF(self)));
213
222
  }
214
223
 
215
224
  #if PANGO_CHECK_VERSION(1,4,0)
216
225
  static VALUE
217
- layout_set_auto_dir(VALUE self, VALUE auto_dir)
226
+ rg_set_auto_dir(VALUE self, VALUE auto_dir)
218
227
  {
219
228
  pango_layout_set_auto_dir(_SELF(self), RVAL2CBOOL(auto_dir));
220
229
  return self;
221
230
  }
222
231
  static VALUE
223
- layout_get_auto_dir(VALUE self)
232
+ rg_auto_dir_p(VALUE self)
224
233
  {
225
234
  return CBOOL2RVAL(pango_layout_get_auto_dir(_SELF(self)));
226
235
  }
227
236
  #endif
228
237
 
229
238
  static VALUE
230
- layout_set_alignment(VALUE self, VALUE align)
239
+ rg_set_alignment(VALUE self, VALUE align)
231
240
  {
232
- pango_layout_set_alignment(_SELF(self), RVAL2GENUM(align, PANGO_TYPE_ALIGNMENT));
241
+ pango_layout_set_alignment(_SELF(self), RVAL2PANGOALIGNMENT(align));
233
242
  return self;
234
243
  }
235
244
 
236
245
  static VALUE
237
- layout_get_alignment(VALUE self)
246
+ rg_alignment(VALUE self)
238
247
  {
239
- return GENUM2RVAL(pango_layout_get_alignment(_SELF(self)), PANGO_TYPE_ALIGNMENT);
248
+ return PANGOALIGNMENT2RVAL(pango_layout_get_alignment(_SELF(self)));
240
249
  }
241
250
 
242
251
  static VALUE
243
- layout_set_tabs(VALUE self, VALUE tabs)
252
+ rg_set_tabs(VALUE self, VALUE tabs)
244
253
  {
245
254
  pango_layout_set_tabs(_SELF(self),
246
- (PangoTabArray*)RVAL2BOXED(self, PANGO_TYPE_TAB_ARRAY));
255
+ RVAL2PANGOTABARRAY(tabs));
247
256
  return self;
248
257
  }
249
258
 
250
259
  static VALUE
251
- layout_get_tabs(VALUE self)
260
+ rg_tabs(VALUE self)
252
261
  {
253
262
  VALUE ret = Qnil;
254
263
  PangoTabArray* tabs = pango_layout_get_tabs(_SELF(self));
255
264
 
256
265
  if (tabs) {
257
- ret = BOXED2RVAL(tabs, PANGO_TYPE_TAB_ARRAY);
266
+ ret = PANGOTABARRAY2RVAL(tabs);
258
267
  pango_tab_array_free(tabs);
259
268
  }
260
269
  return ret;
261
270
  }
262
271
 
263
272
  static VALUE
264
- layout_set_single_paragraph_mode(VALUE self, VALUE setting)
273
+ rg_set_single_paragraph_mode(VALUE self, VALUE setting)
265
274
  {
266
275
  pango_layout_set_single_paragraph_mode(_SELF(self), RVAL2CBOOL(setting));
267
276
  return self;
268
277
  }
269
278
 
270
279
  static VALUE
271
- layout_get_single_paragraph_mode(VALUE self)
280
+ rg_single_paragraph_mode_p(VALUE self)
272
281
  {
273
282
  return CBOOL2RVAL(pango_layout_get_single_paragraph_mode(_SELF(self)));
274
283
  }
275
284
 
276
285
  static VALUE
277
- layout_get_log_attrs(VALUE self)
286
+ rg_log_attrs(VALUE self)
278
287
  {
279
288
  PangoLogAttr* attrs;
280
289
  gint i, n_attrs;
@@ -285,7 +294,7 @@ layout_get_log_attrs(VALUE self)
285
294
  ary = rb_ary_new();
286
295
 
287
296
  for (i = 0; i < n_attrs; i++) {
288
- rb_ary_assoc(ary, BOXED2RVAL(&attrs[i], PANGO_TYPE_LOG_ATTR));
297
+ rb_ary_assoc(ary, PANGOLOGATTR2RVAL(&attrs[i]));
289
298
  }
290
299
  g_free(attrs);
291
300
 
@@ -293,7 +302,7 @@ layout_get_log_attrs(VALUE self)
293
302
  }
294
303
 
295
304
  static VALUE
296
- layout_xy_to_index(VALUE self, VALUE x, VALUE y)
305
+ rg_xy_to_index(VALUE self, VALUE x, VALUE y)
297
306
  {
298
307
  int index, trailing;
299
308
  gboolean ret = pango_layout_xy_to_index(_SELF(self),
@@ -304,24 +313,24 @@ layout_xy_to_index(VALUE self, VALUE x, VALUE y)
304
313
  }
305
314
 
306
315
  static VALUE
307
- layout_index_to_pos(VALUE self, VALUE index)
316
+ rg_index_to_pos(VALUE self, VALUE index)
308
317
  {
309
318
  PangoRectangle pos;
310
319
  pango_layout_index_to_pos(_SELF(self), NUM2INT(index), &pos);
311
- return BOXED2RVAL(&pos, PANGO_TYPE_RECTANGLE);
320
+ return PANGORECTANGLE2RVAL(&pos);
312
321
  }
313
322
 
314
323
  static VALUE
315
- layout_get_cursor_pos(VALUE self, VALUE index)
324
+ rg_get_cursor_pos(VALUE self, VALUE index)
316
325
  {
317
326
  PangoRectangle strong_pos, weak_pos;
318
327
  pango_layout_get_cursor_pos(_SELF(self), NUM2INT(index), &strong_pos, &weak_pos);
319
- return rb_ary_new3(2, BOXED2RVAL(&strong_pos, PANGO_TYPE_RECTANGLE),
320
- BOXED2RVAL(&weak_pos, PANGO_TYPE_RECTANGLE));
328
+ return rb_ary_new3(2, PANGORECTANGLE2RVAL(&strong_pos),
329
+ PANGORECTANGLE2RVAL(&weak_pos));
321
330
  }
322
331
 
323
332
  static VALUE
324
- layout_move_cursor_visually(VALUE self, VALUE strong, VALUE old_index, VALUE old_trailing, VALUE direction)
333
+ rg_move_cursor_visually(VALUE self, VALUE strong, VALUE old_index, VALUE old_trailing, VALUE direction)
325
334
  {
326
335
  int new_index, new_trailing;
327
336
  pango_layout_move_cursor_visually(_SELF(self), RVAL2CBOOL(strong),
@@ -332,7 +341,7 @@ layout_move_cursor_visually(VALUE self, VALUE strong, VALUE old_index, VALUE old
332
341
  }
333
342
 
334
343
  static VALUE
335
- layout_get_extents(int argc, VALUE *argv, VALUE self)
344
+ rg_get_extents(int argc, VALUE *argv, VALUE self)
336
345
  {
337
346
  VALUE ink_rect, logical_rect;
338
347
  PangoRectangle rink, rlog;
@@ -345,7 +354,7 @@ layout_get_extents(int argc, VALUE *argv, VALUE self)
345
354
  rink.width = 0;
346
355
  rink.height = 0;
347
356
  } else {
348
- PangoRectangle* rect = (PangoRectangle*)RVAL2BOXED(ink_rect, PANGO_TYPE_RECTANGLE);
357
+ PangoRectangle* rect = RVAL2PANGORECTANGLE(ink_rect);
349
358
  rink.x = rect->x;
350
359
  rink.y = rect->y;
351
360
  rink.width = rect->width;
@@ -357,7 +366,7 @@ layout_get_extents(int argc, VALUE *argv, VALUE self)
357
366
  rlog.width = 0;
358
367
  rlog.height = 0;
359
368
  } else {
360
- PangoRectangle* rect = (PangoRectangle*)RVAL2BOXED(logical_rect, PANGO_TYPE_RECTANGLE);
369
+ PangoRectangle* rect = RVAL2PANGORECTANGLE(logical_rect);
361
370
  rlog.x = rect->x;
362
371
  rlog.y = rect->y;
363
372
  rlog.width = rect->width;
@@ -366,23 +375,23 @@ layout_get_extents(int argc, VALUE *argv, VALUE self)
366
375
 
367
376
  pango_layout_get_extents(_SELF(self), &rink, &rlog);
368
377
 
369
- return rb_assoc_new(BOXED2RVAL(&rink, PANGO_TYPE_RECTANGLE),
370
- BOXED2RVAL(&rlog, PANGO_TYPE_RECTANGLE));
378
+ return rb_assoc_new(PANGORECTANGLE2RVAL(&rink),
379
+ PANGORECTANGLE2RVAL(&rlog));
371
380
  }
372
381
 
373
382
  static VALUE
374
- layout_extents(VALUE self)
383
+ rg_extents(VALUE self)
375
384
  {
376
385
  PangoRectangle rink = {0, 0, 0, 0};
377
386
  PangoRectangle rlog = {0, 0, 0, 0};
378
387
 
379
388
  pango_layout_get_extents(_SELF(self), &rink, &rlog);
380
- return rb_assoc_new(BOXED2RVAL(&rink, PANGO_TYPE_RECTANGLE),
381
- BOXED2RVAL(&rlog, PANGO_TYPE_RECTANGLE));
389
+ return rb_assoc_new(PANGORECTANGLE2RVAL(&rink),
390
+ PANGORECTANGLE2RVAL(&rlog));
382
391
  }
383
392
 
384
393
  static VALUE
385
- layout_get_pixel_extents(int argc, VALUE *argv, VALUE self)
394
+ rg_get_pixel_extents(int argc, VALUE *argv, VALUE self)
386
395
  {
387
396
  VALUE ink_rect, logical_rect;
388
397
  PangoRectangle rink, rlog;
@@ -395,7 +404,7 @@ layout_get_pixel_extents(int argc, VALUE *argv, VALUE self)
395
404
  rink.width = 0;
396
405
  rink.height = 0;
397
406
  } else {
398
- PangoRectangle* rect = (PangoRectangle*)RVAL2BOXED(ink_rect, PANGO_TYPE_RECTANGLE);
407
+ PangoRectangle* rect = RVAL2PANGORECTANGLE(ink_rect);
399
408
  rink.x = rect->x;
400
409
  rink.y = rect->y;
401
410
  rink.width = rect->width;
@@ -407,7 +416,7 @@ layout_get_pixel_extents(int argc, VALUE *argv, VALUE self)
407
416
  rlog.width = 0;
408
417
  rlog.height = 0;
409
418
  } else {
410
- PangoRectangle* rect = (PangoRectangle*)RVAL2BOXED(logical_rect, PANGO_TYPE_RECTANGLE);
419
+ PangoRectangle* rect = RVAL2PANGORECTANGLE(logical_rect);
411
420
  rlog.x = rect->x;
412
421
  rlog.y = rect->y;
413
422
  rlog.width = rect->width;
@@ -416,23 +425,23 @@ layout_get_pixel_extents(int argc, VALUE *argv, VALUE self)
416
425
 
417
426
  pango_layout_get_pixel_extents(_SELF(self), &rink, &rlog);
418
427
 
419
- return rb_assoc_new(BOXED2RVAL(&rink, PANGO_TYPE_RECTANGLE),
420
- BOXED2RVAL(&rlog, PANGO_TYPE_RECTANGLE));
428
+ return rb_assoc_new(PANGORECTANGLE2RVAL(&rink),
429
+ PANGORECTANGLE2RVAL(&rlog));
421
430
  }
422
431
 
423
432
  static VALUE
424
- layout_pixel_extents(VALUE self)
433
+ rg_pixel_extents(VALUE self)
425
434
  {
426
435
  PangoRectangle rink = {0, 0, 0, 0};
427
436
  PangoRectangle rlog = {0, 0, 0, 0};
428
437
 
429
438
  pango_layout_get_pixel_extents(_SELF(self), &rink, &rlog);
430
- return rb_assoc_new(BOXED2RVAL(&rink, PANGO_TYPE_RECTANGLE),
431
- BOXED2RVAL(&rlog, PANGO_TYPE_RECTANGLE));
439
+ return rb_assoc_new(PANGORECTANGLE2RVAL(&rink),
440
+ PANGORECTANGLE2RVAL(&rlog));
432
441
  }
433
442
 
434
443
  static VALUE
435
- layout_get_size(VALUE self)
444
+ rg_size(VALUE self)
436
445
  {
437
446
  int width, height;
438
447
  pango_layout_get_size(_SELF(self), &width, &height);
@@ -440,7 +449,7 @@ layout_get_size(VALUE self)
440
449
  }
441
450
 
442
451
  static VALUE
443
- layout_get_pixel_size(VALUE self)
452
+ rg_pixel_size(VALUE self)
444
453
  {
445
454
  int width, height;
446
455
  pango_layout_get_pixel_size(_SELF(self), &width, &height);
@@ -448,103 +457,101 @@ layout_get_pixel_size(VALUE self)
448
457
  }
449
458
 
450
459
  static VALUE
451
- layout_get_line_count(VALUE self)
460
+ rg_line_count(VALUE self)
452
461
  {
453
462
  return INT2NUM(pango_layout_get_line_count(_SELF(self)));
454
463
  }
455
464
 
456
465
  static VALUE
457
- layout_get_line(VALUE self, VALUE line)
466
+ rg_get_line(VALUE self, VALUE line)
458
467
  {
459
- return BOXED2RVAL(pango_layout_get_line(_SELF(self), NUM2INT(line)), PANGO_TYPE_LAYOUT_LINE);
468
+ return PANGOLAYOUTLINE2RVAL(pango_layout_get_line(_SELF(self), NUM2INT(line)));
460
469
  }
461
470
 
462
471
  static VALUE
463
- layout_get_lines(VALUE self)
472
+ rg_lines(VALUE self)
464
473
  {
465
474
  return GSLIST2ARY2(pango_layout_get_lines(_SELF(self)), PANGO_TYPE_LAYOUT_LINE);
466
475
  }
467
476
 
468
-
469
477
  static VALUE
470
- layout_get_iter(VALUE self)
478
+ rg_iter(VALUE self)
471
479
  {
472
- return BOXED2RVAL(pango_layout_get_iter(_SELF(self)),
473
- PANGO_TYPE_LAYOUT_ITER);
480
+ return PANGOLAYOUTITER2RVAL(pango_layout_get_iter(_SELF(self)));
474
481
  }
475
482
 
476
483
  void
477
- Init_pango_layout()
478
- {
479
- VALUE pLayout = G_DEF_CLASS(PANGO_TYPE_LAYOUT, "Layout", mPango);
480
-
481
- rb_define_method(pLayout, "initialize", layout_initialize, 1);
482
- rb_define_method(pLayout, "copy", layout_copy, 0);
483
- rb_define_method(pLayout, "context", layout_get_context, 0);
484
- rb_define_method(pLayout, "context_changed", layout_context_changed, 0);
485
- rb_define_method(pLayout, "set_text", layout_set_text, 1);
486
- rb_define_method(pLayout, "text", layout_get_text, 0);
487
- rb_define_method(pLayout, "set_markup", layout_set_markup, -1);
488
- rb_define_method(pLayout, "markup=", layout_set_markup_eq, 1);
489
- rb_define_method(pLayout, "set_attributes", layout_set_attributes, 1);
490
- rb_define_method(pLayout, "attributes", layout_get_attributes, 0);
491
- rb_define_method(pLayout, "set_font_description", layout_set_font_description, 1);
484
+ Init_pango_layout(VALUE mPango)
485
+ {
486
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_LAYOUT, "Layout", mPango);
487
+
488
+ RG_DEF_METHOD(initialize, 1);
489
+ RG_DEF_METHOD(copy, 0);
490
+ RG_DEF_METHOD(context, 0);
491
+ RG_DEF_METHOD(context_changed, 0);
492
+ RG_DEF_METHOD(set_text, 1);
493
+ RG_DEF_METHOD(text, 0);
494
+ RG_DEF_METHOD(set_markup, -1);
495
+ RG_DEF_METHOD_OPERATOR("markup=", layout_set_markup_eq, 1);
496
+ RG_DEF_METHOD(set_attributes, 1);
497
+ RG_DEF_METHOD(attributes, 0);
498
+ RG_DEF_METHOD(set_font_description, 1);
492
499
  #ifdef HAVE_PANGO_LAYOUT_GET_FONT_DESCRIPTION
493
- rb_define_method(pLayout, "font_description", layout_get_font_description, 0);
500
+ RG_DEF_METHOD(font_description, 0);
494
501
  #endif
495
- rb_define_method(pLayout, "set_width", layout_set_width, 1);
496
- rb_define_method(pLayout, "width", layout_get_width, 0);
497
- rb_define_method(pLayout, "set_wrap", layout_set_wrap, 1);
498
- rb_define_method(pLayout, "wrap", layout_get_wrap, 0);
502
+ RG_DEF_METHOD(set_width, 1);
503
+ RG_DEF_METHOD(width, 0);
504
+ RG_DEF_METHOD(set_wrap, 1);
505
+ RG_DEF_METHOD(wrap, 0);
499
506
  #ifdef HAVE_PANGO_LAYOUT_SET_ELLIPSIZE
500
- rb_define_method(pLayout, "set_ellipsize", layout_set_ellipsize, 1);
501
- rb_define_method(pLayout, "ellipsize", layout_get_ellipsize, 0);
507
+ RG_DEF_METHOD(set_ellipsize, 1);
508
+ RG_DEF_METHOD(ellipsize, 0);
502
509
  #endif
503
- rb_define_method(pLayout, "set_indent", layout_set_indent, 1);
504
- rb_define_method(pLayout, "indent", layout_get_indent, 0);
505
- rb_define_method(pLayout, "spacing", layout_get_spacing, 0);
506
- rb_define_method(pLayout, "set_spacing", layout_set_spacing, 1);
507
- rb_define_method(pLayout, "set_justify", layout_set_justify, 1);
508
- rb_define_method(pLayout, "justify?", layout_get_justify, 0);
510
+ RG_DEF_METHOD(set_indent, 1);
511
+ RG_DEF_METHOD(indent, 0);
512
+ RG_DEF_METHOD(spacing, 0);
513
+ RG_DEF_METHOD(set_spacing, 1);
514
+ RG_DEF_METHOD(set_justify, 1);
515
+ RG_DEF_METHOD_P(justify, 0);
509
516
  #if PANGO_CHECK_VERSION(1,4,0)
510
- rb_define_method(pLayout, "set_auto_dir", layout_set_auto_dir, 1);
511
- rb_define_method(pLayout, "auto_dir?", layout_get_auto_dir, 0);
517
+ RG_DEF_METHOD(set_auto_dir, 1);
518
+ RG_DEF_METHOD_P(auto_dir, 0);
512
519
  #endif
513
- rb_define_method(pLayout, "set_alignment", layout_set_alignment, 1);
514
- rb_define_method(pLayout, "alignment", layout_get_alignment, 0);
515
- rb_define_method(pLayout, "set_tabs", layout_set_tabs, 1);
516
- rb_define_method(pLayout, "tabs", layout_get_tabs, 0);
517
- rb_define_method(pLayout, "set_single_paragraph_mode", layout_set_single_paragraph_mode, 1);
518
- rb_define_method(pLayout, "single_paragraph_mode?", layout_get_single_paragraph_mode, 0);
519
- rb_define_method(pLayout, "log_attrs", layout_get_log_attrs, 0);
520
- rb_define_method(pLayout, "xy_to_index", layout_xy_to_index, 2);
521
- rb_define_method(pLayout, "index_to_pos", layout_index_to_pos, 1);
522
- rb_define_method(pLayout, "get_cursor_pos", layout_get_cursor_pos, 1);
523
- rb_define_method(pLayout, "move_cursor_visually", layout_move_cursor_visually, 4);
524
- rb_define_method(pLayout, "get_extents", layout_get_extents, -1);
525
- rb_define_method(pLayout, "extents", layout_extents, 0);
526
- rb_define_method(pLayout, "get_pixel_extents", layout_get_pixel_extents, -1);
527
- rb_define_method(pLayout, "pixel_extents", layout_pixel_extents, 0);
528
- rb_define_method(pLayout, "size", layout_get_size, 0);
529
- rb_define_method(pLayout, "pixel_size", layout_get_pixel_size, 0);
530
- rb_define_method(pLayout, "line_count", layout_get_line_count, 0);
531
- rb_define_method(pLayout, "get_line", layout_get_line, 1);
532
- rb_define_method(pLayout, "lines", layout_get_lines, 0);
533
- rb_define_method(pLayout, "iter", layout_get_iter, 0);
534
-
535
- G_DEF_SETTERS(pLayout);
520
+ RG_DEF_METHOD(set_alignment, 1);
521
+ RG_DEF_METHOD(alignment, 0);
522
+ RG_DEF_METHOD(set_tabs, 1);
523
+ RG_DEF_METHOD(tabs, 0);
524
+ RG_DEF_METHOD(set_single_paragraph_mode, 1);
525
+ RG_DEF_METHOD_P(single_paragraph_mode, 0);
526
+ RG_DEF_METHOD(log_attrs, 0);
527
+ RG_DEF_METHOD(xy_to_index, 2);
528
+ RG_DEF_METHOD(index_to_pos, 1);
529
+ RG_DEF_METHOD(get_cursor_pos, 1);
530
+ RG_DEF_METHOD(move_cursor_visually, 4);
531
+ RG_DEF_METHOD(get_extents, -1);
532
+ RG_DEF_METHOD(extents, 0);
533
+ RG_DEF_METHOD(get_pixel_extents, -1);
534
+ RG_DEF_METHOD(pixel_extents, 0);
535
+ RG_DEF_METHOD(size, 0);
536
+ RG_DEF_METHOD(pixel_size, 0);
537
+ RG_DEF_METHOD(line_count, 0);
538
+ RG_DEF_METHOD(get_line, 1);
539
+ RG_DEF_METHOD(lines, 0);
540
+ RG_DEF_METHOD(iter, 0);
541
+
542
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
536
543
 
537
544
  /* PangoWrapMode */
538
- G_DEF_CLASS(PANGO_TYPE_WRAP_MODE, "WrapMode", pLayout);
539
- G_DEF_CONSTANTS(pLayout, PANGO_TYPE_WRAP_MODE, "PANGO_");
545
+ G_DEF_CLASS(PANGO_TYPE_WRAP_MODE, "WrapMode", RG_TARGET_NAMESPACE);
546
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_WRAP_MODE, "PANGO_");
540
547
 
541
548
  /* PangoAlignment */
542
- G_DEF_CLASS(PANGO_TYPE_ALIGNMENT, "Alignment", pLayout);
543
- G_DEF_CONSTANTS(pLayout, PANGO_TYPE_ALIGNMENT, "PANGO_");
549
+ G_DEF_CLASS(PANGO_TYPE_ALIGNMENT, "Alignment", RG_TARGET_NAMESPACE);
550
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_ALIGNMENT, "PANGO_");
544
551
 
545
552
  #ifdef HAVE_PANGO_LAYOUT_SET_ELLIPSIZE
546
553
  /* PangoEllipsizeMode */
547
- G_DEF_CLASS(PANGO_TYPE_ELLIPSIZE_MODE, "EllipsizeMode", pLayout);
548
- G_DEF_CONSTANTS(pLayout, PANGO_TYPE_ELLIPSIZE_MODE, "PANGO_");
554
+ G_DEF_CLASS(PANGO_TYPE_ELLIPSIZE_MODE, "EllipsizeMode", RG_TARGET_NAMESPACE);
555
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_ELLIPSIZE_MODE, "PANGO_");
549
556
  #endif
550
557
  }