pango 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/pango/extconf.rb +3 -0
- data/ext/pango/rbpango.c +312 -12
- data/ext/pango/rbpango.h +33 -22
- data/ext/pango/rbpangoanalysis.c +98 -58
- data/ext/pango/rbpangoattribute.c +94 -85
- data/ext/pango/rbpangoattriterator.c +39 -28
- data/ext/pango/rbpangoattrlist.c +42 -32
- data/ext/pango/rbpangocairo.c +38 -172
- data/ext/pango/rbpangocairocontext.c +151 -0
- data/ext/pango/rbpangocolor.c +49 -38
- data/ext/pango/rbpangocontext.c +109 -102
- data/ext/pango/rbpangoconversions.h +111 -0
- data/ext/pango/rbpangocoverage.c +45 -37
- data/ext/pango/rbpangoengine.c +22 -12
- data/ext/pango/rbpangofont.c +52 -43
- data/ext/pango/rbpangofontdescription.c +102 -91
- data/ext/pango/rbpangofontface.c +32 -21
- data/ext/pango/rbpangofontfamily.c +31 -20
- data/ext/pango/rbpangofontmap.c +44 -36
- data/ext/pango/rbpangofontmetrics.c +41 -30
- data/ext/pango/rbpangofontset.c +32 -21
- data/ext/pango/rbpangofontsetsimple.c +34 -24
- data/ext/pango/rbpangoglyphinfo.c +48 -35
- data/ext/pango/rbpangoglyphitem.c +43 -33
- data/ext/pango/rbpangoglyphstring.c +59 -59
- data/ext/pango/rbpangogravity.c +34 -23
- data/ext/pango/rbpangoitem.c +43 -34
- data/ext/pango/rbpangolanguage.c +44 -34
- data/ext/pango/rbpangolayout.c +167 -160
- data/ext/pango/rbpangolayoutiter.c +70 -59
- data/ext/pango/rbpangolayoutline.c +106 -71
- data/ext/pango/rbpangologattr.c +42 -31
- data/ext/pango/rbpangomatrix.c +47 -35
- data/ext/pango/rbpangoprivate.h +53 -0
- data/ext/pango/rbpangorectangle.c +58 -49
- data/ext/pango/rbpangorenderer.c +81 -70
- data/ext/pango/rbpangoscript.c +37 -27
- data/ext/pango/rbpangoscriptiter.c +32 -22
- data/ext/pango/rbpangotabarray.c +48 -37
- metadata +12 -12
- data/ChangeLog +0 -721
- data/ext/pango/rbpangoinits.c +0 -72
- data/ext/pango/rbpangomain.c +0 -202
@@ -1,17 +1,29 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
+
*/
|
8
21
|
|
9
|
-
|
10
|
-
************************************************/
|
22
|
+
#include "rbpangoprivate.h"
|
11
23
|
|
12
|
-
#
|
24
|
+
#define RG_TARGET_NAMESPACE pattr
|
13
25
|
|
14
|
-
VALUE
|
26
|
+
VALUE RG_TARGET_NAMESPACE, attrstring, pattrint, pattrfloat, pattrcolor, pattrbool;
|
15
27
|
static VALUE type_to_klass;
|
16
28
|
|
17
29
|
/***********************************************/
|
@@ -29,7 +41,7 @@ pango_get_attribute_klass(VALUE attr_type)
|
|
29
41
|
if (TYPE(attr_type) == T_STRING){
|
30
42
|
const char *strtype = RVAL2CSTR(attr_type);
|
31
43
|
if (strcmp(strtype, "Attribute") == 0){
|
32
|
-
type =
|
44
|
+
type = RG_TARGET_NAMESPACE;
|
33
45
|
} else if (strcmp(strtype, "AttrString") == 0){
|
34
46
|
type = attrstring;
|
35
47
|
} else if (strcmp(strtype, "AttrInt") == 0){
|
@@ -63,7 +75,7 @@ pango_get_attribute(VALUE attr)
|
|
63
75
|
|
64
76
|
if (NIL_P(attr)) return NULL;
|
65
77
|
|
66
|
-
if (!rb_obj_is_kind_of(attr,
|
78
|
+
if (!rb_obj_is_kind_of(attr, RG_TARGET_NAMESPACE)) {
|
67
79
|
rb_raise(rb_eTypeError, "not a Pango::Attribute...");
|
68
80
|
}
|
69
81
|
Data_Get_Struct(attr, PangoAttribute, gattr);
|
@@ -72,7 +84,7 @@ pango_get_attribute(VALUE attr)
|
|
72
84
|
|
73
85
|
/***********************************************/
|
74
86
|
static VALUE
|
75
|
-
|
87
|
+
rg_s_allocate(VALUE klass)
|
76
88
|
{
|
77
89
|
/* Don't define destroy method here.
|
78
90
|
return Data_Wrap_Struct(klass, 0, pango_attribute_destroy, 0);
|
@@ -84,9 +96,9 @@ attr_s_allocate(VALUE klass)
|
|
84
96
|
#define attr_s_new rb_class_new_instance
|
85
97
|
#else
|
86
98
|
static VALUE
|
87
|
-
|
99
|
+
rg_s_new(int argc, VALUE *argv, VALUE klass)
|
88
100
|
{
|
89
|
-
VALUE obj =
|
101
|
+
VALUE obj = rg_s_allocate(klass);
|
90
102
|
rb_obj_call_init(obj, argc, argv);
|
91
103
|
return obj;
|
92
104
|
}
|
@@ -105,13 +117,13 @@ gboolean pango_parse_markup (const char *markup_text,
|
|
105
117
|
*/
|
106
118
|
|
107
119
|
static VALUE
|
108
|
-
|
120
|
+
rg_s_type_register(G_GNUC_UNUSED VALUE self, VALUE name)
|
109
121
|
{
|
110
122
|
return INT2NUM(pango_attr_type_register(RVAL2CSTR(name)));
|
111
123
|
}
|
112
124
|
|
113
125
|
static VALUE
|
114
|
-
|
126
|
+
rg_operator_attr_equal(VALUE self, VALUE other)
|
115
127
|
{
|
116
128
|
return CBOOL2RVAL(pango_attribute_equal(RVAL2ATTR(self), RVAL2ATTR(other)));
|
117
129
|
}
|
@@ -121,26 +133,26 @@ attr_equal(VALUE self, VALUE other)
|
|
121
133
|
*/
|
122
134
|
/* PangoAttribute */
|
123
135
|
static VALUE
|
124
|
-
|
136
|
+
rg_start_index(VALUE self)
|
125
137
|
{
|
126
138
|
return UINT2NUM(RVAL2ATTR(self)->start_index);
|
127
139
|
}
|
128
140
|
|
129
141
|
static VALUE
|
130
|
-
|
142
|
+
rg_set_start_index(VALUE self, VALUE value)
|
131
143
|
{
|
132
144
|
RVAL2ATTR(self)->start_index = NUM2UINT(value);
|
133
145
|
return Qnil;
|
134
146
|
}
|
135
147
|
|
136
148
|
static VALUE
|
137
|
-
|
149
|
+
rg_end_index(VALUE self)
|
138
150
|
{
|
139
151
|
return UINT2NUM(RVAL2ATTR(self)->end_index);
|
140
152
|
}
|
141
153
|
|
142
154
|
static VALUE
|
143
|
-
|
155
|
+
rg_set_end_index(VALUE self, VALUE value)
|
144
156
|
{
|
145
157
|
RVAL2ATTR(self)->end_index = NUM2UINT(value);
|
146
158
|
return Qnil;
|
@@ -157,7 +169,7 @@ attr_string_value(VALUE self)
|
|
157
169
|
static VALUE
|
158
170
|
attr_language_value(VALUE self)
|
159
171
|
{
|
160
|
-
return
|
172
|
+
return PANGOLANGUAGE2RVAL(((PangoAttrLanguage*)RVAL2ATTR(self))->value);
|
161
173
|
}
|
162
174
|
|
163
175
|
/* PangoAttrColor */
|
@@ -165,7 +177,7 @@ static VALUE
|
|
165
177
|
attr_color_value(VALUE self)
|
166
178
|
{
|
167
179
|
PangoColor color = ((PangoAttrColor*)RVAL2ATTR(self))->color;
|
168
|
-
return
|
180
|
+
return PANGOCOLOR2RVAL(&color);
|
169
181
|
}
|
170
182
|
|
171
183
|
/* PangoAttrInt */
|
@@ -193,7 +205,7 @@ attr_bool_value(VALUE self)
|
|
193
205
|
static VALUE
|
194
206
|
attr_fontdesc_value(VALUE self)
|
195
207
|
{
|
196
|
-
return
|
208
|
+
return PANGOFONTDESCRIPTION2RVAL(((PangoAttrFontDesc*)RVAL2ATTR(self))->desc);
|
197
209
|
}
|
198
210
|
|
199
211
|
/* PangoAttrShape */
|
@@ -201,14 +213,14 @@ static VALUE
|
|
201
213
|
attr_shape_ink_rect(VALUE self)
|
202
214
|
{
|
203
215
|
PangoRectangle rect = ((PangoAttrShape*)RVAL2ATTR(self))->ink_rect;
|
204
|
-
return
|
216
|
+
return PANGORECTANGLE2RVAL(&rect);
|
205
217
|
}
|
206
218
|
|
207
219
|
static VALUE
|
208
220
|
attr_shape_logical_rect(VALUE self)
|
209
221
|
{
|
210
222
|
PangoRectangle rect = ((PangoAttrShape*)RVAL2ATTR(self))->logical_rect;
|
211
|
-
return
|
223
|
+
return PANGORECTANGLE2RVAL(&rect);
|
212
224
|
}
|
213
225
|
|
214
226
|
static VALUE
|
@@ -240,7 +252,7 @@ static VALUE
|
|
240
252
|
attr_AttrLanguage_initialize(VALUE self, VALUE lang)
|
241
253
|
{
|
242
254
|
DATA_PTR(self) = pango_attr_language_new(
|
243
|
-
(
|
255
|
+
RVAL2PANGOLANGUAGE(lang));
|
244
256
|
return Qnil;
|
245
257
|
}
|
246
258
|
|
@@ -275,14 +287,14 @@ attr_AttrAbsoluteSize_initialize(VALUE self, VALUE size)
|
|
275
287
|
static VALUE
|
276
288
|
attr_AttrGravity_initialize(VALUE self, VALUE gravity)
|
277
289
|
{
|
278
|
-
DATA_PTR(self) = pango_attr_gravity_new(
|
290
|
+
DATA_PTR(self) = pango_attr_gravity_new(RVAL2PANGOGRAVITY(gravity));
|
279
291
|
return Qnil;
|
280
292
|
}
|
281
293
|
|
282
294
|
static VALUE
|
283
295
|
attr_AttrGravityHint_initialize(VALUE self, VALUE gravity_hint)
|
284
296
|
{
|
285
|
-
DATA_PTR(self) = pango_attr_gravity_hint_new(
|
297
|
+
DATA_PTR(self) = pango_attr_gravity_hint_new(RVAL2PANGOGRAVITYHINT(gravity_hint));
|
286
298
|
return Qnil;
|
287
299
|
}
|
288
300
|
#endif
|
@@ -290,10 +302,7 @@ attr_AttrGravityHint_initialize(VALUE self, VALUE gravity_hint)
|
|
290
302
|
static VALUE
|
291
303
|
attr_AttrFontDescription_initialize(VALUE self, VALUE fontdescription)
|
292
304
|
{
|
293
|
-
DATA_PTR(self) = pango_attr_font_desc_new(
|
294
|
-
(PangoFontDescription*)RVAL2BOXED(fontdescription,
|
295
|
-
PANGO_TYPE_FONT_DESCRIPTION));
|
296
|
-
|
305
|
+
DATA_PTR(self) = pango_attr_font_desc_new(RVAL2PANGOFONTDESCRIPTION(fontdescription));
|
297
306
|
return Qnil;
|
298
307
|
}
|
299
308
|
|
@@ -317,7 +326,7 @@ attr_AttrStrikethrough_initialize(VALUE self, VALUE strikethrough)
|
|
317
326
|
DATA_PTR(self) = pango_attr_strikethrough_new(RVAL2CBOOL(strikethrough));
|
318
327
|
return Qnil;
|
319
328
|
}
|
320
|
-
#
|
329
|
+
#ifdef HAVE_PANGO_ATTR_STRIKETHROUGH_COLOR_NEW
|
321
330
|
static VALUE
|
322
331
|
attr_AttrStrikethroughColor_initialize(VALUE self, VALUE r, VALUE g, VALUE b)
|
323
332
|
{
|
@@ -327,7 +336,7 @@ attr_AttrStrikethroughColor_initialize(VALUE self, VALUE r, VALUE g, VALUE b)
|
|
327
336
|
#endif
|
328
337
|
|
329
338
|
MAKE_ATTRENUM_INIT(AttrUnderline, underline, PANGO_TYPE_UNDERLINE);
|
330
|
-
#
|
339
|
+
#ifdef HAVE_PANGO_ATTR_UNDERLINE_COLOR_NEW
|
331
340
|
static VALUE
|
332
341
|
attr_AttrUnderlineColor_initialize(VALUE self, VALUE r, VALUE g, VALUE b)
|
333
342
|
{
|
@@ -340,25 +349,25 @@ static VALUE
|
|
340
349
|
attr_AttrShape_initialize(int argc, VALUE *argv, VALUE self)
|
341
350
|
{
|
342
351
|
VALUE ink_rect, logical_rect, data;
|
343
|
-
|
352
|
+
|
344
353
|
rb_scan_args(argc, argv, "21", &ink_rect, &logical_rect, &data);
|
345
354
|
|
346
355
|
if (NIL_P(data)){
|
347
356
|
DATA_PTR(self) = pango_attr_shape_new(
|
348
|
-
(
|
349
|
-
(
|
357
|
+
RVAL2PANGORECTANGLE(ink_rect),
|
358
|
+
RVAL2PANGORECTANGLE(logical_rect));
|
350
359
|
} else {
|
351
360
|
#if PANGO_CHECK_VERSION(1,8,0)
|
352
361
|
G_RELATIVE(self, data);
|
353
362
|
DATA_PTR(self) = pango_attr_shape_new_with_data(
|
354
|
-
(
|
355
|
-
(
|
363
|
+
RVAL2PANGORECTANGLE(ink_rect),
|
364
|
+
RVAL2PANGORECTANGLE(logical_rect),
|
356
365
|
(gpointer)data, NULL, NULL);
|
357
366
|
#else
|
358
367
|
rb_warning("not supported in Pango-1.6.x. the 3rd parameter was ignored.");
|
359
368
|
DATA_PTR(self) = pango_attr_shape_new(
|
360
|
-
(
|
361
|
-
(
|
369
|
+
RVAL2PANGORECTANGLE(ink_rect),
|
370
|
+
RVAL2PANGORECTANGLE(logical_rect));
|
362
371
|
#endif
|
363
372
|
}
|
364
373
|
|
@@ -393,50 +402,50 @@ rb_hash_aset(type_to_klass, INT2FIX(gtype), tmpklass);\
|
|
393
402
|
rb_define_method(tmpklass, "initialize", attr_## name ## _initialize , num);
|
394
403
|
|
395
404
|
void
|
396
|
-
Init_pango_attribute()
|
405
|
+
Init_pango_attribute(VALUE mPango)
|
397
406
|
{
|
398
407
|
VALUE tmpklass;
|
399
|
-
|
408
|
+
RG_TARGET_NAMESPACE = rb_define_class_under(mPango, "Attribute", rb_cData);
|
400
409
|
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
410
|
+
RG_DEF_SMETHOD(type_register, 1);
|
411
|
+
RG_DEF_METHOD_OPERATOR("==", attr_equal, 1);
|
412
|
+
RG_DEF_METHOD(start_index, 0);
|
413
|
+
RG_DEF_METHOD(set_start_index, 1);
|
414
|
+
RG_DEF_METHOD(end_index, 0);
|
415
|
+
RG_DEF_METHOD(set_end_index, 1);
|
407
416
|
|
408
|
-
G_DEF_SETTERS(
|
417
|
+
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
409
418
|
|
410
419
|
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
|
411
|
-
|
420
|
+
RG_DEF_SMETHOD(allocate, 0);
|
412
421
|
#else
|
413
|
-
rb_define_alloc_func(
|
422
|
+
rb_define_alloc_func(RG_TARGET_NAMESPACE, (VALUE(*)_((VALUE)))rg_s_allocate);
|
414
423
|
#endif
|
415
424
|
#ifndef HAVE_OBJECT_ALLOCATE
|
416
|
-
|
425
|
+
RG_DEF_SMETHOD(new, -1);
|
417
426
|
#endif
|
418
427
|
|
419
|
-
attrstring = rb_define_class_under(mPango, "AttrString",
|
428
|
+
attrstring = rb_define_class_under(mPango, "AttrString", RG_TARGET_NAMESPACE);
|
420
429
|
rb_define_method(attrstring, "value", attr_string_value, 0);
|
421
430
|
|
422
|
-
pattrint = rb_define_class_under(mPango, "AttrInt",
|
431
|
+
pattrint = rb_define_class_under(mPango, "AttrInt", RG_TARGET_NAMESPACE);
|
423
432
|
rb_define_method(pattrint, "value", attr_int_value, 0);
|
424
433
|
|
425
|
-
pattrfloat = rb_define_class_under(mPango, "AttrFloat",
|
434
|
+
pattrfloat = rb_define_class_under(mPango, "AttrFloat", RG_TARGET_NAMESPACE);
|
426
435
|
rb_define_method(pattrfloat, "value", attr_float_value, 0);
|
427
436
|
|
428
|
-
pattrcolor = rb_define_class_under(mPango, "AttrColor",
|
437
|
+
pattrcolor = rb_define_class_under(mPango, "AttrColor", RG_TARGET_NAMESPACE);
|
429
438
|
rb_define_method(pattrcolor, "value", attr_color_value, 0);
|
430
439
|
|
431
|
-
pattrbool = rb_define_class_under(mPango, "AttrBool",
|
440
|
+
pattrbool = rb_define_class_under(mPango, "AttrBool", RG_TARGET_NAMESPACE);
|
432
441
|
rb_define_method(pattrbool, "value", attr_bool_value, 0);
|
433
442
|
|
434
443
|
rb_global_variable(&type_to_klass);
|
435
444
|
type_to_klass = rb_hash_new();
|
436
445
|
|
437
|
-
MAKE_ATTR(PANGO_ATTR_LANGUAGE, AttrLanguage,
|
446
|
+
MAKE_ATTR(PANGO_ATTR_LANGUAGE, AttrLanguage, RG_TARGET_NAMESPACE, 1);
|
438
447
|
rb_define_method(tmpklass, "value", attr_language_value, 0);
|
439
|
-
|
448
|
+
|
440
449
|
MAKE_ATTR(PANGO_ATTR_FAMILY, AttrFamily, attrstring, 1);
|
441
450
|
MAKE_ATTR(PANGO_ATTR_STYLE, AttrStyle, pattrint, 1);
|
442
451
|
MAKE_ATTR(PANGO_ATTR_WEIGHT, AttrWeight, pattrint, 1);
|
@@ -450,7 +459,7 @@ Init_pango_attribute()
|
|
450
459
|
MAKE_ATTR(PANGO_ATTR_GRAVITY, AttrGravity, pattrint, 1);
|
451
460
|
MAKE_ATTR(PANGO_ATTR_GRAVITY_HINT, AttrGravityHint, pattrint, 1);
|
452
461
|
#endif
|
453
|
-
MAKE_ATTR(PANGO_ATTR_FONT_DESC, AttrFontDescription,
|
462
|
+
MAKE_ATTR(PANGO_ATTR_FONT_DESC, AttrFontDescription, RG_TARGET_NAMESPACE, 1);
|
454
463
|
rb_define_method(tmpklass, "value", attr_fontdesc_value, 0);
|
455
464
|
MAKE_ATTR(PANGO_ATTR_FOREGROUND, AttrForeground, pattrcolor, 3);
|
456
465
|
MAKE_ATTR(PANGO_ATTR_BACKGROUND, AttrBackground, pattrcolor, 3);
|
@@ -458,19 +467,19 @@ Init_pango_attribute()
|
|
458
467
|
/* PangoUnderline */
|
459
468
|
G_DEF_CLASS(PANGO_TYPE_UNDERLINE, "Underline", tmpklass);
|
460
469
|
G_DEF_CONSTANTS(tmpklass, PANGO_TYPE_UNDERLINE, "PANGO_UNDERLINE_");
|
461
|
-
#
|
470
|
+
#ifdef HAVE_PANGO_ATTR_UNDERLINE_COLOR_NEW
|
462
471
|
MAKE_ATTR(PANGO_ATTR_UNDERLINE_COLOR, AttrUnderlineColor, pattrcolor, 3);
|
463
472
|
#endif
|
464
473
|
|
465
474
|
MAKE_ATTR(PANGO_ATTR_STRIKETHROUGH, AttrStrikethrough, pattrbool, 1);
|
466
|
-
#
|
475
|
+
#ifdef HAVE_PANGO_ATTR_STRIKETHROUGH_COLOR_NEW
|
467
476
|
MAKE_ATTR(PANGO_ATTR_STRIKETHROUGH_COLOR, AttrStrikethroughColor, pattrcolor, 3);
|
468
477
|
#endif
|
469
478
|
MAKE_ATTR(PANGO_ATTR_RISE, AttrRise, pattrint, 1);
|
470
479
|
#if PANGO_CHECK_VERSION(1,6,0)
|
471
480
|
MAKE_ATTR(PANGO_ATTR_LETTER_SPACING, AttrLetterSpacing, pattrint, 1);
|
472
481
|
#endif
|
473
|
-
MAKE_ATTR(PANGO_ATTR_SHAPE, AttrShape,
|
482
|
+
MAKE_ATTR(PANGO_ATTR_SHAPE, AttrShape, RG_TARGET_NAMESPACE, -1);
|
474
483
|
rb_define_method(tmpklass, "ink_rect", attr_shape_ink_rect, 0);
|
475
484
|
rb_define_method(tmpklass, "logical_rect", attr_shape_logical_rect, 0);
|
476
485
|
rb_define_method(tmpklass, "value", attr_shape_value, 0);
|
@@ -487,31 +496,31 @@ Init_pango_attribute()
|
|
487
496
|
MAKE_ATTR(PANGO_ATTR_FALLBACK, AttrFallback, pattrbool, 1);
|
488
497
|
#endif
|
489
498
|
/* PangoAttrType */
|
490
|
-
G_DEF_CLASS(PANGO_TYPE_ATTR_TYPE, "Type",
|
499
|
+
G_DEF_CLASS(PANGO_TYPE_ATTR_TYPE, "Type", RG_TARGET_NAMESPACE);
|
491
500
|
#define INT2ATTRTYPE(x) rbgobj_make_enum((x), PANGO_TYPE_ATTR_TYPE)
|
492
|
-
rb_define_const(
|
493
|
-
rb_define_const(
|
494
|
-
rb_define_const(
|
495
|
-
rb_define_const(
|
496
|
-
rb_define_const(
|
497
|
-
rb_define_const(
|
498
|
-
rb_define_const(
|
499
|
-
rb_define_const(
|
500
|
-
rb_define_const(
|
501
|
-
rb_define_const(
|
502
|
-
rb_define_const(
|
503
|
-
rb_define_const(
|
504
|
-
rb_define_const(
|
501
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_INVALID", INT2ATTRTYPE(PANGO_ATTR_INVALID));
|
502
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_LANGUAGE", INT2ATTRTYPE(PANGO_ATTR_LANGUAGE));
|
503
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_FAMILY", INT2ATTRTYPE(PANGO_ATTR_FAMILY));
|
504
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_STYLE", INT2ATTRTYPE(PANGO_ATTR_STYLE));
|
505
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_WEIGHT", INT2ATTRTYPE(PANGO_ATTR_WEIGHT));
|
506
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_VARIANT", INT2ATTRTYPE(PANGO_ATTR_VARIANT));
|
507
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_STRETCH", INT2ATTRTYPE(PANGO_ATTR_STRETCH));
|
508
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_SIZE", INT2ATTRTYPE(PANGO_ATTR_SIZE));
|
509
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_FONT_DESC", INT2ATTRTYPE(PANGO_ATTR_FONT_DESC));
|
510
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_FOREGROUND", INT2ATTRTYPE(PANGO_ATTR_FOREGROUND));
|
511
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_BACKGROUND", INT2ATTRTYPE(PANGO_ATTR_BACKGROUND));
|
512
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_UNDERLINE", INT2ATTRTYPE(PANGO_ATTR_UNDERLINE));
|
513
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_STRIKETHROUGH", INT2ATTRTYPE(PANGO_ATTR_STRIKETHROUGH));
|
505
514
|
#if PANGO_CHECK_VERSION(1,8,0)
|
506
|
-
rb_define_const(
|
515
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_STRIKETHROUGH_COLOR", INT2ATTRTYPE(PANGO_ATTR_STRIKETHROUGH_COLOR));
|
507
516
|
#endif
|
508
|
-
rb_define_const(
|
509
|
-
rb_define_const(
|
510
|
-
rb_define_const(
|
517
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_RISE", INT2ATTRTYPE(PANGO_ATTR_RISE));
|
518
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_SHAPE", INT2ATTRTYPE(PANGO_ATTR_SHAPE));
|
519
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_SCALE", INT2ATTRTYPE(PANGO_ATTR_SCALE));
|
511
520
|
#if PANGO_CHECK_VERSION(1,8,0)
|
512
|
-
rb_define_const(
|
521
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_FALLBACK", INT2ATTRTYPE(PANGO_ATTR_FALLBACK));
|
513
522
|
#endif
|
514
523
|
#if PANGO_CHECK_VERSION(1,6,0)
|
515
|
-
rb_define_const(
|
524
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_LETTER_SPACING", INT2ATTRTYPE(PANGO_ATTR_LETTER_SPACING));
|
516
525
|
#endif
|
517
526
|
}
|
@@ -1,17 +1,28 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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 cAttrIterator
|
25
|
+
#define _SELF(self) (RVAL2PANGOATTRITERATOR(self))
|
15
26
|
|
16
27
|
/**********************************/
|
17
28
|
GType
|
@@ -28,13 +39,13 @@ pango_attr_iter_get_type(void)
|
|
28
39
|
/**********************************/
|
29
40
|
|
30
41
|
static VALUE
|
31
|
-
|
42
|
+
rg_next_bang(VALUE self)
|
32
43
|
{
|
33
44
|
return CBOOL2RVAL(pango_attr_iterator_next(_SELF(self)));
|
34
45
|
}
|
35
46
|
|
36
47
|
static VALUE
|
37
|
-
|
48
|
+
rg_range(VALUE self)
|
38
49
|
{
|
39
50
|
gint start = 0;
|
40
51
|
gint end = 0;
|
@@ -43,7 +54,7 @@ attriterator_range(VALUE self)
|
|
43
54
|
}
|
44
55
|
|
45
56
|
static VALUE
|
46
|
-
|
57
|
+
rg_get(int argc, VALUE *argv, VALUE self)
|
47
58
|
{
|
48
59
|
VALUE type, ret;
|
49
60
|
PangoAttribute* attr;
|
@@ -67,7 +78,7 @@ attriterator_get(int argc, VALUE *argv, VALUE self)
|
|
67
78
|
}
|
68
79
|
|
69
80
|
static VALUE
|
70
|
-
|
81
|
+
rg_font(VALUE self)
|
71
82
|
{
|
72
83
|
PangoFontDescription* desc;
|
73
84
|
PangoLanguage* lang;
|
@@ -84,8 +95,8 @@ attriterator_get_font(VALUE self)
|
|
84
95
|
extra_attrs = extra_attrs->next;
|
85
96
|
}
|
86
97
|
|
87
|
-
ret = rb_ary_new3(3, (
|
88
|
-
(
|
98
|
+
ret = rb_ary_new3(3, PANGOFONTDESCRIPTION2RVAL(desc),
|
99
|
+
PANGOLANGUAGE2RVAL(lang),
|
89
100
|
ary);
|
90
101
|
|
91
102
|
pango_font_description_free(desc);
|
@@ -94,7 +105,7 @@ attriterator_get_font(VALUE self)
|
|
94
105
|
|
95
106
|
#ifdef HAVE_PANGO_ATTR_ITERATOR_GET_ATTRS
|
96
107
|
static VALUE
|
97
|
-
|
108
|
+
rg_attrs(VALUE self)
|
98
109
|
{
|
99
110
|
GSList* list = pango_attr_iterator_get_attrs(_SELF(self));
|
100
111
|
GSList* base = list;
|
@@ -116,15 +127,15 @@ attriterator_get_attrs(VALUE self)
|
|
116
127
|
#endif
|
117
128
|
|
118
129
|
void
|
119
|
-
Init_pango_attriterator()
|
130
|
+
Init_pango_attriterator(VALUE mPango)
|
120
131
|
{
|
121
|
-
VALUE
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
132
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_ATTR_ITERATOR, "AttrIterator", mPango);
|
133
|
+
|
134
|
+
RG_DEF_METHOD_BANG(next, 0);
|
135
|
+
RG_DEF_METHOD(range, 0);
|
136
|
+
RG_DEF_METHOD(get, -1);
|
137
|
+
RG_DEF_METHOD(font, 0);
|
127
138
|
#ifdef HAVE_PANGO_ATTR_ITERATOR_GET_ATTRS
|
128
|
-
|
139
|
+
RG_DEF_METHOD(attrs, 0);
|
129
140
|
#endif
|
130
141
|
}
|