pango 1.0.3-x86-mingw32 → 1.1.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) 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. data/lib/1.8/pango.so +0 -0
  41. data/lib/1.9/pango.so +0 -0
  42. data/vendor/local/bin/libpango-1.0-0.dll +0 -0
  43. data/vendor/local/bin/libpangocairo-1.0-0.dll +0 -0
  44. data/vendor/local/bin/libpangoft2-1.0-0.dll +0 -0
  45. data/vendor/local/bin/libpangowin32-1.0-0.dll +0 -0
  46. data/vendor/local/bin/pango-querymodules.exe +0 -0
  47. data/vendor/local/bin/pango-view.exe +0 -0
  48. data/vendor/local/etc/pango/pango.modules +1 -1
  49. data/vendor/local/include/pango-1.0/pango/pango-attributes.h +1 -1
  50. data/vendor/local/include/pango-1.0/pango/pango-context.h +3 -3
  51. data/vendor/local/include/pango-1.0/pango/pango-features.h +3 -3
  52. data/vendor/local/include/pango-1.0/pango/pango-font.h +3 -3
  53. data/vendor/local/include/pango-1.0/pango/pango-language.h +3 -3
  54. data/vendor/local/include/pango-1.0/pango/pango-layout.h +6 -1
  55. data/vendor/local/include/pango-1.0/pango/pango-renderer.h +1 -1
  56. data/vendor/local/include/pango-1.0/pango/pango-script.h +6 -6
  57. data/vendor/local/include/pango-1.0/pango/pango-utils.h +6 -6
  58. data/vendor/local/lib/libpango-1.0.dll.a +0 -0
  59. data/vendor/local/lib/libpangocairo-1.0.dll.a +0 -0
  60. data/vendor/local/lib/libpangoft2-1.0.dll.a +0 -0
  61. data/vendor/local/lib/libpangowin32-1.0.dll.a +0 -0
  62. data/vendor/local/lib/pango-1.0.def +2 -0
  63. data/vendor/local/lib/pango-1.0.lib +0 -0
  64. data/vendor/local/lib/pangocairo-1.0.lib +0 -0
  65. data/vendor/local/lib/pangoft2-1.0.lib +0 -0
  66. data/vendor/local/lib/pangowin32-1.0.def +1 -1
  67. data/vendor/local/lib/pangowin32-1.0.lib +0 -0
  68. data/vendor/local/lib/pkgconfig/pango.pc +1 -1
  69. data/vendor/local/lib/pkgconfig/pangocairo.pc +1 -1
  70. data/vendor/local/lib/pkgconfig/pangoft2.pc +1 -1
  71. data/vendor/local/lib/pkgconfig/pangowin32.pc +1 -1
  72. data/vendor/local/manifest/{pango-dev_1.28.3-1_win32.mft → pango-dev_1.29.4-1_win32.mft} +5 -5
  73. data/vendor/local/manifest/{pango_1.28.3-1_win32.mft → pango_1.29.4-1_win32.mft} +2 -2
  74. data/vendor/local/share/doc/{pango-1.28.3 → pango-1.29.4}/COPYING +0 -0
  75. data/vendor/local/share/doc/{pango-dev-1.28.3 → pango-dev-1.29.4}/COPYING +0 -0
  76. data/vendor/local/share/gtk-doc/html/pango/PangoEngineLang.html +9 -10
  77. data/vendor/local/share/gtk-doc/html/pango/PangoEngineShape.html +25 -27
  78. data/vendor/local/share/gtk-doc/html/pango/PangoFcDecoder.html +19 -28
  79. data/vendor/local/share/gtk-doc/html/pango/PangoFcFont.html +42 -60
  80. data/vendor/local/share/gtk-doc/html/pango/PangoFcFontMap.html +97 -147
  81. data/vendor/local/share/gtk-doc/html/pango/PangoMarkupFormat.html +6 -6
  82. data/vendor/local/share/gtk-doc/html/pango/index-1.10.html +3 -3
  83. data/vendor/local/share/gtk-doc/html/pango/index-1.12.html +3 -3
  84. data/vendor/local/share/gtk-doc/html/pango/index-1.14.html +3 -3
  85. data/vendor/local/share/gtk-doc/html/pango/index-1.16.html +5 -5
  86. data/vendor/local/share/gtk-doc/html/pango/index-1.18.html +3 -5
  87. data/vendor/local/share/gtk-doc/html/pango/index-1.2.html +3 -3
  88. data/vendor/local/share/gtk-doc/html/pango/index-1.20.html +3 -3
  89. data/vendor/local/share/gtk-doc/html/pango/index-1.22.html +5 -5
  90. data/vendor/local/share/gtk-doc/html/pango/index-1.24.html +3 -3
  91. data/vendor/local/share/gtk-doc/html/pango/index-1.26.html +4 -4
  92. data/vendor/local/share/gtk-doc/html/pango/index-1.28.html +8 -11
  93. data/vendor/local/share/gtk-doc/html/pango/index-1.30.html +38 -0
  94. data/vendor/local/share/gtk-doc/html/pango/index-1.4.html +3 -3
  95. data/vendor/local/share/gtk-doc/html/pango/index-1.6.html +4 -4
  96. data/vendor/local/share/gtk-doc/html/pango/index-1.8.html +4 -4
  97. data/vendor/local/share/gtk-doc/html/pango/index-all.html +38 -40
  98. data/vendor/local/share/gtk-doc/html/pango/index-deprecated.html +3 -3
  99. data/vendor/local/share/gtk-doc/html/pango/index.html +6 -5
  100. data/vendor/local/share/gtk-doc/html/pango/index.sgml +71 -34
  101. data/vendor/local/share/gtk-doc/html/pango/lowlevel.html +3 -3
  102. data/vendor/local/share/gtk-doc/html/pango/pango-ATSUI-Fonts.html +4 -66
  103. data/vendor/local/share/gtk-doc/html/pango/pango-Bidirectional-Text.html +52 -50
  104. data/vendor/local/share/gtk-doc/html/pango/pango-Cairo-Rendering.html +217 -278
  105. data/vendor/local/share/gtk-doc/html/pango/pango-Coverage-Maps.html +40 -41
  106. data/vendor/local/share/gtk-doc/html/pango/pango-Engines.html +37 -49
  107. data/vendor/local/share/gtk-doc/html/pango/pango-Fonts.html +481 -628
  108. data/vendor/local/share/gtk-doc/html/pango/pango-FreeType-Fonts-and-Rendering.html +76 -118
  109. data/vendor/local/share/gtk-doc/html/pango/pango-Glyph-Storage.html +302 -452
  110. data/vendor/local/share/gtk-doc/html/pango/pango-Layout-Objects.html +492 -517
  111. data/vendor/local/share/gtk-doc/html/pango/pango-Miscellaneous-Utilities.html +134 -164
  112. data/vendor/local/share/gtk-doc/html/pango/pango-Modules.html +34 -45
  113. data/vendor/local/share/gtk-doc/html/pango/pango-OpenType-Font-Handling.html +244 -359
  114. data/vendor/local/share/gtk-doc/html/pango/pango-Scripts-and-Languages.html +117 -122
  115. data/vendor/local/share/gtk-doc/html/pango/pango-Tab-Stops.html +112 -120
  116. data/vendor/local/share/gtk-doc/html/pango/pango-Text-Attributes.html +394 -523
  117. data/vendor/local/share/gtk-doc/html/pango/pango-Text-Processing.html +269 -364
  118. data/vendor/local/share/gtk-doc/html/pango/pango-Version-Checking.html +26 -40
  119. data/vendor/local/share/gtk-doc/html/pango/pango-Vertical-Text.html +72 -75
  120. data/vendor/local/share/gtk-doc/html/pango/pango-Win32-Fonts-and-Rendering.html +97 -145
  121. data/vendor/local/share/gtk-doc/html/pango/pango-X-Fonts-and-Rendering.html +114 -188
  122. data/vendor/local/share/gtk-doc/html/pango/pango-Xft-Fonts-and-Rendering.html +114 -176
  123. data/vendor/local/share/gtk-doc/html/pango/pango-hierarchy.html +42 -8
  124. data/vendor/local/share/gtk-doc/html/pango/pango-pango-renderer.html +106 -150
  125. data/vendor/local/share/gtk-doc/html/pango/pango-querymodules.html +3 -3
  126. data/vendor/local/share/gtk-doc/html/pango/pango.devhelp2 +35 -35
  127. data/vendor/local/share/gtk-doc/html/pango/pango.html +3 -3
  128. data/vendor/local/share/gtk-doc/html/pango/rendering.html +3 -3
  129. data/vendor/local/share/gtk-doc/html/pango/style.css +2 -1
  130. data/vendor/local/share/gtk-doc/html/pango/tools.html +3 -3
  131. data/vendor/local/share/man/man1/pango-querymodules.1 +12 -3
  132. data/vendor/local/share/man/man1/pango-view.1 +2 -2
  133. data/vendor/local/src/dieterv/packaging/pango_1.29.4-1_win32.log +806 -0
  134. data/vendor/local/src/{tml/packaging/pango_1.28.3-1_win32.sh → dieterv/packaging/pango_1.29.4-1_win32.sh} +7 -7
  135. metadata +19 -19
  136. data/ChangeLog +0 -721
  137. data/ext/pango/rbpangoinits.c +0 -72
  138. data/ext/pango/rbpangomain.c +0 -202
  139. data/vendor/local/share/gtk-doc/html/pango/pango.devhelp +0 -799
  140. data/vendor/local/src/tml/packaging/pango_1.28.3-1_win32.log +0 -950
data/ext/pango/extconf.rb CHANGED
@@ -30,6 +30,9 @@ rescue LoadError
30
30
  require 'mkmf-gnome2'
31
31
  end
32
32
 
33
+ ruby_header = "ruby.h"
34
+ have_func("rb_errinfo", ruby_header)
35
+
33
36
  ["glib2"].each do |package|
34
37
  directory = "#{package}#{version_suffix}"
35
38
  build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
data/ext/pango/rbpango.c CHANGED
@@ -1,27 +1,327 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
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
+ */
3
21
 
4
- rbpango.c -
22
+ #include "rbpangoprivate.h"
5
23
 
6
- $Author: mutoh $
7
- $Date: 2005/09/28 18:04:21 $
24
+ #define RG_TARGET_NAMESPACE mPango
8
25
 
9
- Copyright (C) 2002-2005 Masao Mutoh
10
- ************************************************/
26
+ VALUE RG_TARGET_NAMESPACE;
11
27
 
12
- #include "rbpango.h"
28
+ extern void Init_pango(void);
13
29
 
14
- VALUE mPango;
30
+ /*
31
+ * Rendering
32
+ */
33
+
34
+ struct rpango_reorder_items_args {
35
+ PangoItem *item;
36
+ VALUE ary;
37
+ long n;
38
+ GList *result;
39
+ };
40
+
41
+ static VALUE
42
+ rpango_reorder_items_body(VALUE value)
43
+ {
44
+ struct rpango_reorder_items_args *args = (struct rpango_reorder_items_args *)value;
45
+ long i;
46
+ GList *result;
47
+
48
+ for (i = 0; i < args->n; i++)
49
+ args->result = g_list_append(args->result,
50
+ RVAL2PANGOITEM(RARRAY_PTR(args->ary)[i]));
51
+
52
+ result = pango_reorder_items(args->result);
53
+ g_list_free(args->result);
54
+
55
+ return GLIST2ARY2(result, PANGO_TYPE_ITEM);
56
+ }
57
+
58
+ static VALUE
59
+ rpango_reorder_items_ensure(VALUE value)
60
+ {
61
+ g_list_free(((struct rpango_reorder_items_args *)value)->result);
62
+
63
+ return Qnil;
64
+ }
65
+
66
+ static VALUE
67
+ rg_m_reorder_items(G_GNUC_UNUSED VALUE self, VALUE attrs)
68
+ {
69
+ struct rpango_reorder_items_args args;
70
+ args.ary = rb_ary_to_ary(attrs);
71
+ args.n = RARRAY_LEN(args.ary);
72
+ args.result = NULL;
73
+
74
+ return rb_ensure(rpango_reorder_items_body, (VALUE)&args,
75
+ rpango_reorder_items_ensure, (VALUE)&args);
76
+ }
77
+
78
+ #if PANGO_CHECK_VERSION(1,4,0)
79
+ static VALUE
80
+ rg_m_unichar_direction(G_GNUC_UNUSED VALUE self, VALUE ch)
81
+ {
82
+ return PANGODIRECTION2RVAL(pango_unichar_direction(NUM2UINT(ch)));
83
+ }
84
+
85
+ static VALUE
86
+ rg_m_find_base_dir(G_GNUC_UNUSED VALUE self, VALUE text)
87
+ {
88
+ StringValue(text);
89
+ return PANGODIRECTION2RVAL(pango_find_base_dir(RSTRING_PTR(text), RSTRING_LEN(text)));
90
+ }
91
+ #endif
92
+
93
+ struct rbg_pangologattrs2rval_free_args {
94
+ PangoLogAttr *attrs;
95
+ long n;
96
+ };
97
+
98
+ static VALUE
99
+ rbg_pangologattrs2rval_free_body(VALUE value)
100
+ {
101
+ struct rbg_pangologattrs2rval_free_args *args = (struct rbg_pangologattrs2rval_free_args *)value;
102
+ long i;
103
+ VALUE ary = rb_ary_new();
104
+
105
+ for (i = 0; i < args->n; i++)
106
+ rb_ary_push(ary, PANGOLOGATTR2RVAL(&args->attrs[i]));
107
+
108
+ return ary;
109
+ }
110
+
111
+ static VALUE
112
+ rbg_pangologattrs2rval_free_ensure(VALUE value)
113
+ {
114
+ g_free(((struct rbg_pangologattrs2rval_free_args *)value)->attrs);
115
+
116
+ return Qnil;
117
+ }
118
+
119
+ static VALUE
120
+ rbg_pangologattrs2rval_free(PangoLogAttr *attrs, long n)
121
+ {
122
+ struct rbg_pangologattrs2rval_free_args args = { attrs, n };
123
+
124
+ return rb_ensure(rbg_pangologattrs2rval_free_body, (VALUE)&args,
125
+ rbg_pangologattrs2rval_free_ensure, (VALUE)&args);
126
+ }
127
+
128
+ #define PANGOLOGATTRS2RVAL_FREE(attrs, n) rbg_pangologattrs2rval_free(attrs, n)
129
+
130
+ static VALUE
131
+ rg_m_break(G_GNUC_UNUSED VALUE self, VALUE rbtext, VALUE rbanalysis)
132
+ {
133
+ const gchar *text = RVAL2CSTR(rbtext);
134
+ long length = RSTRING_LEN(rbtext);
135
+ PangoAnalysis *analysis = RVAL2PANGOANALYSIS(rbanalysis);
136
+ long n = g_utf8_strlen(text, length) + 1;
137
+ PangoLogAttr *attrs = g_new(PangoLogAttr, n);
138
+
139
+ pango_break(text, length, analysis, attrs, n);
140
+
141
+ return PANGOLOGATTRS2RVAL_FREE(attrs, n);
142
+ }
143
+
144
+ static VALUE
145
+ rg_m_get_log_attrs(G_GNUC_UNUSED VALUE self, VALUE rbtext, VALUE rblevel, VALUE rblanguage)
146
+ {
147
+ const gchar *text = RVAL2CSTR(rbtext);
148
+ long length = RSTRING_LEN(rbtext);
149
+ int level = NUM2INT(rblevel);
150
+ PangoLanguage *language = RVAL2PANGOLANGUAGE(rblanguage);
151
+ long n = g_utf8_strlen(text, length) + 1;
152
+ PangoLogAttr *attrs = g_new(PangoLogAttr, n);
153
+
154
+ pango_get_log_attrs(text, length, level, language, attrs, n);
155
+
156
+ return PANGOLOGATTRS2RVAL_FREE(attrs, n);
157
+ }
158
+
159
+ static VALUE
160
+ rg_m_find_paragraph_boundary(G_GNUC_UNUSED VALUE self, VALUE text)
161
+ {
162
+ gint paragraph_delimiter_index, next_paragraph_start;
163
+
164
+ StringValue(text);
165
+ pango_find_paragraph_boundary(RSTRING_PTR(text), RSTRING_LEN(text),
166
+ &paragraph_delimiter_index,
167
+ &next_paragraph_start);
168
+ return rb_ary_new3(2, INT2NUM(paragraph_delimiter_index),
169
+ INT2NUM(next_paragraph_start));
170
+ }
171
+
172
+ /*
173
+ Don't need to implement this. Use pango_break instead.
174
+ void pango_default_break (const gchar *text,
175
+ int length,
176
+ PangoAnalysis *analysis,
177
+ PangoLogAttr *attrs,
178
+ int attrs_len);
179
+ */
180
+
181
+ static VALUE
182
+ rpango_shape_result(VALUE value)
183
+ {
184
+ return PANGOGLYPHSTRING2RVAL((PangoGlyphString *)value);
185
+ }
186
+
187
+ static VALUE
188
+ rpango_shape_ensure(VALUE value)
189
+ {
190
+ pango_glyph_string_free((PangoGlyphString *)value);
191
+
192
+ return Qnil;
193
+ }
194
+
195
+ static VALUE
196
+ rg_m_shape(G_GNUC_UNUSED VALUE self, VALUE rbtext, VALUE rbanalysis)
197
+ {
198
+ const gchar *text = RVAL2CSTR(rbtext);
199
+ long length = RSTRING_LEN(rbtext);
200
+ PangoAnalysis *analysis = RVAL2PANGOANALYSIS(rbanalysis);
201
+ PangoGlyphString *glyphs = pango_glyph_string_new();
202
+
203
+ pango_shape(text, length, analysis, glyphs);
204
+
205
+ return rb_ensure(rpango_shape_result, (VALUE)glyphs,
206
+ rpango_shape_ensure, (VALUE)glyphs);
207
+ }
208
+
209
+ /* This method is from rbpangoattribute.c */
210
+ static VALUE
211
+ rg_m_parse_markup(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
212
+ {
213
+ VALUE markup_text, accel_marker;
214
+ PangoAttrList *pattr_list;
215
+ gchar* gtext;
216
+ gunichar accel_char;
217
+ GError *error = NULL;
218
+ gboolean ret;
219
+ char c;
220
+ VALUE text = Qnil;
221
+ VALUE attr_list = Qnil;
222
+
223
+ rb_scan_args(argc, argv, "11", &markup_text, &accel_marker);
224
+
225
+ if (NIL_P(markup_text)) rb_raise(rb_eRuntimeError, "1st argument can't accept nil");
226
+
227
+ StringValue(markup_text);
228
+ ret = pango_parse_markup(RSTRING_PTR(markup_text),
229
+ RSTRING_LEN(markup_text),
230
+ NIL_P(accel_marker) ? 0 : NUM2CHR(accel_marker),
231
+ &pattr_list, &gtext, &accel_char, &error);
232
+
233
+ if (!ret) RAISE_GERROR(error);
234
+
235
+ if (pattr_list){
236
+ attr_list = PANGOATTRLIST2RVAL(pattr_list);
237
+ pango_attr_list_unref(pattr_list);
238
+ }
239
+
240
+ c = (char)accel_char;
241
+ if (text){
242
+ text = CSTR2RVAL(gtext);
243
+ g_free(gtext);
244
+ }
245
+ return rb_ary_new3(3, attr_list, text,
246
+ accel_char ? rb_str_new(&c, 1) : Qnil);
247
+ }
248
+
249
+ static VALUE
250
+ rg_m_pixels(G_GNUC_UNUSED VALUE self, VALUE pixels)
251
+ {
252
+ return rb_float_new(PANGO_PIXELS(NUM2DBL(pixels)));
253
+ }
254
+
255
+ static VALUE
256
+ rg_m_cairo_available_p(G_GNUC_UNUSED VALUE self)
257
+ {
258
+ #ifdef CAIRO_AVAILABLE
259
+ return Qtrue;
260
+ #else
261
+ return Qfalse;
262
+ #endif
263
+ }
15
264
 
16
265
  void
17
- Init_pango()
266
+ Init_pango(void)
18
267
  {
19
- mPango = rb_define_module("Pango");
268
+ RG_TARGET_NAMESPACE = rb_define_module("Pango");
20
269
 
21
- rb_define_const(mPango, "BUILD_VERSION",
270
+ rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION",
22
271
  rb_ary_new3(3,
23
272
  INT2FIX(PANGO_MAJOR_VERSION),
24
273
  INT2FIX(PANGO_MINOR_VERSION),
25
274
  INT2FIX(PANGO_MICRO_VERSION)));
26
- Init_pango_inits();
275
+
276
+ RG_DEF_MODFUNC(reorder_items, 1);
277
+
278
+ #if PANGO_CHECK_VERSION(1,4,0)
279
+ RG_DEF_MODFUNC(unichar_direction, 1);
280
+ RG_DEF_MODFUNC(find_base_dir, 1);
281
+ #endif
282
+ RG_DEF_MODFUNC(break, 2);
283
+ RG_DEF_MODFUNC(get_log_attrs, 3);
284
+ RG_DEF_MODFUNC(find_paragraph_boundary, 1);
285
+ RG_DEF_MODFUNC(shape, 2);
286
+ RG_DEF_MODFUNC(parse_markup, -1);
287
+ RG_DEF_MODFUNC(pixels, 1);
288
+
289
+ rb_define_const(RG_TARGET_NAMESPACE, "SCALE", INT2FIX(PANGO_SCALE));
290
+
291
+ RG_DEF_MODFUNC_P(cairo_available, 0);
292
+
293
+ Init_pango_analysis(RG_TARGET_NAMESPACE);
294
+ Init_pango_attribute(RG_TARGET_NAMESPACE);
295
+ Init_pango_attriterator(RG_TARGET_NAMESPACE);
296
+ Init_pango_attrlist(RG_TARGET_NAMESPACE);
297
+ Init_pango_cairo(RG_TARGET_NAMESPACE);
298
+ Init_pango_cairo_context(RG_TARGET_NAMESPACE);
299
+ Init_pango_color(RG_TARGET_NAMESPACE);
300
+ Init_pango_context(RG_TARGET_NAMESPACE);
301
+ Init_pango_coverage(RG_TARGET_NAMESPACE);
302
+ Init_pango_engine(RG_TARGET_NAMESPACE);
303
+ Init_pango_font(RG_TARGET_NAMESPACE);
304
+ Init_pango_font_description(RG_TARGET_NAMESPACE);
305
+ Init_pango_font_face(RG_TARGET_NAMESPACE);
306
+ Init_pango_font_family(RG_TARGET_NAMESPACE);
307
+ Init_pango_font_map(RG_TARGET_NAMESPACE);
308
+ Init_pango_font_metrics(RG_TARGET_NAMESPACE);
309
+ Init_pango_fontset(RG_TARGET_NAMESPACE);
310
+ Init_pango_fontset_simple(RG_TARGET_NAMESPACE);
311
+ Init_pango_glyph_info(RG_TARGET_NAMESPACE);
312
+ Init_pango_glyph_item(RG_TARGET_NAMESPACE);
313
+ Init_pango_glyph_string(RG_TARGET_NAMESPACE);
314
+ Init_pango_gravity(RG_TARGET_NAMESPACE);
315
+ Init_pango_item(RG_TARGET_NAMESPACE);
316
+ Init_pango_language(RG_TARGET_NAMESPACE);
317
+ Init_pango_layout(RG_TARGET_NAMESPACE);
318
+ Init_pango_layout_iter(RG_TARGET_NAMESPACE);
319
+ Init_pango_layout_line(RG_TARGET_NAMESPACE);
320
+ Init_pango_logattr(RG_TARGET_NAMESPACE);
321
+ Init_pango_matrix(RG_TARGET_NAMESPACE);
322
+ Init_pango_rectangle(RG_TARGET_NAMESPACE);
323
+ Init_pangorenderer(RG_TARGET_NAMESPACE);
324
+ Init_pango_script(RG_TARGET_NAMESPACE);
325
+ Init_pango_script_iter(RG_TARGET_NAMESPACE);
326
+ Init_pango_array(RG_TARGET_NAMESPACE);
27
327
  }
data/ext/pango/rbpango.h CHANGED
@@ -1,29 +1,40 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbpango.h -
5
-
6
- $Author: ktou $
7
- $Date: 2005/10/05 11:16:26 $
8
-
9
- Copyright (C) 2002-2005 Masao Mutoh
10
- ************************************************/
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
+ */
11
21
 
12
22
  #include "ruby.h"
13
23
  #define PANGO_ENABLE_ENGINE
14
24
  #define PANGO_ENABLE_BACKEND
15
25
  #include <pango/pango.h>
16
26
 
17
- #if HAVE_FREETYPE2
27
+ #ifdef HAVE_FREETYPE2
18
28
  #include <pango/pangofc-font.h>
19
29
  #endif
20
30
 
21
31
  #include "rbgobject.h"
22
32
  #include "rbpangoversion.h"
33
+ #include "rbpangoconversions.h"
23
34
 
24
35
  #if PANGO_CHECK_VERSION(1,10,0)
25
36
  #include <pango/pangocairo.h>
26
- # if HAVE_RB_CAIRO_H
37
+ # ifdef HAVE_RB_CAIRO_H
27
38
  #include <rb_cairo.h>
28
39
  # endif
29
40
  #endif
@@ -72,21 +83,21 @@ RUBY_PANGO_VAR VALUE mPango;
72
83
  extern VALUE pango_make_attribute(PangoAttribute* attr);
73
84
  extern PangoAttribute* pango_get_attribute(VALUE attr);
74
85
 
75
- extern GType pango_item_get_type();
76
- extern GType pango_analysis_get_type();
77
- extern GType pango_log_attr_get_type();
78
- extern GType pango_layout_iter_get_type();
79
- extern GType pango_layout_line_get_type();
80
- extern GType pango_rectangle_get_type();
81
- extern GType pango_attr_iter_get_type();
82
- extern GType pango_coverage_get_type();
83
- extern GType pango_glyph_info_get_type();
86
+ extern GType pango_item_get_type(void);
87
+ extern GType pango_analysis_get_type(void);
88
+ extern GType pango_log_attr_get_type(void);
89
+ extern GType pango_layout_iter_get_type(void);
90
+ extern GType pango_layout_line_get_type(void);
91
+ extern GType pango_rectangle_get_type(void);
92
+ extern GType pango_attr_iter_get_type(void);
93
+ extern GType pango_coverage_get_type(void);
94
+ extern GType pango_glyph_info_get_type(void);
84
95
  #ifndef HAVE_PANGO_GLYPH_ITEM_GET_TYPE
85
- extern GType pango_glyph_item_get_type();
96
+ extern GType pango_glyph_item_get_type(void);
86
97
  #endif
87
98
 
88
99
  #if PANGO_CHECK_VERSION(1,4,0)
89
- extern GType pango_script_iter_get_type();
100
+ extern GType pango_script_iter_get_type(void);
90
101
  #endif
91
102
 
92
103
  extern VALUE pango_get_attribute_klass(VALUE attr_type);
@@ -1,17 +1,28 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbpangoanalysis.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2005/09/17 17:09:13 $
8
-
9
- Copyright (C) 2003-2005 Masao Mutoh
10
- ************************************************/
11
-
12
- #include "rbpango.h"
13
-
14
- #define _SELF(s) ((PangoAnalysis*)RVAL2BOXED(s, PANGO_TYPE_ANALYSIS))
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2003-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 cAnalysis
25
+ #define _SELF(s) (RVAL2PANGOANALYSIS(s))
15
26
 
16
27
  /**********************************/
17
28
  static PangoAnalysis*
@@ -23,12 +34,12 @@ ana_copy(const PangoAnalysis* val)
23
34
  *new_val = *val;
24
35
  return new_val;
25
36
  }
26
-
37
+
27
38
  GType
28
39
  pango_analysis_get_type(void)
29
40
  {
30
41
  static GType our_type = 0;
31
-
42
+
32
43
  if (our_type == 0)
33
44
  our_type = g_boxed_type_register_static ("PangoAnalysis",
34
45
  (GBoxedCopyFunc)ana_copy,
@@ -38,22 +49,22 @@ pango_analysis_get_type(void)
38
49
  /**********************************/
39
50
 
40
51
  static VALUE
41
- ana_initialize(VALUE self)
52
+ rg_initialize(VALUE self)
42
53
  {
43
- PangoAnalysis ana = { NULL, NULL, NULL, 0 };
54
+ PangoAnalysis ana = { NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL };
44
55
  G_INITIALIZE(self, &ana);
45
56
  return Qnil;
46
57
  }
47
58
 
48
59
  #if PANGO_CHECK_VERSION(1,4,0)
49
60
  static VALUE
50
- ana_set_shape_engine(VALUE self, VALUE engine)
61
+ rg_set_shape_engine(VALUE self, VALUE engine)
51
62
  {
52
- _SELF(self)->shape_engine = PANGO_ENGINE_SHAPE(RVAL2GOBJ(engine));
63
+ _SELF(self)->shape_engine = RVAL2PANGOENGINESHAPE(engine);
53
64
  return self;
54
65
  }
55
66
  static VALUE
56
- ana_get_shape_engine(VALUE self)
67
+ rg_shape_engine(VALUE self)
57
68
  {
58
69
  VALUE ret;
59
70
  if (_SELF(self)->shape_engine){
@@ -69,13 +80,13 @@ ana_get_shape_engine(VALUE self)
69
80
  }
70
81
 
71
82
  static VALUE
72
- ana_set_lang_engine(VALUE self, VALUE engine)
83
+ rg_set_lang_engine(VALUE self, VALUE engine)
73
84
  {
74
- _SELF(self)->lang_engine = PANGO_ENGINE_LANG(RVAL2GOBJ(engine));
85
+ _SELF(self)->lang_engine = RVAL2PANGOENGINELANG(engine);
75
86
  return self;
76
87
  }
77
88
  static VALUE
78
- ana_get_lang_engine(VALUE self)
89
+ rg_lang_engine(VALUE self)
79
90
  {
80
91
  VALUE ret;
81
92
  if (_SELF(self)->lang_engine){
@@ -92,61 +103,90 @@ ana_get_lang_engine(VALUE self)
92
103
  #endif
93
104
 
94
105
  static VALUE
95
- ana_set_font(VALUE self, VALUE font)
106
+ rg_set_font(VALUE self, VALUE font)
96
107
  {
97
- _SELF(self)->font = PANGO_FONT(RVAL2GOBJ(font));
108
+ _SELF(self)->font = RVAL2PANGOFONT(font);
98
109
  return self;
99
110
  }
100
111
 
101
112
  static VALUE
102
- ana_get_font(VALUE self)
113
+ rg_font(VALUE self)
103
114
  {
104
115
  return GOBJ2RVAL(_SELF(self)->font);
105
116
  }
106
117
 
107
118
  static VALUE
108
- ana_set_level(VALUE self, VALUE level)
119
+ rg_set_level(VALUE self, VALUE level)
109
120
  {
110
121
  _SELF(self)->level = NUM2UINT(level);
111
122
  return self;
112
123
  }
113
124
 
114
125
  static VALUE
115
- ana_get_level(VALUE self)
126
+ rg_level(VALUE self)
116
127
  {
117
128
  return UINT2NUM(_SELF(self)->level);
118
129
  }
119
130
 
120
131
  static VALUE
121
- ana_set_language(VALUE self, VALUE lang)
132
+ rg_set_language(VALUE self, VALUE lang)
122
133
  {
123
- _SELF(self)->language = RVAL2BOXED(lang, PANGO_TYPE_LANGUAGE);
134
+ _SELF(self)->language = RVAL2PANGOLANGUAGE(lang);
124
135
  return self;
125
136
  }
126
137
 
127
138
  static VALUE
128
- ana_get_language(VALUE self)
139
+ rg_language(VALUE self)
129
140
  {
130
- return BOXED2RVAL(_SELF(self)->language, PANGO_TYPE_LANGUAGE);
141
+ return PANGOLANGUAGE2RVAL(_SELF(self)->language);
131
142
  }
132
143
 
144
+ struct ana_set_extra_attrs_args {
145
+ PangoAnalysis *analysis;
146
+ VALUE ary;
147
+ long n;
148
+ GSList *result;
149
+ };
150
+
133
151
  static VALUE
134
- ana_set_extra_attrs(VALUE self, VALUE attrs)
152
+ ana_set_extra_attrs_body(VALUE value)
135
153
  {
136
- gint i;
137
- gint len = RARRAY_LEN(attrs);
138
- GSList* gattrs = NULL;
154
+ struct ana_set_extra_attrs_args *args = (struct ana_set_extra_attrs_args *)value;
155
+ long i;
139
156
 
140
- for (i = 0; i < len; i++){
141
- gattrs = g_slist_append(gattrs, RVAL2ATTR(RARRAY_PTR(attrs)[i]));
142
- }
157
+ for (i = 0; i < args->n; i++)
158
+ args->result = g_slist_append(args->result, RVAL2ATTR(RARRAY_PTR(args->ary)[i]));
159
+
160
+ args->analysis->extra_attrs = args->result;
161
+
162
+ return Qnil;
163
+ }
164
+
165
+ static G_GNUC_NORETURN VALUE
166
+ ana_set_extra_attrs_rescue(VALUE value)
167
+ {
168
+ g_slist_free(((struct ana_set_extra_attrs_args *)value)->result);
169
+
170
+ rb_exc_raise(rb_errinfo());
171
+ }
172
+
173
+ static VALUE
174
+ rg_set_extra_attrs(VALUE self, VALUE attrs)
175
+ {
176
+ struct ana_set_extra_attrs_args args;
177
+ args.analysis = _SELF(self);
178
+ args.ary = rb_ary_to_ary(attrs);
179
+ args.n = RARRAY_LEN(args.ary);
180
+ args.result = NULL;
181
+
182
+ rb_rescue(ana_set_extra_attrs_body, (VALUE)&args,
183
+ ana_set_extra_attrs_rescue, (VALUE)&args);
143
184
 
144
- _SELF(self)->extra_attrs = gattrs;
145
185
  return self;
146
186
  }
147
187
 
148
188
  static VALUE
149
- ana_get_extra_attrs(VALUE self)
189
+ rg_extra_attrs(VALUE self)
150
190
  {
151
191
  VALUE ary = rb_ary_new();
152
192
  GSList* list = _SELF(self)->extra_attrs;
@@ -159,26 +199,26 @@ ana_get_extra_attrs(VALUE self)
159
199
  }
160
200
 
161
201
  void
162
- Init_pango_analysis()
202
+ Init_pango_analysis(VALUE mPango)
163
203
  {
164
- VALUE pana = G_DEF_CLASS(PANGO_TYPE_ANALYSIS, "Analysis", mPango);
165
-
166
- rb_define_method(pana, "initialize", ana_initialize, 0);
204
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_ANALYSIS, "Analysis", mPango);
205
+
206
+ RG_DEF_METHOD(initialize, 0);
167
207
  #if PANGO_CHECK_VERSION(1,4,0)
168
- rb_define_method(pana, "set_shape_engine", ana_set_shape_engine, 1);
169
- rb_define_method(pana, "shape_engine", ana_get_shape_engine, 0);
170
- rb_define_method(pana, "set_lang_engine", ana_set_lang_engine, 1);
171
- rb_define_method(pana, "lang_engine", ana_get_lang_engine, 0);
208
+ RG_DEF_METHOD(set_shape_engine, 1);
209
+ RG_DEF_METHOD(shape_engine, 0);
210
+ RG_DEF_METHOD(set_lang_engine, 1);
211
+ RG_DEF_METHOD(lang_engine, 0);
172
212
  #endif
173
- rb_define_method(pana, "set_font", ana_set_font, 1);
174
- rb_define_method(pana, "font", ana_get_font, 0);
175
- rb_define_method(pana, "set_level", ana_set_level, 1);
176
- rb_define_method(pana, "level", ana_get_level, 0);
177
- rb_define_method(pana, "set_language", ana_set_language, 1);
178
- rb_define_method(pana, "language", ana_get_language, 0);
213
+ RG_DEF_METHOD(set_font, 1);
214
+ RG_DEF_METHOD(font, 0);
215
+ RG_DEF_METHOD(set_level, 1);
216
+ RG_DEF_METHOD(level, 0);
217
+ RG_DEF_METHOD(set_language, 1);
218
+ RG_DEF_METHOD(language, 0);
179
219
 
180
- rb_define_method(pana, "set_extra_attrs", ana_set_extra_attrs, 1);
181
- rb_define_method(pana, "extra_attrs", ana_get_extra_attrs, 0);
220
+ RG_DEF_METHOD(set_extra_attrs, 1);
221
+ RG_DEF_METHOD(extra_attrs, 0);
182
222
 
183
- G_DEF_SETTERS(pana);
223
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
184
224
  }