pango 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) 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. metadata +12 -12
  41. data/ChangeLog +0 -721
  42. data/ext/pango/rbpangoinits.c +0 -72
  43. data/ext/pango/rbpangomain.c +0 -202
@@ -1,72 +0,0 @@
1
- extern void Init_pango_analysis();
2
- extern void Init_pango_attribute();
3
- extern void Init_pango_attriterator();
4
- extern void Init_pango_attrlist();
5
- extern void Init_pango_cairo();
6
- extern void Init_pango_color();
7
- extern void Init_pango_context();
8
- extern void Init_pango_coverage();
9
- extern void Init_pango_engine();
10
- extern void Init_pango_font();
11
- extern void Init_pango_font_description();
12
- extern void Init_pango_font_face();
13
- extern void Init_pango_font_family();
14
- extern void Init_pango_font_map();
15
- extern void Init_pango_font_metrics();
16
- extern void Init_pango_fontset();
17
- extern void Init_pango_fontset_simple();
18
- extern void Init_pango_glyph_info();
19
- extern void Init_pango_glyph_item();
20
- extern void Init_pango_glyph_string();
21
- extern void Init_pango_gravity();
22
- extern void Init_pango_item();
23
- extern void Init_pango_language();
24
- extern void Init_pango_layout();
25
- extern void Init_pango_layout_iter();
26
- extern void Init_pango_layout_line();
27
- extern void Init_pango_logattr();
28
- extern void Init_pango_main();
29
- extern void Init_pango_matrix();
30
- extern void Init_pango_rectangle();
31
- extern void Init_pangorenderer();
32
- extern void Init_pango_script();
33
- extern void Init_pango_script_iter();
34
- extern void Init_pango_array();
35
- void
36
- Init_pango_inits()
37
- {
38
- Init_pango_analysis();
39
- Init_pango_attribute();
40
- Init_pango_attriterator();
41
- Init_pango_attrlist();
42
- Init_pango_cairo();
43
- Init_pango_color();
44
- Init_pango_context();
45
- Init_pango_coverage();
46
- Init_pango_engine();
47
- Init_pango_font();
48
- Init_pango_font_description();
49
- Init_pango_font_face();
50
- Init_pango_font_family();
51
- Init_pango_font_map();
52
- Init_pango_font_metrics();
53
- Init_pango_fontset();
54
- Init_pango_fontset_simple();
55
- Init_pango_glyph_info();
56
- Init_pango_glyph_item();
57
- Init_pango_glyph_string();
58
- Init_pango_gravity();
59
- Init_pango_item();
60
- Init_pango_language();
61
- Init_pango_layout();
62
- Init_pango_layout_iter();
63
- Init_pango_layout_line();
64
- Init_pango_logattr();
65
- Init_pango_main();
66
- Init_pango_matrix();
67
- Init_pango_rectangle();
68
- Init_pangorenderer();
69
- Init_pango_script();
70
- Init_pango_script_iter();
71
- Init_pango_array();
72
- }
@@ -1,202 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbpangomain.c -
5
-
6
- $Author: sakai $
7
- $Date: 2007/07/08 02:53:10 $
8
-
9
- Copyright (C) 2002-2005 Masao Mutoh
10
- ************************************************/
11
-
12
- #include "rbpango.h"
13
-
14
- /*
15
- * Rendering
16
- */
17
-
18
- static VALUE
19
- rpango_reorder_items(VALUE self, VALUE logical_items)
20
- {
21
- int i;
22
- GList *glist = NULL;
23
- GList* ret;
24
-
25
- Check_Type(logical_items, T_ARRAY);
26
-
27
- for (i = 0; i < RARRAY_LEN(logical_items); i++){
28
- glist = g_list_append(glist, RVAL2BOXED(RARRAY_PTR(logical_items)[i], PANGO_TYPE_ITEM));
29
- }
30
-
31
- ret = pango_reorder_items(glist);
32
- g_list_free(glist);
33
-
34
- return GLIST2ARY2(ret, PANGO_TYPE_ITEM);
35
- }
36
-
37
- #if PANGO_CHECK_VERSION(1,4,0)
38
- static VALUE
39
- rpango_unichar_direction(VALUE self, VALUE ch)
40
- {
41
- return GENUM2RVAL(pango_unichar_direction(NUM2UINT(ch)), PANGO_TYPE_DIRECTION);
42
- }
43
-
44
- static VALUE
45
- rpango_find_base_dir(VALUE self, VALUE text)
46
- {
47
- StringValue(text);
48
- return GENUM2RVAL(pango_find_base_dir(RSTRING_PTR(text), RSTRING_LEN(text)),
49
- PANGO_TYPE_DIRECTION);
50
- }
51
- #endif
52
-
53
- static VALUE
54
- rpango_break(VALUE self, VALUE text, VALUE analysis)
55
- {
56
- gint i, len;
57
- glong attrs_len;
58
- PangoLogAttr *attrs;
59
- const gchar *gtext;
60
- VALUE ret;
61
-
62
- gtext = StringValuePtr(text);
63
- len = RSTRING_LEN(text);
64
- attrs_len = g_utf8_strlen(gtext, (gssize)len) + 1l;
65
- attrs = g_new0(PangoLogAttr, attrs_len);
66
-
67
- pango_break(gtext, len,
68
- NIL_P(analysis) ? NULL : RVAL2BOXED(analysis, PANGO_TYPE_ANALYSIS),
69
- attrs, attrs_len);
70
-
71
- ret = rb_ary_new();
72
- for (i = 0; i < attrs_len; i++){
73
- rb_ary_push(ret, BOXED2RVAL(&attrs[i], PANGO_TYPE_LOG_ATTR));
74
- }
75
- g_free(attrs);
76
- return ret;
77
- }
78
-
79
- static VALUE
80
- rpango_get_log_attrs(VALUE self, VALUE text, VALUE level, VALUE language)
81
- {
82
- gint i, len;
83
- glong attrs_len;
84
- PangoLogAttr *attrs;
85
- const gchar *gtext;
86
- VALUE ret;
87
-
88
- gtext = StringValuePtr(text);
89
- len = RSTRING_LEN(text);
90
- attrs_len = g_utf8_strlen(gtext, (gssize)len) + 1l;
91
- attrs = g_new0(PangoLogAttr, attrs_len);
92
-
93
- pango_get_log_attrs(gtext, len, NUM2INT(level),
94
- RVAL2BOXED(language, PANGO_TYPE_LANGUAGE),
95
- attrs, attrs_len);
96
-
97
- ret = rb_ary_new();
98
- for (i = 0; i < attrs_len; i++){
99
- rb_ary_push(ret, BOXED2RVAL(&attrs[i], PANGO_TYPE_LOG_ATTR));
100
- }
101
- g_free(attrs);
102
- return ret;
103
- }
104
-
105
- static VALUE
106
- rpango_find_paragraph_boundary(VALUE self, VALUE text)
107
- {
108
- gint paragraph_delimiter_index, next_paragraph_start;
109
-
110
- StringValue(text);
111
- pango_find_paragraph_boundary(RSTRING_PTR(text), RSTRING_LEN(text),
112
- &paragraph_delimiter_index,
113
- &next_paragraph_start);
114
- return rb_ary_new3(2, INT2NUM(paragraph_delimiter_index),
115
- INT2NUM(next_paragraph_start));
116
- }
117
-
118
- /*
119
- Don't need to implement this. Use pango_break instead.
120
- void pango_default_break (const gchar *text,
121
- int length,
122
- PangoAnalysis *analysis,
123
- PangoLogAttr *attrs,
124
- int attrs_len);
125
- */
126
-
127
- static VALUE
128
- rpango_shape(VALUE self, VALUE text, VALUE analysis)
129
- {
130
- VALUE ret;
131
- PangoGlyphString* glyphs = pango_glyph_string_new();
132
- StringValue(text);
133
- pango_shape(RSTRING_PTR(text), RSTRING_LEN(text), RVAL2BOXED(analysis, PANGO_TYPE_ANALYSIS), glyphs);
134
- ret = BOXED2RVAL(glyphs, PANGO_TYPE_GLYPH_STRING);
135
- pango_glyph_string_free (glyphs);
136
- return ret;
137
- }
138
-
139
- /* This method is from rbpangoattribute.c */
140
- static VALUE
141
- rpango_parse_markup(int argc, VALUE *argv, VALUE self)
142
- {
143
- VALUE markup_text, accel_marker;
144
- PangoAttrList *pattr_list;
145
- gchar* gtext;
146
- gunichar accel_char;
147
- GError *error = NULL;
148
- gboolean ret;
149
- char c;
150
- VALUE text = Qnil;
151
- VALUE attr_list = Qnil;
152
-
153
- rb_scan_args(argc, argv, "11", &markup_text, &accel_marker);
154
-
155
- if (NIL_P(markup_text)) rb_raise(rb_eRuntimeError, "1st argument can't accept nil");
156
-
157
- StringValue(markup_text);
158
- ret = pango_parse_markup(RSTRING_PTR(markup_text),
159
- RSTRING_LEN(markup_text),
160
- NIL_P(accel_marker) ? 0 : NUM2CHR(accel_marker),
161
- &pattr_list, &gtext, &accel_char, &error);
162
-
163
- if (!ret) RAISE_GERROR(error);
164
-
165
- if (pattr_list){
166
- attr_list = BOXED2RVAL(pattr_list, PANGO_TYPE_ATTR_LIST);
167
- pango_attr_list_unref(pattr_list);
168
- }
169
-
170
- c = (char)accel_char;
171
- if (text){
172
- text = CSTR2RVAL(gtext);
173
- g_free(gtext);
174
- }
175
- return rb_ary_new3(3, attr_list, text,
176
- accel_char ? rb_str_new(&c, 1) : Qnil);
177
- }
178
-
179
- static VALUE
180
- rpango_pixels(VALUE self, VALUE pixels)
181
- {
182
- return rb_float_new(PANGO_PIXELS(NUM2DBL(pixels)));
183
- }
184
-
185
- void
186
- Init_pango_main()
187
- {
188
- rb_define_module_function(mPango, "reorder_items", rpango_reorder_items, 1);
189
-
190
- #if PANGO_CHECK_VERSION(1,4,0)
191
- rb_define_module_function(mPango, "unichar_direction", rpango_unichar_direction, 1);
192
- rb_define_module_function(mPango, "find_base_dir", rpango_find_base_dir, 1);
193
- #endif
194
- rb_define_module_function(mPango, "break", rpango_break, 2);
195
- rb_define_module_function(mPango, "get_log_attrs", rpango_get_log_attrs, 3);
196
- rb_define_module_function(mPango, "find_paragraph_boundary", rpango_find_paragraph_boundary, 1);
197
- rb_define_module_function(mPango, "shape", rpango_shape, 2);
198
- rb_define_module_function(mPango, "parse_markup", rpango_parse_markup, -1);
199
- rb_define_module_function(mPango, "pixels", rpango_pixels, 1);
200
-
201
- rb_define_const(mPango, "SCALE", INT2FIX(PANGO_SCALE));
202
- }