pango 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +27 -5
  3. data/ext/pango/depend +2 -2
  4. data/ext/pango/extconf.rb +32 -28
  5. data/ext/pango/pango.def +0 -16
  6. data/ext/pango/rb-pango-attr-list.c +64 -0
  7. data/ext/pango/rb-pango-attribute.c +147 -0
  8. data/ext/pango/rb-pango-context.c +79 -0
  9. data/ext/pango/{rbpangoconversions.h → rb-pango-conversions.h} +4 -6
  10. data/ext/pango/rb-pango-private.h +27 -0
  11. data/ext/pango/rb-pango.c +32 -0
  12. data/ext/pango/rb-pango.h +29 -0
  13. data/extconf.rb +25 -9
  14. data/lib/pango.rb +24 -68
  15. data/lib/pango/cairo-loader.rb +63 -0
  16. data/lib/pango/color.rb +31 -0
  17. data/lib/pango/deprecated.rb +37 -0
  18. data/lib/pango/font-description.rb +29 -0
  19. data/lib/pango/language.rb +29 -0
  20. data/lib/pango/layout.rb +41 -0
  21. data/lib/pango/loader.rb +87 -0
  22. data/lib/pango/markup.rb +31 -0
  23. data/lib/pango/matrix.rb +64 -0
  24. data/lib/pango/rectangle.rb +28 -0
  25. data/lib/pango/version.rb +30 -0
  26. data/test/pango-test-utils.rb +7 -7
  27. data/test/run-test.rb +34 -8
  28. data/test/test-attr-list.rb +28 -0
  29. data/test/test-color.rb +1 -3
  30. data/test/test-context.rb +4 -4
  31. data/test/test-enum.rb +37 -0
  32. data/test/test-font-description.rb +31 -0
  33. data/test/test-language.rb +2 -1
  34. data/test/test-layout.rb +12 -0
  35. data/test/test-markup.rb +30 -0
  36. data/test/test-matrix.rb +131 -5
  37. data/test/test-rectangle.rb +16 -3
  38. metadata +42 -56
  39. data/README +0 -32
  40. data/ext/pango/rbpango.c +0 -356
  41. data/ext/pango/rbpango.h +0 -95
  42. data/ext/pango/rbpangoanalysis.c +0 -218
  43. data/ext/pango/rbpangoattribute.c +0 -506
  44. data/ext/pango/rbpangoattriterator.c +0 -141
  45. data/ext/pango/rbpangoattrlist.c +0 -101
  46. data/ext/pango/rbpangocairo.c +0 -122
  47. data/ext/pango/rbpangocairocontext.c +0 -131
  48. data/ext/pango/rbpangocolor.c +0 -120
  49. data/ext/pango/rbpangocontext.c +0 -344
  50. data/ext/pango/rbpangocoverage.c +0 -106
  51. data/ext/pango/rbpangoengine.c +0 -73
  52. data/ext/pango/rbpangofont.c +0 -110
  53. data/ext/pango/rbpangofontdescription.c +0 -282
  54. data/ext/pango/rbpangofontface.c +0 -73
  55. data/ext/pango/rbpangofontfamily.c +0 -79
  56. data/ext/pango/rbpangofontmap.c +0 -102
  57. data/ext/pango/rbpangofontmetrics.c +0 -85
  58. data/ext/pango/rbpangofontset.c +0 -69
  59. data/ext/pango/rbpangofontsetsimple.c +0 -60
  60. data/ext/pango/rbpangoglyphinfo.c +0 -123
  61. data/ext/pango/rbpangoglyphitem.c +0 -125
  62. data/ext/pango/rbpangoglyphstring.c +0 -151
  63. data/ext/pango/rbpangogravity.c +0 -54
  64. data/ext/pango/rbpangoitem.c +0 -95
  65. data/ext/pango/rbpangolanguage.c +0 -94
  66. data/ext/pango/rbpangolayout.c +0 -583
  67. data/ext/pango/rbpangolayoutiter.c +0 -189
  68. data/ext/pango/rbpangolayoutline.c +0 -243
  69. data/ext/pango/rbpangologattr.c +0 -109
  70. data/ext/pango/rbpangomatrix.c +0 -143
  71. data/ext/pango/rbpangoprivate.h +0 -49
  72. data/ext/pango/rbpangorectangle.c +0 -170
  73. data/ext/pango/rbpangorenderer.c +0 -193
  74. data/ext/pango/rbpangoscript.c +0 -84
  75. data/ext/pango/rbpangoscriptiter.c +0 -92
  76. data/ext/pango/rbpangotabarray.c +0 -128
  77. data/sample/attribute.rb +0 -82
  78. data/sample/break.rb +0 -28
  79. data/sample/gdk_layout.rb +0 -27
  80. data/sample/glyphstring.rb +0 -61
  81. data/sample/item.rb +0 -37
  82. data/sample/label.rb +0 -23
  83. data/sample/layout.rb +0 -102
  84. data/sample/pango_cairo.rb +0 -66
  85. data/sample/parse.rb +0 -33
  86. data/sample/sample.txt +0 -10
  87. data/sample/script.rb +0 -23
@@ -1,123 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011-2016 Ruby-GNOME2 Project Team
4
- * Copyright (C) 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 cGlyphInfo
25
- #define _SELF(self) (RVAL2PANGOGLYPHINFO(self))
26
-
27
- /**********************************/
28
- static PangoGlyphInfo *
29
- pango_glyph_info_copy(const PangoGlyphInfo *info)
30
- {
31
- PangoGlyphInfo *data;
32
-
33
- g_return_val_if_fail(info != NULL, NULL);
34
-
35
- data = g_new(PangoGlyphInfo, 1);
36
- *data = *info;
37
-
38
- return data;
39
- }
40
-
41
- GType
42
- pango_glyph_info_get_type(void)
43
- {
44
- static GType our_type = 0;
45
-
46
- if (our_type == 0)
47
- our_type = g_boxed_type_register_static ("PangoGlyphInfo",
48
- (GBoxedCopyFunc)pango_glyph_info_copy,
49
- (GBoxedFreeFunc)g_free);
50
- return our_type;
51
- }
52
- /**********************************/
53
-
54
- static VALUE
55
- rg_initialize(VALUE self)
56
- {
57
- G_INITIALIZE(self, g_new0(PangoGlyphInfo, 1));
58
- return Qnil;
59
- }
60
-
61
- static VALUE
62
- rg_glyph(VALUE self)
63
- {
64
- return UINT2NUM(_SELF(self)->glyph);
65
- }
66
-
67
- static VALUE
68
- rg_set_glyph(VALUE self, VALUE val)
69
- {
70
- _SELF(self)->glyph = NUM2UINT(val);
71
- return self;
72
- }
73
-
74
- static VALUE
75
- rg_geometry(VALUE self)
76
- {
77
- PangoGlyphGeometry geo = _SELF(self)->geometry;
78
-
79
- return rb_ary_new3(3, INT2NUM(geo.width),
80
- INT2NUM(geo.x_offset), INT2NUM(geo.y_offset));
81
- }
82
-
83
- static VALUE
84
- rg_set_geometry(VALUE self, VALUE width, VALUE x_offset, VALUE y_offset)
85
- {
86
- PangoGlyphGeometry *geo = &(_SELF(self)->geometry);
87
-
88
- geo->width = NUM2INT(width);
89
- geo->x_offset = NUM2INT(x_offset);
90
- geo->y_offset = NUM2INT(y_offset);
91
-
92
- return self;
93
- }
94
-
95
- /*
96
- This method may be changed in the future following Pango implementation.
97
- */
98
- static VALUE
99
- rg_cluster_start_p(VALUE self)
100
- {
101
- return CBOOL2RVAL(_SELF(self)->attr.is_cluster_start);
102
- }
103
-
104
- static VALUE
105
- rg_set_cluster_start(VALUE self, VALUE val)
106
- {
107
- _SELF(self)->attr.is_cluster_start = RVAL2CBOOL(val);
108
- return self;
109
- }
110
-
111
- void
112
- Init_pango_glyph_info(VALUE mPango)
113
- {
114
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_GLYPH_INFO, "GlyphInfo", mPango);
115
-
116
- RG_DEF_METHOD(initialize, 0);
117
- RG_DEF_METHOD(glyph, 0);
118
- RG_DEF_METHOD(set_glyph, 1);
119
- RG_DEF_METHOD(geometry, 0);
120
- RG_DEF_METHOD(set_geometry, 3);
121
- RG_DEF_METHOD_P(cluster_start, 0);
122
- RG_DEF_METHOD(set_cluster_start, 1);
123
- }
@@ -1,125 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
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 cGlyphItem
25
- #define _SELF(r) (RVAL2PANGOGLYPHITEM(r))
26
-
27
- /**********************************/
28
- #ifndef HAVE_PANGO_GLYPH_ITEM_GET_TYPE
29
- static PangoGlyphItem*
30
- glyph_item_copy(const PangoGlyphItem *ref)
31
- {
32
- PangoGlyphItem* new_ref;
33
- g_return_val_if_fail (ref != NULL, NULL);
34
- new_ref = g_new(PangoGlyphItem, 1);
35
- *new_ref = *ref;
36
- return new_ref;
37
- }
38
-
39
- # ifndef HAVE_PANGO_GLYPH_ITEM_FREE
40
- void
41
- pango_glyph_item_free(PangoGlyphItem* glyph_item)
42
- {
43
- if (glyph_item->item)
44
- pango_item_free(glyph_item->item);
45
- if (glyph_item->glyphs)
46
- pango_glyph_string_free(glyph_item->glyphs);
47
- g_free(glyph_item);
48
- }
49
- # endif
50
-
51
- GType
52
- pango_glyph_item_get_type(void)
53
- {
54
- static GType our_type = 0;
55
-
56
- if (our_type == 0)
57
- our_type = g_boxed_type_register_static ("PangoGlyphItem",
58
- (GBoxedCopyFunc)glyph_item_copy,
59
- (GBoxedFreeFunc)pango_glyph_item_free);
60
- return our_type;
61
- }
62
- #endif
63
- /**********************************/
64
-
65
- static VALUE
66
- rg_item(VALUE self)
67
- {
68
- PangoItem* item = _SELF(self)->item;
69
- return PANGOITEM2RVAL(item);
70
- }
71
-
72
- static VALUE
73
- rg_glyphs(VALUE self)
74
- {
75
- PangoGlyphString* glyphs = _SELF(self)->glyphs;
76
- return PANGOGLYPHSTRING2RVAL(glyphs);
77
- }
78
-
79
- static VALUE
80
- rg_split(VALUE self, VALUE text, VALUE split_index)
81
- {
82
- return PANGOGLYPHITEM2RVAL(pango_glyph_item_split(_SELF(self), RVAL2CSTR(text),
83
- NUM2INT(split_index)));
84
- }
85
-
86
- static VALUE
87
- rg_appy_attrs(VALUE self, VALUE text, VALUE attrs)
88
- {
89
- GSList* list = pango_glyph_item_apply_attrs(_SELF(self), RVAL2CSTR(text),
90
- RVAL2PANGOATTRLIST(attrs));
91
-
92
- VALUE ret = rb_ary_new();
93
-
94
- while (list) {
95
- rb_ary_push(ret, PANGOGLYPHITEM2RVAL(list->data));
96
- pango_glyph_item_free(list->data);
97
- list = list->next;
98
- }
99
-
100
- g_slist_free(list);
101
- return ret;
102
- }
103
-
104
- static VALUE
105
- rg_letter_space(VALUE self, VALUE text, VALUE log_attrs, VALUE letter_spacing)
106
- {
107
- pango_glyph_item_letter_space(_SELF(self), RVAL2CSTR(text),
108
- RVAL2PANGOLOGATTR(log_attrs),
109
- NUM2INT(letter_spacing));
110
- return self;
111
- }
112
-
113
- void
114
- Init_pango_glyph_item(VALUE mPango)
115
- {
116
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_GLYPH_ITEM, "GlyphItem", mPango);
117
-
118
- RG_DEF_METHOD(item, 0);
119
- RG_DEF_METHOD(glyphs, 0);
120
-
121
- RG_DEF_METHOD(split, 2);
122
- RG_DEF_METHOD(appy_attrs, 2);
123
-
124
- RG_DEF_METHOD(letter_space, 3);
125
- }
@@ -1,151 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2002-2006 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 cGlyphString
25
- #define _SELF(self) (RVAL2PANGOGLYPHSTRING(self))
26
-
27
- static VALUE
28
- rg_initialize(VALUE self)
29
- {
30
- G_INITIALIZE(self, pango_glyph_string_new());
31
- return Qnil;
32
- }
33
-
34
- static VALUE
35
- rg_set_size(VALUE self, VALUE len)
36
- {
37
- pango_glyph_string_set_size(_SELF(self), NUM2INT(len));
38
- return self;
39
- }
40
-
41
- static VALUE
42
- rg_extents(int argc, VALUE *argv, VALUE self)
43
- {
44
- VALUE font, start_index, end_index;
45
- PangoRectangle ink_rect;
46
- PangoRectangle logical_rect;
47
-
48
- rb_scan_args(argc, argv, "12", &font, &start_index, &end_index);
49
-
50
- if (NIL_P(start_index)){
51
- pango_glyph_string_extents(_SELF(self),
52
- RVAL2PANGOFONT(font),
53
- &ink_rect, &logical_rect);
54
- } else {
55
- pango_glyph_string_extents_range(_SELF(self),
56
- NUM2INT(start_index), NUM2INT(end_index),
57
- RVAL2PANGOFONT(font),
58
- &ink_rect, &logical_rect);
59
- }
60
-
61
- return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect),
62
- PANGORECTANGLE2RVAL(&logical_rect));
63
- }
64
-
65
- static VALUE
66
- rg_width(VALUE self)
67
- {
68
- return INT2NUM(pango_glyph_string_get_width(_SELF(self)));
69
- }
70
-
71
- static VALUE
72
- rg_index_to_x(VALUE self, VALUE text, VALUE analysis, VALUE index, VALUE trailing)
73
- {
74
- int x_pos;
75
- StringValue(text);
76
-
77
- pango_glyph_string_index_to_x(_SELF(self),
78
- /* NOTE: This is a bug in the signature of
79
- * pango_glyph_string_index_to_x */
80
- (char *)RSTRING_PTR(text),
81
- RSTRING_LEN(text),
82
- RVAL2PANGOANALYSIS(analysis),
83
- NUM2INT(index), RVAL2CBOOL(trailing),
84
- &x_pos);
85
- return INT2NUM(x_pos);
86
- }
87
-
88
- static VALUE
89
- rg_x_to_index(VALUE self, VALUE text, VALUE analysis, VALUE x_pos)
90
- {
91
- int index;
92
- int trailing;
93
-
94
- StringValue(text);
95
- pango_glyph_string_x_to_index(_SELF(self),
96
- /* NOTE: This is a bug in the signature of
97
- * pango_glyph_string_index_to_x */
98
- (char *)RSTRING_PTR(text),
99
- RSTRING_LEN(text),
100
- RVAL2PANGOANALYSIS(analysis),
101
- NUM2INT(x_pos),
102
- &index, &trailing);
103
- return rb_assoc_new(INT2NUM(index), CBOOL2RVAL(trailing));
104
- }
105
-
106
- static VALUE
107
- rg_get_logical_widths(VALUE self, VALUE rbtext, VALUE rbembedding_level)
108
- {
109
- PangoGlyphString *glyphs = _SELF(self);
110
- const char *text = RVAL2CSTR(rbtext);
111
- long length = RSTRING_LEN(rbtext);
112
- int embedding_level = NUM2INT(rbembedding_level);
113
- glong n = g_utf8_strlen(text, length);
114
- int *logical_widths = g_new(int, n);
115
-
116
- pango_glyph_string_get_logical_widths(glyphs, text, length, embedding_level,
117
- logical_widths);
118
-
119
- return GINTS2RVAL_FREE(logical_widths, n);
120
- }
121
-
122
- static VALUE
123
- rg_glyphs(VALUE self)
124
- {
125
- int i;
126
- PangoGlyphInfo *glyphs = _SELF(self)->glyphs;
127
- gint* log_clusters = _SELF(self)->log_clusters;
128
-
129
- VALUE ret = rb_ary_new();
130
- for (i = 0; i < _SELF(self)->num_glyphs; i++) {
131
- rb_ary_push(ret,
132
- rb_assoc_new(PANGOGLYPHINFO2RVAL(glyphs + i),
133
- INT2NUM(log_clusters[i])));
134
- }
135
- return ret;
136
- }
137
-
138
- void
139
- Init_pango_glyph_string(VALUE mPango)
140
- {
141
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_GLYPH_STRING, "GlyphString", mPango);
142
-
143
- RG_DEF_METHOD(initialize, 0);
144
- RG_DEF_METHOD(set_size, 1);
145
- RG_DEF_METHOD(extents, -1);
146
- RG_DEF_METHOD(width, 0);
147
- RG_DEF_METHOD(index_to_x, 4);
148
- RG_DEF_METHOD(x_to_index, 3);
149
- RG_DEF_METHOD(get_logical_widths, 2);
150
- RG_DEF_METHOD(glyphs, 0);
151
- }
@@ -1,54 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
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"
22
-
23
- #if PANGO_VERSION_CHECK(1,16,0)
24
-
25
- #define RG_TARGET_NAMESPACE mGravity
26
-
27
- static VALUE
28
- rg_s_to_rotation(G_GNUC_UNUSED VALUE self, VALUE gravity)
29
- {
30
- return rb_float_new(pango_gravity_to_rotation(RVAL2PANGOGRAVITY(gravity)));
31
- }
32
-
33
- static VALUE
34
- rg_s_vertical_p(G_GNUC_UNUSED VALUE self, VALUE gravity)
35
- {
36
- return CBOOL2RVAL(PANGO_GRAVITY_IS_VERTICAL(RVAL2PANGOGRAVITY(gravity)));
37
- }
38
- #endif
39
-
40
- void
41
- Init_pango_gravity(VALUE mPango)
42
- {
43
- #if PANGO_VERSION_CHECK(1,16,0)
44
- VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mPango, "Gravity");
45
-
46
- RG_DEF_SMETHOD(to_rotation, 1);
47
- RG_DEF_SMETHOD_P(vertical, 1);
48
-
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_");
53
- #endif
54
- }