pango 3.1.6 → 3.1.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13b47705e3fbee25a3a17f088c190dd2175077bc
4
- data.tar.gz: 80b49ed0fe185132b544ef6dd9c903f611117509
3
+ metadata.gz: 13aec0addeeddca2d47c77c24525a916e70d3ba2
4
+ data.tar.gz: bc72ac66cb33eb742d588023522c98e0ed1dd5aa
5
5
  SHA512:
6
- metadata.gz: 38c50ec51ab76398e2dd4450cde1c36b19ab8f2ab7ac68d3bda375a60144a8d44971e75d1c20f4d867eb6f7ba32b6ac6c08d2395719c56b42971915842f8c016
7
- data.tar.gz: 9c0a8d0209b9d2678b8d870d8556fb3ca51cd0b0d4fa060c1f0b89d17ede6088e3404f7d4086501b94fde3a2c795c11e671fc65dae7b321efb2236569990d9b6
6
+ metadata.gz: 606469bd983e8a30e5560289b45ae145223ca793cf59f4652635738901ff9e209bf89120b682e4ea42947e6babc5f31ed813016110a4188b01b62928d867db36
7
+ data.tar.gz: fd93e8a06ade62dc87a8944c63172b5e6e6b91ca36e6cc378b32baa251dfccc0e7a33e1b7dc3903551dfaf6b8ed025d5afdd537ecb0374850d22e5fae88f1bc2
data/Rakefile CHANGED
@@ -91,7 +91,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
91
91
  :name => "pango",
92
92
  :download_site => :gnome,
93
93
  :label => "Pango",
94
- :version => "1.40.5",
94
+ :version => "1.40.6",
95
95
  :compression_method => "xz",
96
96
  :windows => {
97
97
  :configure_args => [
@@ -1,2 +1,3 @@
1
1
  EXPORTS
2
2
  Init_pango
3
+ pango_attr_list_get_type
@@ -0,0 +1,60 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2017 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 "rb-pango-private.h"
22
+
23
+ #define RG_TARGET_NAMESPACE cAttrIterator
24
+ #define _SELF(self) (RVAL2PANGOATTRITERATOR(self))
25
+
26
+ G_DEFINE_BOXED_TYPE(PangoAttrIterator,
27
+ pango_attr_iterator,
28
+ pango_attr_iterator_copy,
29
+ pango_attr_iterator_destroy);
30
+
31
+ static VALUE
32
+ rg_attrs(VALUE self)
33
+ {
34
+ GSList *attrs;
35
+ GSList *node;
36
+ VALUE rb_attrs;
37
+
38
+ attrs = pango_attr_iterator_get_attrs(_SELF(self));
39
+ rb_attrs = rb_ary_new();
40
+ for (node = attrs; node; node = g_slist_next(node)) {
41
+ PangoAttribute *attr = node->data;
42
+ VALUE rb_attr;
43
+
44
+ rb_attr = rbpango_attribute_to_ruby(attr);
45
+ rb_ary_push(rb_attrs, rb_attr);
46
+ }
47
+ g_slist_free(attrs);
48
+
49
+ return rb_attrs;
50
+ }
51
+
52
+ void
53
+ rbpango_attr_iterator_init(VALUE mPango)
54
+ {
55
+ VALUE RG_TARGET_NAMESPACE;
56
+
57
+ RG_TARGET_NAMESPACE =
58
+ G_DEF_CLASS(PANGO_TYPE_ATTR_ITERATOR, "AttrIterator", mPango);
59
+ RG_DEF_METHOD(attrs, 0);
60
+ }
@@ -52,6 +52,15 @@ rg_insert_before(VALUE self, VALUE rb_attribute)
52
52
  return self;
53
53
  }
54
54
 
55
+ static VALUE
56
+ rg_iterator(VALUE self)
57
+ {
58
+ PangoAttrIterator *iterator;
59
+
60
+ iterator = pango_attr_list_get_iterator(RVAL2PANGOATTRLIST(self));
61
+ return PANGOATTRITERATOR2RVAL(iterator);
62
+ }
63
+
55
64
  void
56
65
  rbpango_attr_list_init(VALUE mPango)
57
66
  {
@@ -61,4 +70,5 @@ rbpango_attr_list_init(VALUE mPango)
61
70
 
62
71
  RG_DEF_METHOD(insert, 1);
63
72
  RG_DEF_METHOD(insert_before, 1);
73
+ RG_DEF_METHOD(iterator, 0);
64
74
  }
@@ -20,12 +20,150 @@
20
20
 
21
21
  #include "rb-pango-private.h"
22
22
 
23
+ VALUE
24
+ rbpango_attribute_to_ruby(PangoAttribute *attribute)
25
+ {
26
+ VALUE rb_attr_type;
27
+ ID id_to_class;
28
+ VALUE klass;
29
+
30
+ rb_attr_type = GENUM2RVAL(attribute->klass->type, PANGO_TYPE_ATTR_TYPE);
31
+ CONST_ID(id_to_class, "to_class");
32
+ klass = rb_funcall(rb_attr_type, id_to_class, 0);
33
+ return Data_Wrap_Struct(klass,
34
+ NULL,
35
+ pango_attribute_destroy,
36
+ pango_attribute_copy(attribute));
37
+ }
38
+
39
+ PangoAttribute *
40
+ rbpango_attribute_from_ruby(VALUE rb_attribute)
41
+ {
42
+ PangoAttribute *attribute;
43
+
44
+ Data_Get_Struct(rb_attribute, PangoAttribute, attribute);
45
+
46
+ return attribute;
47
+ }
48
+
23
49
  static VALUE
24
50
  rbpango_attribute_allocate(VALUE klass)
25
51
  {
26
52
  return Data_Wrap_Struct(klass, NULL, pango_attribute_destroy, 0);
27
53
  }
28
54
 
55
+ static VALUE
56
+ rbpango_attr_bool_get_value(VALUE self)
57
+ {
58
+ PangoAttribute *attribute;
59
+
60
+ attribute = rbpango_attribute_from_ruby(self);
61
+
62
+ return CBOOL2RVAL(((PangoAttrInt *)attribute)->value);
63
+ }
64
+
65
+ static VALUE
66
+ rbpango_attr_language_initialize(VALUE self, VALUE rb_language)
67
+ {
68
+ PangoLanguage *language;
69
+
70
+ language = RVAL2PANGOLANGUAGE(rb_language);
71
+ DATA_PTR(self) = pango_attr_language_new(language);
72
+
73
+ return Qnil;
74
+ }
75
+
76
+ static VALUE
77
+ rbpango_attr_family_initialize(VALUE self, VALUE rb_family)
78
+ {
79
+ DATA_PTR(self) = pango_attr_family_new(RVAL2CSTR(rb_family));
80
+
81
+ return Qnil;
82
+ }
83
+
84
+ static VALUE
85
+ rbpango_attr_style_initialize(VALUE self, VALUE rb_style)
86
+ {
87
+ DATA_PTR(self) = pango_attr_style_new(RVAL2PANGOSTYLE(rb_style));
88
+
89
+ return Qnil;
90
+ }
91
+
92
+ static VALUE
93
+ rbpango_attr_style_get_value(VALUE self)
94
+ {
95
+ PangoAttribute *attribute;
96
+
97
+ attribute = rbpango_attribute_from_ruby(self);
98
+
99
+ return PANGOSTYLE2RVAL(((PangoAttrInt *)attribute)->value);
100
+ }
101
+
102
+ static VALUE
103
+ rbpango_attr_weight_initialize(VALUE self, VALUE rb_weight)
104
+ {
105
+ DATA_PTR(self) = pango_attr_weight_new(RVAL2PANGOWEIGHT(rb_weight));
106
+
107
+ return Qnil;
108
+ }
109
+
110
+ static VALUE
111
+ rbpango_attr_weight_get_value(VALUE self)
112
+ {
113
+ PangoAttribute *attribute;
114
+
115
+ attribute = rbpango_attribute_from_ruby(self);
116
+
117
+ return PANGOWEIGHT2RVAL(((PangoAttrInt *)attribute)->value);
118
+ }
119
+
120
+ static VALUE
121
+ rbpango_attr_variant_initialize(VALUE self, VALUE rb_variant)
122
+ {
123
+ DATA_PTR(self) = pango_attr_variant_new(RVAL2PANGOVARIANT(rb_variant));
124
+
125
+ return Qnil;
126
+ }
127
+
128
+ static VALUE
129
+ rbpango_attr_variant_get_value(VALUE self)
130
+ {
131
+ PangoAttribute *attribute;
132
+
133
+ attribute = rbpango_attribute_from_ruby(self);
134
+
135
+ return PANGOVARIANT2RVAL(((PangoAttrInt *)attribute)->value);
136
+ }
137
+
138
+ static VALUE
139
+ rbpango_attr_stretch_initialize(VALUE self, VALUE rb_stretch)
140
+ {
141
+ DATA_PTR(self) = pango_attr_stretch_new(RVAL2PANGOSTRETCH(rb_stretch));
142
+
143
+ return Qnil;
144
+ }
145
+
146
+ static VALUE
147
+ rbpango_attr_stretch_get_value(VALUE self)
148
+ {
149
+ PangoAttribute *attribute;
150
+
151
+ attribute = rbpango_attribute_from_ruby(self);
152
+
153
+ return PANGOSTRETCH2RVAL(((PangoAttrInt *)attribute)->value);
154
+ }
155
+
156
+ static VALUE
157
+ rbpango_attr_size_initialize(VALUE self, VALUE rb_size)
158
+ {
159
+ gint size;
160
+
161
+ size = NUM2INT(rb_size);
162
+ DATA_PTR(self) = pango_attr_size_new(size);
163
+
164
+ return Qnil;
165
+ }
166
+
29
167
  static VALUE
30
168
  rbpango_attr_font_desc_initialize(VALUE self, VALUE rb_font_desc)
31
169
  {
@@ -48,20 +186,61 @@ rbpango_attr_font_desc_initialize(VALUE self, VALUE rb_font_desc)
48
186
  }
49
187
 
50
188
  static VALUE
51
- rbpango_attr_font_features_initialize(VALUE self, VALUE rb_font_features)
189
+ rbpango_attr_foregound_initialize(VALUE self,
190
+ VALUE rb_red,
191
+ VALUE rb_green,
192
+ VALUE rb_blue)
52
193
  {
53
- DATA_PTR(self) = pango_attr_font_features_new(RVAL2CSTR(rb_font_features));
194
+ DATA_PTR(self) = pango_attr_foreground_new(NUM2UINT(rb_red),
195
+ NUM2UINT(rb_green),
196
+ NUM2UINT(rb_blue));
54
197
 
55
198
  return Qnil;
56
199
  }
57
200
 
58
201
  static VALUE
59
- rbpango_attr_language_initialize(VALUE self, VALUE rb_language)
202
+ rbpango_attr_background_initialize(VALUE self,
203
+ VALUE rb_red,
204
+ VALUE rb_green,
205
+ VALUE rb_blue)
60
206
  {
61
- PangoLanguage *language;
207
+ DATA_PTR(self) = pango_attr_background_new(NUM2UINT(rb_red),
208
+ NUM2UINT(rb_green),
209
+ NUM2UINT(rb_blue));
62
210
 
63
- language = RVAL2PANGOLANGUAGE(rb_language);
64
- DATA_PTR(self) = pango_attr_language_new(language);
211
+ return Qnil;
212
+ }
213
+
214
+ static VALUE
215
+ rbpango_attr_underline_initialize(VALUE self, VALUE rb_underline)
216
+ {
217
+ DATA_PTR(self) = pango_attr_underline_new(RVAL2PANGOUNDERLINE(rb_underline));
218
+
219
+ return Qnil;
220
+ }
221
+
222
+ static VALUE
223
+ rbpango_attr_underline_get_value(VALUE self)
224
+ {
225
+ PangoAttribute *attribute;
226
+
227
+ attribute = rbpango_attribute_from_ruby(self);
228
+
229
+ return PANGOUNDERLINE2RVAL(((PangoAttrInt *)attribute)->value);
230
+ }
231
+
232
+ static VALUE
233
+ rbpango_attr_strikethrough_initialize(VALUE self, VALUE rb_strikethrough)
234
+ {
235
+ DATA_PTR(self) = pango_attr_strikethrough_new(RVAL2CBOOL(rb_strikethrough));
236
+
237
+ return Qnil;
238
+ }
239
+
240
+ static VALUE
241
+ rbpango_attr_rise_initialize(VALUE self, VALUE rb_rise)
242
+ {
243
+ DATA_PTR(self) = pango_attr_rise_new(NUM2INT(rb_rise));
65
244
 
66
245
  return Qnil;
67
246
  }
@@ -102,17 +281,126 @@ rbpango_attr_shape_get_data(VALUE self)
102
281
 
103
282
  Data_Get_Struct(self, PangoAttrShape, attr_shape);
104
283
  rb_data = (VALUE)(attr_shape->data);
105
- rb_p(rb_data);
106
284
  return rb_data;
107
285
  }
108
286
 
109
287
  static VALUE
110
- rbpango_attr_size_initialize(VALUE self, VALUE rb_size)
288
+ rbpango_attr_scale_initialize(VALUE self, VALUE rb_scale)
111
289
  {
112
- gint size;
290
+ DATA_PTR(self) = pango_attr_scale_new(NUM2DBL(rb_scale));
113
291
 
114
- size = NUM2INT(rb_size);
115
- DATA_PTR(self) = pango_attr_size_new(size);
292
+ return Qnil;
293
+ }
294
+
295
+ static VALUE
296
+ rbpango_attr_fallback_initialize(VALUE self, VALUE rb_enable_fallback)
297
+ {
298
+ DATA_PTR(self) = pango_attr_fallback_new(RVAL2CBOOL(rb_enable_fallback));
299
+
300
+ return Qnil;
301
+ }
302
+
303
+ static VALUE
304
+ rbpango_attr_letter_spacing_initialize(VALUE self, VALUE rb_letter_spacing)
305
+ {
306
+ DATA_PTR(self) = pango_attr_letter_spacing_new(NUM2INT(rb_letter_spacing));
307
+
308
+ return Qnil;
309
+ }
310
+
311
+ static VALUE
312
+ rbpango_attr_underline_color_initialize(VALUE self,
313
+ VALUE rb_red,
314
+ VALUE rb_green,
315
+ VALUE rb_blue)
316
+ {
317
+ DATA_PTR(self) = pango_attr_underline_color_new(NUM2UINT(rb_red),
318
+ NUM2UINT(rb_green),
319
+ NUM2UINT(rb_blue));
320
+
321
+ return Qnil;
322
+ }
323
+
324
+ static VALUE
325
+ rbpango_attr_strikethrough_color_initialize(VALUE self,
326
+ VALUE rb_red,
327
+ VALUE rb_green,
328
+ VALUE rb_blue)
329
+ {
330
+ DATA_PTR(self) = pango_attr_strikethrough_color_new(NUM2UINT(rb_red),
331
+ NUM2UINT(rb_green),
332
+ NUM2UINT(rb_blue));
333
+
334
+ return Qnil;
335
+ }
336
+
337
+ static VALUE
338
+ rbpango_attr_absolute_size_initialize(VALUE self, VALUE rb_absolute_size)
339
+ {
340
+ DATA_PTR(self) = pango_attr_size_new_absolute(NUM2INT(rb_absolute_size));
341
+
342
+ return Qnil;
343
+ }
344
+
345
+ static VALUE
346
+ rbpango_attr_gravity_initialize(VALUE self, VALUE rb_gravity)
347
+ {
348
+ DATA_PTR(self) = pango_attr_gravity_new(RVAL2PANGOGRAVITY(rb_gravity));
349
+
350
+ return Qnil;
351
+ }
352
+
353
+ static VALUE
354
+ rbpango_attr_gravity_get_value(VALUE self)
355
+ {
356
+ PangoAttribute *attribute;
357
+
358
+ attribute = rbpango_attribute_from_ruby(self);
359
+
360
+ return PANGOGRAVITY2RVAL(((PangoAttrInt *)attribute)->value);
361
+ }
362
+
363
+ static VALUE
364
+ rbpango_attr_gravity_hint_initialize(VALUE self, VALUE rb_gravity_hint)
365
+ {
366
+ PangoGravityHint hint;
367
+
368
+ hint = RVAL2PANGOGRAVITYHINT(rb_gravity_hint);
369
+ DATA_PTR(self) = pango_attr_gravity_hint_new(hint);
370
+
371
+ return Qnil;
372
+ }
373
+
374
+ static VALUE
375
+ rbpango_attr_gravity_hint_get_value(VALUE self)
376
+ {
377
+ PangoAttribute *attribute;
378
+
379
+ attribute = rbpango_attribute_from_ruby(self);
380
+
381
+ return PANGOGRAVITYHINT2RVAL(((PangoAttrInt *)attribute)->value);
382
+ }
383
+
384
+ static VALUE
385
+ rbpango_attr_font_features_initialize(VALUE self, VALUE rb_font_features)
386
+ {
387
+ DATA_PTR(self) = pango_attr_font_features_new(RVAL2CSTR(rb_font_features));
388
+
389
+ return Qnil;
390
+ }
391
+
392
+ static VALUE
393
+ rbpango_attr_foreground_alpha_initialize(VALUE self, VALUE rb_alpha)
394
+ {
395
+ DATA_PTR(self) = pango_attr_foreground_alpha_new(NUM2UINT(rb_alpha));
396
+
397
+ return Qnil;
398
+ }
399
+
400
+ static VALUE
401
+ rbpango_attr_background_alpha_initialize(VALUE self, VALUE rb_alpha)
402
+ {
403
+ DATA_PTR(self) = pango_attr_background_alpha_new(NUM2UINT(rb_alpha));
116
404
 
117
405
  return Qnil;
118
406
  }
@@ -121,45 +409,136 @@ void
121
409
  rbpango_attribute_init(VALUE mPango)
122
410
  {
123
411
  VALUE cAttribute;
412
+ VALUE cAttrString;
413
+ VALUE cAttrColor;
414
+ VALUE cAttrInt;
415
+ VALUE cAttrBool;
416
+ VALUE cAttrFloat;
417
+ VALUE cAttrLanguage;
418
+ VALUE cAttrFamily;
419
+ VALUE cAttrStyle;
420
+ VALUE cAttrWeight;
421
+ VALUE cAttrVariant;
422
+ VALUE cAttrStretch;
423
+ VALUE cAttrSize;
424
+ VALUE cAttrFontDesc;
425
+ VALUE cAttrForeground;
426
+ VALUE cAttrBackground;
427
+ VALUE cAttrUnderline;
428
+ VALUE cAttrStrikethrough;
429
+ VALUE cAttrRise;
430
+ VALUE cAttrShape;
431
+ VALUE cAttrScale;
432
+ VALUE cAttrFallback;
433
+ VALUE cAttrLetterSpacing;
434
+ VALUE cAttrUnderlineColor;
435
+ VALUE cAttrStrikethroughColor;
436
+ VALUE cAttrAbsoluteSize;
437
+ VALUE cAttrGravity;
438
+ VALUE cAttrGravityHint;
439
+ VALUE cAttrFontFeatures;
440
+ VALUE cAttrForegroundAlpha;
441
+ VALUE cAttrBackgroundAlpha;
124
442
 
125
443
  cAttribute = rb_define_class_under(mPango, "Attribute", rb_cData);
126
444
  rb_define_alloc_func(cAttribute, rbpango_attribute_allocate);
127
445
 
128
- #define DEFINE_ABSTRACT_ATTRIBUTE(ClassName) \
129
- do { \
130
- rb_define_class_under(mPango, \
131
- #ClassName, \
132
- cAttribute); \
446
+ #define DEFINE_ABSTRACT_ATTRIBUTE_BEGIN(ClassName, parent) do { \
447
+ c ## ClassName = rb_define_class_under(mPango, \
448
+ #ClassName, \
449
+ parent);
450
+
451
+ #define DEFINE_ABSTRACT_ATTRIBUTE_END() \
133
452
  } while (FALSE)
134
453
 
135
- #define DEFINE_ATTRIBUTE_BEGIN(ClassName, method_name, n_initialize_args) \
136
- VALUE c ## ClassName; \
454
+ #define DEFINE_ABSTRACT_ATTRIBUTE(ClassName, parent) \
455
+ DEFINE_ABSTRACT_ATTRIBUTE_BEGIN(ClassName, parent) { \
456
+ } DEFINE_ABSTRACT_ATTRIBUTE_END()
457
+
458
+ #define DEFINE_ATTRIBUTE_BEGIN(ClassName, \
459
+ parent, \
460
+ method_name, \
461
+ n_initialize_args) do { \
137
462
  c ## ClassName = rb_define_class_under(mPango, \
138
463
  #ClassName, \
139
- cAttribute); \
464
+ parent); \
140
465
  rb_define_method(c ## ClassName, "initialize", \
141
466
  rbpango_ ## method_name ## _initialize, \
142
467
  n_initialize_args); \
143
468
 
144
- #define DEFINE_ATTRIBUTE_END \
469
+ #define DEFINE_ATTRIBUTE_END() \
470
+ } while (FALSE)
471
+
472
+ #define DEFINE_ATTRIBUTE(ClassName, \
473
+ parent, \
474
+ method_name, \
475
+ n_initialize_args) \
476
+ DEFINE_ATTRIBUTE_BEGIN(ClassName, \
477
+ parent, \
478
+ method_name, \
479
+ n_initialize_args) { \
480
+ } DEFINE_ATTRIBUTE_END();
145
481
 
146
- #define DEFINE_ATTRIBUTE(ClassName, method_name, n_initialize_args) \
147
- DEFINE_ATTRIBUTE_BEGIN(ClassName, method_name, n_initialize_args) { \
148
- } DEFINE_ATTRIBUTE_END;
482
+ DEFINE_ABSTRACT_ATTRIBUTE(AttrString, cAttribute);
483
+ DEFINE_ABSTRACT_ATTRIBUTE(AttrColor, cAttribute);
484
+ DEFINE_ABSTRACT_ATTRIBUTE(AttrInt, cAttribute);
485
+ DEFINE_ABSTRACT_ATTRIBUTE_BEGIN(AttrBool, cAttrInt) {
486
+ rb_define_method(cAttrBool, "value", rbpango_attr_bool_get_value, 0);
487
+ } DEFINE_ABSTRACT_ATTRIBUTE_END();
488
+ DEFINE_ABSTRACT_ATTRIBUTE(AttrFloat, cAttribute);
149
489
 
150
- DEFINE_ABSTRACT_ATTRIBUTE(AttrBool);
151
- DEFINE_ABSTRACT_ATTRIBUTE(AttrColor);
152
- DEFINE_ABSTRACT_ATTRIBUTE(AttrFloat);
153
- DEFINE_ATTRIBUTE(AttrFontDesc, attr_font_desc, 1);
154
- DEFINE_ATTRIBUTE(AttrFontFeatures, attr_font_features, 1);
155
- DEFINE_ABSTRACT_ATTRIBUTE(AttrInt);
156
- DEFINE_ATTRIBUTE(AttrLanguage, attr_language, 1);
157
- DEFINE_ATTRIBUTE_BEGIN(AttrShape, attr_shape, -1) {
490
+ DEFINE_ATTRIBUTE(AttrLanguage, cAttribute, attr_language, 1);
491
+ DEFINE_ATTRIBUTE(AttrFamily, cAttrString, attr_family, 1);
492
+ DEFINE_ATTRIBUTE_BEGIN(AttrStyle, cAttrInt, attr_style, 1) {
493
+ rb_define_method(cAttrStyle, "value", rbpango_attr_style_get_value, 0);
494
+ } DEFINE_ATTRIBUTE_END();
495
+ DEFINE_ATTRIBUTE_BEGIN(AttrWeight, cAttrInt, attr_weight, 1) {
496
+ rb_define_method(cAttrWeight, "value", rbpango_attr_weight_get_value, 0);
497
+ } DEFINE_ATTRIBUTE_END();
498
+ DEFINE_ATTRIBUTE_BEGIN(AttrVariant, cAttrInt, attr_variant, 1) {
499
+ rb_define_method(cAttrVariant,
500
+ "value", rbpango_attr_variant_get_value, 0);
501
+ } DEFINE_ATTRIBUTE_END();
502
+ DEFINE_ATTRIBUTE_BEGIN(AttrStretch, cAttrInt, attr_stretch, 1) {
503
+ rb_define_method(cAttrStretch,
504
+ "value", rbpango_attr_stretch_get_value, 0);
505
+ } DEFINE_ATTRIBUTE_END();
506
+ DEFINE_ATTRIBUTE(AttrSize, cAttribute, attr_size, 1);
507
+ DEFINE_ATTRIBUTE(AttrFontDesc, cAttribute, attr_font_desc, 1);
508
+ DEFINE_ATTRIBUTE(AttrForeground, cAttrColor, attr_foregound, 3);
509
+ DEFINE_ATTRIBUTE(AttrBackground, cAttrColor, attr_background, 3);
510
+ DEFINE_ATTRIBUTE_BEGIN(AttrUnderline, cAttrInt, attr_underline, 1) {
511
+ rb_define_method(cAttrUnderline,
512
+ "value", rbpango_attr_underline_get_value, 0);
513
+ } DEFINE_ATTRIBUTE_END();
514
+ DEFINE_ATTRIBUTE(AttrStrikethrough, cAttrBool, attr_strikethrough, 1);
515
+ DEFINE_ATTRIBUTE(AttrRise, cAttrInt, attr_rise, 1);
516
+ DEFINE_ATTRIBUTE_BEGIN(AttrShape, cAttribute, attr_shape, -1) {
158
517
  rb_define_method(cAttrShape, "data", rbpango_attr_shape_get_data, 0);
159
- } DEFINE_ATTRIBUTE_END;
160
- DEFINE_ATTRIBUTE(AttrSize, attr_size, 1);
161
- DEFINE_ABSTRACT_ATTRIBUTE(AttrString);
518
+ } DEFINE_ATTRIBUTE_END();
519
+ DEFINE_ATTRIBUTE(AttrScale, cAttrFloat, attr_scale, 1);
520
+ DEFINE_ATTRIBUTE(AttrFallback, cAttrBool, attr_fallback, 1);
521
+ DEFINE_ATTRIBUTE(AttrLetterSpacing, cAttrInt, attr_letter_spacing, 1);
522
+ DEFINE_ATTRIBUTE(AttrUnderlineColor, cAttrColor, attr_underline_color, 3);
523
+ DEFINE_ATTRIBUTE(AttrStrikethroughColor, cAttrColor,
524
+ attr_strikethrough_color, 3);
525
+ DEFINE_ATTRIBUTE(AttrAbsoluteSize, cAttrSize, attr_absolute_size, 1);
526
+ DEFINE_ATTRIBUTE_BEGIN(AttrGravity, cAttrInt, attr_gravity, 1) {
527
+ rb_define_method(cAttrGravity,
528
+ "value", rbpango_attr_gravity_get_value, 0);
529
+ } DEFINE_ATTRIBUTE_END();
530
+ DEFINE_ATTRIBUTE_BEGIN(AttrGravityHint, cAttrInt, attr_gravity_hint, 1) {
531
+ rb_define_method(cAttrGravityHint,
532
+ "value", rbpango_attr_gravity_hint_get_value, 0);
533
+ } DEFINE_ATTRIBUTE_END();
534
+ DEFINE_ATTRIBUTE(AttrFontFeatures, cAttrString, attr_font_features, 1);
535
+ DEFINE_ATTRIBUTE(AttrForegroundAlpha, cAttrInt, attr_foreground_alpha, 1);
536
+ DEFINE_ATTRIBUTE(AttrBackgroundAlpha, cAttrInt, attr_background_alpha, 1);
162
537
 
163
538
  #undef DEFINE_ABSTRACT_ATTRIBUTE
539
+ #undef DEFINE_ABSTRACT_ATTRIBUTE_BEGIN
540
+ #undef DEFINE_ABSTRACT_ATTRIBUTE_END
164
541
  #undef DEFINE_ATTRIBUTE
542
+ #undef DEFINE_ATTRIBUTE_BEGIN
543
+ #undef DEFINE_ATTRIBUTE_END
165
544
  }
@@ -20,6 +20,15 @@
20
20
 
21
21
  #pragma once
22
22
 
23
+ #define PANGO_TYPE_ATTR_ITERATOR pango_attr_iterator_get_type()
24
+ extern GType pango_attr_iterator_get_type(void) G_GNUC_CONST;
25
+
26
+ extern VALUE rbpango_attribute_to_ruby(PangoAttribute *attribute);
27
+ extern PangoAttribute *rbpango_attribute_from_ruby(VALUE rb_attribute);
28
+
29
+ #define ATTR2RVAL(attr) (rbpango_attribute_to_ruby((attr)))
30
+ #define RVAL2ATTR(rb_attr) (rbpango_attribute_from_ruby((rb_attr)))
31
+
23
32
  #define RVAL2PANGOCAIROFONTMAP(o) (PANGO_CAIRO_FONT_MAP(RVAL2GOBJ(o)))
24
33
  #define RVAL2PANGOCONTEXT(o) (PANGO_CONTEXT(RVAL2GOBJ(o)))
25
34
  #define RVAL2PANGOENGINE(o) (PANGO_ENGINE(RVAL2GOBJ(o)))
@@ -23,5 +23,7 @@
23
23
  #include "rb-pango.h"
24
24
 
25
25
  G_GNUC_INTERNAL void rbpango_attribute_init(VALUE mPango);
26
+ G_GNUC_INTERNAL void rbpango_attr_iterator_init(VALUE mPango);
26
27
  G_GNUC_INTERNAL void rbpango_attr_list_init(VALUE mPango);
27
28
  G_GNUC_INTERNAL void rbpango_context_init(VALUE mPango);
29
+ G_GNUC_INTERNAL void rbpango_scale_init(VALUE mPango);
@@ -0,0 +1,53 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2017 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 "rb-pango-private.h"
22
+
23
+ #define RG_TARGET_NAMESPACE mScale
24
+
25
+ void
26
+ rbpango_scale_init(VALUE mPango)
27
+ {
28
+ VALUE RG_TARGET_NAMESPACE;
29
+
30
+ RG_TARGET_NAMESPACE = rb_define_module_under(mPango, "Scale");
31
+
32
+ rb_define_const(RG_TARGET_NAMESPACE,
33
+ "XX_SMALL",
34
+ rb_float_new(PANGO_SCALE_XX_SMALL));
35
+ rb_define_const(RG_TARGET_NAMESPACE,
36
+ "X_SMALL",
37
+ rb_float_new(PANGO_SCALE_X_SMALL));
38
+ rb_define_const(RG_TARGET_NAMESPACE,
39
+ "SMALL",
40
+ rb_float_new(PANGO_SCALE_SMALL));
41
+ rb_define_const(RG_TARGET_NAMESPACE,
42
+ "MEDIUM",
43
+ rb_float_new(PANGO_SCALE_MEDIUM));
44
+ rb_define_const(RG_TARGET_NAMESPACE,
45
+ "LARGE",
46
+ rb_float_new(PANGO_SCALE_LARGE));
47
+ rb_define_const(RG_TARGET_NAMESPACE,
48
+ "X_LARGE",
49
+ rb_float_new(PANGO_SCALE_X_LARGE));
50
+ rb_define_const(RG_TARGET_NAMESPACE,
51
+ "XX_LARGE",
52
+ rb_float_new(PANGO_SCALE_XX_LARGE));
53
+ }
@@ -38,6 +38,8 @@ Init_pango(void)
38
38
  RG_DEF_SMETHOD(pixels, 1);
39
39
 
40
40
  rbpango_attribute_init(RG_TARGET_NAMESPACE);
41
+ rbpango_attr_iterator_init(RG_TARGET_NAMESPACE);
41
42
  rbpango_attr_list_init(RG_TARGET_NAMESPACE);
42
43
  rbpango_context_init(RG_TARGET_NAMESPACE);
44
+ rbpango_scale_init(RG_TARGET_NAMESPACE);
43
45
  }
@@ -0,0 +1,27 @@
1
+ # Copyright (C) 2017 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Pango
18
+ class AttrType
19
+ def to_class
20
+ class_name = "Attr"
21
+ nick.split(/_/).each do |component|
22
+ class_name << component.capitalize
23
+ end
24
+ Pango.const_get(class_name)
25
+ end
26
+ end
27
+ end
@@ -18,19 +18,52 @@ module Pango
18
18
  extend GLib::Deprecatable
19
19
 
20
20
  define_deprecated_enums :Alignment, "ALIGN"
21
+ define_deprecated_enums :Alignment
21
22
  define_deprecated_enums :CoverageLevel, "COVERAGE"
23
+ define_deprecated_enums :CoverageLevel
22
24
  define_deprecated_enums :Direction, "DIRECTION"
25
+ define_deprecated_enums :Direction
23
26
  define_deprecated_enums :WrapMode, "WRAP"
27
+ define_deprecated_enums :WrapMode
24
28
  define_deprecated_enums :FontMask, "FONT_MASK"
29
+ define_deprecated_enums :FontMask
25
30
  define_deprecated_enums :Stretch, "STRETCH"
31
+ define_deprecated_enums :Stretch
26
32
  define_deprecated_enums :Style, "STYLE"
33
+ define_deprecated_enums :Style
27
34
  define_deprecated_enums :Variant, "VARIANT"
35
+ define_deprecated_enums :Variant
28
36
  define_deprecated_enums :Weight, "WEIGHT"
37
+ define_deprecated_enums :Weight
29
38
  define_deprecated_enums :TabAlign, "TAB"
39
+ define_deprecated_enums :TabAlign
30
40
  define_deprecated_enums :Underline, "UNDERLINE"
41
+ define_deprecated_enums :Underline
42
+ define_deprecated_const :UNDERLINE, "Pango::Underline"
31
43
  define_deprecated_enums :Script, "SCRIPT"
44
+ define_deprecated_enums :Script
32
45
  define_deprecated_enums :EllipsizeMode, "ELLIPSIZE"
46
+ define_deprecated_enums :EllipsizeMode
33
47
  define_deprecated_enums :RenderPart, "PART"
48
+ define_deprecated_enums :RenderPart
49
+
50
+ class AttrScale
51
+ extend GLib::Deprecatable
52
+
53
+ define_deprecated_const :XX_SMALL, "Pango::Scale::XX_SMALL"
54
+ define_deprecated_const :X_SMALL, "Pango::Scale::X_SMALL"
55
+ define_deprecated_const :SMALL, "Pango::Scale::SMALL"
56
+ define_deprecated_const :MEDIUM, "Pango::Scale::MEDIUM"
57
+ define_deprecated_const :LARGE, "Pango::Scale::LARGE"
58
+ define_deprecated_const :X_LARGE, "Pango::Scale::X_LARGE"
59
+ define_deprecated_const :XX_LARGE, "Pango::Scale::XX_LARGE"
60
+ end
61
+
62
+ class AttrUnderline
63
+ extend GLib::Deprecatable
64
+
65
+ define_deprecated_enums :Underline
66
+ end
34
67
 
35
68
  class Context
36
69
  extend GLib::Deprecatable
@@ -36,14 +36,8 @@ module Pango
36
36
  case info.name
37
37
  when /Class\z/
38
38
  super
39
- when "Attribute"
39
+ when "Attribute", /\AAttr[A-Z]/
40
40
  @pending_attribute_infos << info
41
- when /\AAttr[A-Z]/
42
- if info.name == "AttrIterator"
43
- super
44
- else
45
- @pending_attribute_infos << info
46
- end
47
41
  else
48
42
  super
49
43
  end
@@ -64,7 +58,7 @@ module Pango
64
58
  when "translate", "scale", "rotate", "concat"
65
59
  method_name += "!"
66
60
  end
67
- when "Pango::AttrList"
61
+ when "Pango::AttrList", "Pango::AttrIterator"
68
62
  return if klass.method_defined?(method_name)
69
63
  end
70
64
  super(info, klass, method_name)
@@ -80,6 +74,7 @@ module Pango
80
74
  end
81
75
 
82
76
  def require_libraries
77
+ require "pango/attr-type"
83
78
  require "pango/color"
84
79
  require "pango/font-description"
85
80
  require "pango/language"
@@ -0,0 +1,36 @@
1
+ # Copyright (C) 2017 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestAttrIterator < Test::Unit::TestCase
18
+ include PangoTestUtils
19
+
20
+ def setup
21
+ attrs, = Pango.parse_markup("Hello <b>world</b>!")
22
+ @iterator = attrs.iterator
23
+ end
24
+
25
+ def test_attrs
26
+ @iterator.next
27
+ indexes = @iterator.attrs.collect do |attr|
28
+ [
29
+ attr.start_index,
30
+ attr.end_index,
31
+ attr.value,
32
+ ]
33
+ end
34
+ assert_equal([[6, 11, Pango::Weight::BOLD]], indexes)
35
+ end
36
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pango
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.6
4
+ version: 3.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME2 Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-03 00:00:00.000000000 Z
11
+ date: 2017-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cairo
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.1.6
33
+ version: 3.1.7
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.1.6
40
+ version: 3.1.7
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: gobject-introspection
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 3.1.6
47
+ version: 3.1.7
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 3.1.6
54
+ version: 3.1.7
55
55
  description: Ruby/Pango is a Ruby binding of pango-1.x.
56
56
  email: ruby-gnome2-devel-en@lists.sourceforge.net
57
57
  executables: []
@@ -63,15 +63,18 @@ files:
63
63
  - ext/pango/depend
64
64
  - ext/pango/extconf.rb
65
65
  - ext/pango/pango.def
66
+ - ext/pango/rb-pango-attr-iterator.c
66
67
  - ext/pango/rb-pango-attr-list.c
67
68
  - ext/pango/rb-pango-attribute.c
68
69
  - ext/pango/rb-pango-context.c
69
70
  - ext/pango/rb-pango-conversions.h
70
71
  - ext/pango/rb-pango-private.h
72
+ - ext/pango/rb-pango-scale.c
71
73
  - ext/pango/rb-pango.c
72
74
  - ext/pango/rb-pango.h
73
75
  - extconf.rb
74
76
  - lib/pango.rb
77
+ - lib/pango/attr-type.rb
75
78
  - lib/pango/cairo-loader.rb
76
79
  - lib/pango/color.rb
77
80
  - lib/pango/deprecated.rb
@@ -86,6 +89,7 @@ files:
86
89
  - test/pango-test-utils.rb
87
90
  - test/run-test.rb
88
91
  - test/test-analysis.rb
92
+ - test/test-attr-iterator.rb
89
93
  - test/test-attr-list.rb
90
94
  - test/test-attribute.rb
91
95
  - test/test-color.rb