pango 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. data/ChangeLog +662 -0
  2. data/README +33 -0
  3. data/Rakefile +86 -0
  4. data/extconf.rb +68 -0
  5. data/sample/attribute.rb +82 -0
  6. data/sample/break.rb +26 -0
  7. data/sample/gdk_layout.rb +27 -0
  8. data/sample/glyphstring.rb +61 -0
  9. data/sample/item.rb +35 -0
  10. data/sample/label.rb +23 -0
  11. data/sample/layout.rb +102 -0
  12. data/sample/pango_cairo.rb +66 -0
  13. data/sample/parse.rb +33 -0
  14. data/sample/sample.txt +10 -0
  15. data/sample/script.rb +21 -0
  16. data/src/lib/pango.rb +60 -0
  17. data/src/makeinits.rb +48 -0
  18. data/src/rbpango.c +27 -0
  19. data/src/rbpango.h +97 -0
  20. data/src/rbpangoanalysis.c +197 -0
  21. data/src/rbpangoattribute.c +557 -0
  22. data/src/rbpangoattriterator.c +137 -0
  23. data/src/rbpangoattrlist.c +104 -0
  24. data/src/rbpangocairo.c +229 -0
  25. data/src/rbpangocolor.c +121 -0
  26. data/src/rbpangocontext.c +341 -0
  27. data/src/rbpangocoverage.c +104 -0
  28. data/src/rbpangoengine.c +65 -0
  29. data/src/rbpangofont.c +123 -0
  30. data/src/rbpangofontdescription.c +300 -0
  31. data/src/rbpangofontface.c +71 -0
  32. data/src/rbpangofontfamily.c +74 -0
  33. data/src/rbpangofontmap.c +104 -0
  34. data/src/rbpangofontmetrics.c +85 -0
  35. data/src/rbpangofontset.c +68 -0
  36. data/src/rbpangofontsetsimple.c +53 -0
  37. data/src/rbpangoglyphinfo.c +119 -0
  38. data/src/rbpangoglyphitem.c +129 -0
  39. data/src/rbpangoglyphstring.c +162 -0
  40. data/src/rbpangogravity.c +43 -0
  41. data/src/rbpangoinits.c +71 -0
  42. data/src/rbpangoitem.c +110 -0
  43. data/src/rbpangolanguage.c +88 -0
  44. data/src/rbpangolayout.c +593 -0
  45. data/src/rbpangolayoutiter.c +202 -0
  46. data/src/rbpangolayoutline.c +256 -0
  47. data/src/rbpangologattr.c +107 -0
  48. data/src/rbpangomain.c +213 -0
  49. data/src/rbpangomatrix.c +155 -0
  50. data/src/rbpangorectangle.c +178 -0
  51. data/src/rbpangorenderer.c +204 -0
  52. data/src/rbpangoscript.c +80 -0
  53. data/src/rbpangoscriptiter.c +91 -0
  54. data/src/rbpangotabarray.c +128 -0
  55. data/src/rbpangoversion.h +24 -0
  56. data/test/pango-test-utils.rb +9 -0
  57. data/test/run-test.rb +27 -0
  58. data/test/test-attribute.rb +19 -0
  59. data/test/test-language.rb +7 -0
  60. data/test/test_layout.rb +20 -0
  61. metadata +158 -0
@@ -0,0 +1,104 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbpangocoverage.c -
5
+
6
+ $Author: sakai $
7
+ $Date: 2007/07/08 02:53:10 $
8
+
9
+ Copyright (C) 2005 Masao Mutoh
10
+ ************************************************/
11
+
12
+ #include "rbpango.h"
13
+
14
+ #define _SELF(self) ((PangoCoverage*)RVAL2BOXED(self, PANGO_TYPE_COVERAGE))
15
+
16
+
17
+ /**********************************/
18
+ GType
19
+ pango_coverage_get_type(void)
20
+ {
21
+ static GType our_type = 0;
22
+
23
+ if (our_type == 0)
24
+ our_type = g_boxed_type_register_static ("PangoCoverage",
25
+ (GBoxedCopyFunc)pango_coverage_copy,
26
+ (GBoxedFreeFunc)pango_coverage_unref);
27
+ return our_type;
28
+ }
29
+ /**********************************/
30
+
31
+ static VALUE
32
+ coverage_initialize(self)
33
+ VALUE self;
34
+ {
35
+ G_INITIALIZE(self, pango_coverage_new());
36
+ return Qnil;
37
+ }
38
+
39
+ static VALUE
40
+ coverage_get_level(self, index_)
41
+ VALUE self, index_;
42
+ {
43
+ return GENUM2RVAL(pango_coverage_get(_SELF(self), NUM2INT(index_)),
44
+ PANGO_TYPE_COVERAGE_LEVEL);
45
+ }
46
+
47
+ static VALUE
48
+ coverage_max(self, other)
49
+ VALUE self, other;
50
+ {
51
+ pango_coverage_max(_SELF(self), _SELF(other));
52
+ return self;
53
+ }
54
+
55
+ static VALUE
56
+ coverage_set(self, index_, level)
57
+ VALUE self, index_, level;
58
+ {
59
+ pango_coverage_set(_SELF(self), NUM2INT(index_),
60
+ RVAL2GENUM(level, PANGO_TYPE_COVERAGE_LEVEL));
61
+ return self;
62
+ }
63
+
64
+ static VALUE
65
+ coverage_to_bytes(self)
66
+ VALUE self;
67
+ {
68
+ guchar* bytes;
69
+ int n_bytes;
70
+ VALUE ret;
71
+
72
+ pango_coverage_to_bytes(_SELF(self), &bytes, &n_bytes);
73
+ ret = rb_str_new((const char*)bytes, n_bytes);
74
+ g_free(bytes);
75
+
76
+ return ret;
77
+ }
78
+
79
+ static VALUE
80
+ coverage_s_from_bytes(self, bytes)
81
+ VALUE self, bytes;
82
+ {
83
+ StringValue(bytes);
84
+ return BOXED2RVAL(pango_coverage_from_bytes((guchar*)RVAL2CSTR(bytes),
85
+ RSTRING_LEN(bytes)),
86
+ PANGO_TYPE_COVERAGE);
87
+ }
88
+
89
+ void
90
+ Init_pango_coverage()
91
+ {
92
+ VALUE pCoverage = G_DEF_CLASS(PANGO_TYPE_COVERAGE, "Coverage", mPango);
93
+
94
+ rb_define_method(pCoverage, "initialize", coverage_initialize, 0);
95
+ rb_define_method(pCoverage, "get_level", coverage_get_level, 0);
96
+ rb_define_method(pCoverage, "max!", coverage_max, 1);
97
+ rb_define_method(pCoverage, "set", coverage_set, 2);
98
+ rb_define_method(pCoverage, "to_bytes", coverage_to_bytes, 0);
99
+ rb_define_singleton_method(pCoverage, "from_bytes", coverage_s_from_bytes, 1);
100
+
101
+ /* PangoCoverageLevel */
102
+ G_DEF_CLASS(PANGO_TYPE_COVERAGE_LEVEL, "Level", pCoverage);
103
+ G_DEF_CONSTANTS(pCoverage, PANGO_TYPE_COVERAGE_LEVEL, "PANGO_COVERAGE_");
104
+ }
@@ -0,0 +1,65 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbpangoengine.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2005/10/15 04:32:01 $
8
+
9
+ Copyright (C) 2005 Masao Mutoh
10
+ ************************************************/
11
+
12
+ #include "rbpango.h"
13
+
14
+ #ifdef PANGO_TYPE_ENGINE
15
+
16
+ #define _SELF(self) (PANGO_ENGINE(RVAL2GOBJ(self)))
17
+
18
+ /* FIXME
19
+ static VALUE
20
+ rbpango_s_engine_list(self)
21
+ VALUE self;
22
+ {
23
+ PangoEngineInfo* engines = g_new(PangoEngineInfo, 1);
24
+ int i, n;
25
+ VALUE ary;
26
+
27
+ script_engine_list(&engines, &n);
28
+ ary = rb_ary_new();
29
+
30
+ for(i = 0; i < n; i++){
31
+ rb_ary_push(ary, GOBJ2RVAL(&engines[i]));
32
+ }
33
+ return ary;
34
+ }
35
+
36
+ static VALUE
37
+ rbpango_s_engine_create(self, id)
38
+ VALUE self, id;
39
+ {
40
+ return GOBJ2RVAL(script_engine_create(RVAL2CSTR(id)));
41
+ }
42
+ */
43
+ /*
44
+ void script_engine_init (GTypeModule *module);
45
+ void script_engine_exit (void);
46
+ PangoEngine* script_engine_create (const char *id);
47
+ */
48
+
49
+ #endif
50
+
51
+ void
52
+ Init_pango_engine()
53
+ {
54
+ #ifdef PANGO_TYPE_ENGINE
55
+ G_DEF_CLASS(PANGO_TYPE_ENGINE, "Engine", mPango);
56
+
57
+ /* FIXME
58
+ rb_define_singleton_method(engine, "engines", rbpango_s_engine_list, 0);
59
+ rb_define_singleton_method(engine, "create", rbpango_s_engine_create, 1);
60
+ */
61
+ G_DEF_CLASS(PANGO_TYPE_ENGINE_LANG, "EngineLang", mPango);
62
+ G_DEF_CLASS(PANGO_TYPE_ENGINE_SHAPE, "EngineShape", mPango);
63
+ #endif
64
+ }
65
+
data/src/rbpangofont.c ADDED
@@ -0,0 +1,123 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbpangofont.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/13 16:07:33 $
8
+
9
+ Copyright (C) 2002-2006 Masao Mutoh
10
+ ************************************************/
11
+
12
+ #include "rbpango.h"
13
+
14
+ #define _SELF(self) (PANGO_FONT(RVAL2GOBJ(self)))
15
+
16
+ static VALUE
17
+ font_find_shaper(self, language, ch)
18
+ VALUE self, language, ch;
19
+ {
20
+ return GOBJ2RVAL(pango_font_find_shaper(_SELF(self),
21
+ (PangoLanguage*)RVAL2BOXED(language, PANGO_TYPE_LANGUAGE),
22
+ NUM2UINT(ch)));
23
+ }
24
+
25
+ static VALUE
26
+ font_describe(argc, argv, self)
27
+ int argc;
28
+ VALUE *argv;
29
+ VALUE self;
30
+ {
31
+ VALUE desc, absolute_size;
32
+ rb_scan_args(argc, argv, "01", &absolute_size);
33
+
34
+ if (NIL_P(absolute_size) || ! RVAL2CBOOL(absolute_size)){
35
+ desc = BOXED2RVAL(pango_font_describe(_SELF(self)), PANGO_TYPE_FONT_DESCRIPTION);
36
+ } else {
37
+ #if PANGO_CHECK_VERSION(1,14,0)
38
+ desc = BOXED2RVAL(pango_font_describe_with_absolute_size(_SELF(self)),
39
+ PANGO_TYPE_FONT_DESCRIPTION);
40
+ #else
41
+ rb_warning("Pango::Font#describe(absolute) has been supported since GTK+-2.10.x. Use Pango::Font#describe() instead.");
42
+ desc = BOXED2RVAL(pango_font_describe(_SELF(self)), PANGO_TYPE_FONT_DESCRIPTION);
43
+ #endif
44
+ }
45
+ return desc;
46
+ }
47
+
48
+ static VALUE
49
+ font_get_coverage(self, language)
50
+ VALUE self, language;
51
+ {
52
+ PangoCoverage* c = pango_font_get_coverage(_SELF(self),
53
+ (PangoLanguage*)RVAL2BOXED(language, PANGO_TYPE_LANGUAGE));
54
+ return BOXED2RVAL(c, PANGO_TYPE_COVERAGE);
55
+ }
56
+
57
+ static VALUE
58
+ font_get_glyph_extents(self, glyph)
59
+ VALUE self, glyph;
60
+ {
61
+ PangoRectangle ink_rect, logical_rect;
62
+ pango_font_get_glyph_extents(_SELF(self),
63
+ NUM2UINT(glyph),
64
+ &ink_rect, &logical_rect);
65
+
66
+ return rb_assoc_new(BOXED2RVAL(&ink_rect, PANGO_TYPE_RECTANGLE),
67
+ BOXED2RVAL(&logical_rect, PANGO_TYPE_RECTANGLE));
68
+
69
+ }
70
+
71
+ static VALUE
72
+ font_get_metrics(argc, argv, self)
73
+ int argc;
74
+ VALUE *argv;
75
+ VALUE self;
76
+ {
77
+ VALUE language;
78
+ PangoLanguage* lang = NULL;
79
+
80
+ rb_scan_args(argc, argv, "01", &language);
81
+
82
+ if (!NIL_P(language))
83
+ lang = (PangoLanguage*)RVAL2BOXED(language, PANGO_TYPE_LANGUAGE);
84
+
85
+ return BOXED2RVAL(pango_font_get_metrics(_SELF(self), lang),
86
+ PANGO_TYPE_FONT_METRICS);
87
+ }
88
+
89
+ #if PANGO_CHECK_VERSION(1,9,0)
90
+ static VALUE
91
+ font_get_font_map(self)
92
+ VALUE self;
93
+ {
94
+ return GOBJ2RVAL(pango_font_get_font_map(_SELF(self)));
95
+ }
96
+ #endif
97
+
98
+ void
99
+ Init_pango_font()
100
+ {
101
+ VALUE pFont = G_DEF_CLASS(PANGO_TYPE_FONT, "Font", mPango);
102
+
103
+ rb_define_method(pFont, "find_shaper", font_find_shaper, 2);
104
+ rb_define_method(pFont, "describe", font_describe, -1);
105
+ rb_define_method(pFont, "get_coverage", font_get_coverage, 1);
106
+ rb_define_method(pFont, "get_glyph_extents", font_get_glyph_extents, 1);
107
+ rb_define_method(pFont, "metrics", font_get_metrics, -1);
108
+
109
+ #if PANGO_CHECK_VERSION(1,9,0)
110
+ rb_define_method(pFont, "font_map", font_get_font_map, 0);
111
+ #endif
112
+
113
+ G_DEF_CLASS3("PangoXFont", "XFont", mPango);
114
+ G_DEF_CLASS3("PangoFT2Font", "FT2Font", mPango);
115
+ G_DEF_CLASS3("PangoFcFont", "FcFont", mPango);
116
+ G_DEF_CLASS3("PangoXftFont", "XftFont", mPango);
117
+ G_DEF_CLASS3("PangoCairoFcFont", "CairoFcFont", mPango);
118
+ G_DEF_CLASS3("PangoCairoFont", "CairoFont", mPango);
119
+ G_DEF_CLASS3("PangoCairoWin32Font", "CairoWin32Font", mPango);
120
+ #if PANGO_CHECK_VERSION(1,12,0)
121
+ G_DEF_CLASS3("PangoATSUIFont", "ATSUIFont", mPango);
122
+ #endif
123
+ }
@@ -0,0 +1,300 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbpangofontdescription.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) ((PangoFontDescription*)RVAL2BOXED(self, PANGO_TYPE_FONT_DESCRIPTION))
15
+
16
+ static VALUE
17
+ font_desc_initialize(int argc, VALUE *argv, VALUE self)
18
+ {
19
+ VALUE str;
20
+ PangoFontDescription *description;
21
+
22
+ rb_scan_args(argc, argv, "01", &str);
23
+
24
+ if (NIL_P(str)) {
25
+ description = pango_font_description_new();
26
+ } else {
27
+ description = pango_font_description_from_string(RVAL2CSTR(str));
28
+ }
29
+
30
+ G_INITIALIZE(self, description);
31
+ pango_font_description_free(description);
32
+
33
+ return Qnil;
34
+ }
35
+ /*
36
+ PangoFontDescription* pango_font_description_copy
37
+ (const PangoFontDescription *desc);
38
+ PangoFontDescription* pango_font_description_copy_static
39
+ (const PangoFontDescription *desc);
40
+ */
41
+
42
+ static VALUE
43
+ font_desc_hash(self)
44
+ VALUE self;
45
+ {
46
+ return UINT2NUM(pango_font_description_hash(_SELF(self)));
47
+ }
48
+
49
+ static VALUE
50
+ font_desc_equal(self, other)
51
+ VALUE self, other;
52
+ {
53
+ return CBOOL2RVAL(pango_font_description_equal(_SELF(self), _SELF(other)));
54
+ }
55
+
56
+ /* Don't we need this?
57
+ void pango_font_descriptions_free (PangoFontDescription **descs,
58
+ int n_descs);
59
+ */
60
+
61
+ static VALUE
62
+ font_desc_set_family(self, family)
63
+ VALUE self, family;
64
+ {
65
+ pango_font_description_set_family(_SELF(self), RVAL2CSTR(family));
66
+ return self;
67
+ }
68
+ /* Don't we need this?
69
+ void pango_font_description_set_family_static
70
+ (PangoFontDescription *desc,
71
+ const char *family);
72
+ */
73
+
74
+ static VALUE
75
+ font_desc_get_family(self)
76
+ VALUE self;
77
+ {
78
+ return CSTR2RVAL(pango_font_description_get_family(_SELF(self)));
79
+ }
80
+
81
+ static VALUE
82
+ font_desc_set_style(self, style)
83
+ VALUE self, style;
84
+ {
85
+ pango_font_description_set_style(_SELF(self), RVAL2GENUM(style, PANGO_TYPE_STYLE));
86
+ return self;
87
+ }
88
+
89
+ static VALUE
90
+ font_desc_get_style(self)
91
+ VALUE self;
92
+ {
93
+ return GENUM2RVAL(pango_font_description_get_style(_SELF(self)), PANGO_TYPE_STYLE);
94
+ }
95
+
96
+ static VALUE
97
+ font_desc_set_variant(self, variant)
98
+ VALUE self, variant;
99
+ {
100
+ pango_font_description_set_variant(_SELF(self), RVAL2GENUM(variant, PANGO_TYPE_VARIANT));
101
+ return self;
102
+ }
103
+
104
+ static VALUE
105
+ font_desc_get_variant(self)
106
+ VALUE self;
107
+ {
108
+ return GENUM2RVAL(pango_font_description_get_variant(_SELF(self)), PANGO_TYPE_VARIANT);
109
+ }
110
+
111
+ static VALUE
112
+ font_desc_set_weight(VALUE self, VALUE weight)
113
+ {
114
+ pango_font_description_set_weight(_SELF(self),
115
+ RVAL2GENUM(weight, PANGO_TYPE_WEIGHT));
116
+ return self;
117
+ }
118
+
119
+ static VALUE
120
+ font_desc_get_weight(self)
121
+ VALUE self;
122
+ {
123
+ return GENUM2RVAL(pango_font_description_get_weight(_SELF(self)), PANGO_TYPE_WEIGHT);
124
+ }
125
+
126
+ static VALUE
127
+ font_desc_set_stretch(self, stretch)
128
+ VALUE self, stretch;
129
+ {
130
+ pango_font_description_set_stretch(_SELF(self), RVAL2GENUM(stretch, PANGO_TYPE_STRETCH));
131
+ return self;
132
+ }
133
+
134
+ static VALUE
135
+ font_desc_get_stretch(self)
136
+ VALUE self;
137
+ {
138
+ return GENUM2RVAL(pango_font_description_get_stretch(_SELF(self)), PANGO_TYPE_STRETCH);
139
+ }
140
+
141
+ static VALUE
142
+ font_desc_set_size(self, size)
143
+ VALUE self, size;
144
+ {
145
+ pango_font_description_set_size(_SELF(self), NUM2INT(size));
146
+ return self;
147
+ }
148
+
149
+ static VALUE
150
+ font_desc_get_size(self)
151
+ VALUE self;
152
+ {
153
+ return INT2NUM(pango_font_description_get_size(_SELF(self)));
154
+ }
155
+
156
+ #if PANGO_CHECK_VERSION(1,8,0)
157
+ static VALUE
158
+ font_desc_set_absolute_size(self, size)
159
+ VALUE self, size;
160
+ {
161
+ pango_font_description_set_absolute_size(_SELF(self), NUM2INT(size));
162
+ return self;
163
+ }
164
+
165
+ static VALUE
166
+ font_desc_get_size_is_absolute(self)
167
+ VALUE self;
168
+ {
169
+ return CBOOL2RVAL(pango_font_description_get_size_is_absolute(_SELF(self)));
170
+ }
171
+ #endif
172
+
173
+ #if PANGO_CHECK_VERSION(1,16,0)
174
+ static VALUE
175
+ font_desc_get_gravity(VALUE self)
176
+ {
177
+ return GENUM2RVAL(pango_font_description_get_gravity(_SELF(self)), PANGO_TYPE_GRAVITY);
178
+ }
179
+
180
+ static VALUE
181
+ font_desc_set_gravity(VALUE self, VALUE gravity)
182
+ {
183
+ pango_font_description_set_gravity(_SELF(self), RVAL2GENUM(gravity, PANGO_TYPE_GRAVITY));
184
+ return self;
185
+ }
186
+ #endif
187
+
188
+ static VALUE
189
+ font_desc_get_set_fields(self)
190
+ VALUE self;
191
+ {
192
+ return GFLAGS2RVAL(pango_font_description_get_set_fields(_SELF(self)), PANGO_TYPE_FONT_MASK);
193
+ }
194
+
195
+ static VALUE
196
+ font_desc_unset_fields(self, to_unset)
197
+ VALUE self, to_unset;
198
+ {
199
+ pango_font_description_unset_fields(_SELF(self), RVAL2GFLAGS(to_unset, PANGO_TYPE_FONT_MASK));
200
+ return self;
201
+ }
202
+
203
+ static VALUE
204
+ font_desc_merge(self, desc_to_merge, replace_existing)
205
+ VALUE self, desc_to_merge, replace_existing;
206
+ {
207
+ pango_font_description_merge(_SELF(self), _SELF(desc_to_merge),
208
+ RVAL2CBOOL(replace_existing));
209
+ return self;
210
+ }
211
+
212
+ /* Don't we need this?
213
+ void pango_font_description_merge_static
214
+ (PangoFontDescription *desc,
215
+ const PangoFontDescription *desc_to_merge,
216
+ gboolean replace_existing);
217
+ */
218
+
219
+ static VALUE
220
+ font_desc_better_match(self, old_match, new_match)
221
+ VALUE self, old_match, new_match;
222
+ {
223
+ return CBOOL2RVAL(pango_font_description_better_match(_SELF(self),
224
+ _SELF(old_match),
225
+ _SELF(new_match)));
226
+ }
227
+
228
+ static VALUE
229
+ font_desc_to_string(self)
230
+ VALUE self;
231
+ {
232
+ return CSTR2RVAL(pango_font_description_to_string(_SELF(self)));
233
+ }
234
+
235
+ static VALUE
236
+ font_desc_to_filename(self)
237
+ VALUE self;
238
+ {
239
+ return CSTR2RVAL(pango_font_description_to_filename(_SELF(self)));
240
+ }
241
+
242
+ void
243
+ Init_pango_font_description()
244
+ {
245
+ VALUE pFontDesc = G_DEF_CLASS(PANGO_TYPE_FONT_DESCRIPTION, "FontDescription", mPango);
246
+
247
+ rb_define_method(pFontDesc, "initialize", font_desc_initialize, -1);
248
+ rb_define_method(pFontDesc, "hash", font_desc_hash, 0);
249
+ rb_define_method(pFontDesc, "==", font_desc_equal, 1);
250
+ rb_define_method(pFontDesc, "set_family", font_desc_set_family, 1);
251
+ rb_define_method(pFontDesc, "family", font_desc_get_family, 0);
252
+ rb_define_method(pFontDesc, "set_style", font_desc_set_style, 1);
253
+ rb_define_method(pFontDesc, "style", font_desc_get_style, 0);
254
+ rb_define_method(pFontDesc, "set_variant", font_desc_set_variant, 1);
255
+ rb_define_method(pFontDesc, "variant", font_desc_get_variant, 0);
256
+ rb_define_method(pFontDesc, "set_weight", font_desc_set_weight, 1);
257
+ rb_define_method(pFontDesc, "weight", font_desc_get_weight, 0);
258
+ rb_define_method(pFontDesc, "set_stretch", font_desc_set_stretch, 1);
259
+ rb_define_method(pFontDesc, "stretch", font_desc_get_stretch, 0);
260
+ rb_define_method(pFontDesc, "set_size", font_desc_set_size, 1);
261
+ rb_define_method(pFontDesc, "size", font_desc_get_size, 0);
262
+
263
+ #if PANGO_CHECK_VERSION(1,8,0)
264
+ rb_define_method(pFontDesc, "set_absolute_size", font_desc_set_absolute_size, 1);
265
+ rb_define_method(pFontDesc, "size_is_absolute?", font_desc_get_size_is_absolute, 0);
266
+ #endif
267
+ #if PANGO_CHECK_VERSION(1,16,0)
268
+ rb_define_method(pFontDesc, "set_gravity", font_desc_set_gravity, 1);
269
+ rb_define_method(pFontDesc, "gravity", font_desc_get_gravity, 0);
270
+ #endif
271
+ rb_define_method(pFontDesc, "set_fields", font_desc_get_set_fields, 0);
272
+ rb_define_method(pFontDesc, "unset_fields", font_desc_unset_fields, 1);
273
+ rb_define_method(pFontDesc, "merge", font_desc_merge, 2);
274
+ rb_define_method(pFontDesc, "better_match", font_desc_better_match, 2);
275
+ rb_define_method(pFontDesc, "to_str", font_desc_to_string, 0);
276
+ rb_define_alias(pFontDesc, "to_s", "to_str");
277
+ rb_define_method(pFontDesc, "to_filename", font_desc_to_filename, 0);
278
+
279
+ G_DEF_SETTERS(pFontDesc);
280
+
281
+ /* PangoStyle */
282
+ G_DEF_CLASS(PANGO_TYPE_STYLE, "Style", pFontDesc);
283
+ G_DEF_CONSTANTS(pFontDesc, PANGO_TYPE_STYLE, "PANGO_");
284
+
285
+ /* PangoWeight */
286
+ G_DEF_CLASS(PANGO_TYPE_WEIGHT, "Weight", pFontDesc);
287
+ G_DEF_CONSTANTS(pFontDesc, PANGO_TYPE_WEIGHT, "PANGO_");
288
+
289
+ /* PangoVariant */
290
+ G_DEF_CLASS(PANGO_TYPE_VARIANT, "Variant", pFontDesc);
291
+ G_DEF_CONSTANTS(pFontDesc, PANGO_TYPE_VARIANT, "PANGO_");
292
+
293
+ /* PangoStretch */
294
+ G_DEF_CLASS(PANGO_TYPE_STRETCH, "Stretch", pFontDesc);
295
+ G_DEF_CONSTANTS(pFontDesc, PANGO_TYPE_STRETCH, "PANGO_");
296
+
297
+ /* PangoFontMask */
298
+ G_DEF_CLASS(PANGO_TYPE_FONT_MASK, "FontMask", pFontDesc);
299
+ G_DEF_CONSTANTS(pFontDesc, PANGO_TYPE_FONT_MASK, "PANGO_");
300
+ }