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,50 +1,60 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2002,2003 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"
|
13
23
|
|
14
24
|
#ifdef PANGO_ENABLE_BACKEND
|
15
25
|
|
16
|
-
#define
|
17
|
-
#define
|
26
|
+
#define RG_TARGET_NAMESPACE cFontsetSimple
|
27
|
+
#define _SELF(self) (RVAL2PANGOFONTSETSIMPLE(self))
|
18
28
|
|
19
29
|
static VALUE
|
20
|
-
|
30
|
+
rg_initialize(VALUE self, VALUE lang)
|
21
31
|
{
|
22
|
-
G_INITIALIZE(self, pango_fontset_simple_new(
|
32
|
+
G_INITIALIZE(self, pango_fontset_simple_new(RVAL2PANGOLANGUAGE(lang)));
|
23
33
|
return Qnil;
|
24
34
|
}
|
25
35
|
|
26
36
|
static VALUE
|
27
|
-
|
37
|
+
rg_append(VALUE self, VALUE font)
|
28
38
|
{
|
29
|
-
pango_fontset_simple_append(_SELF(self),
|
39
|
+
pango_fontset_simple_append(_SELF(self), RVAL2PANGOFONT(font));
|
30
40
|
return self;
|
31
41
|
}
|
32
42
|
|
33
43
|
static VALUE
|
34
|
-
|
44
|
+
rg_size(VALUE self)
|
35
45
|
{
|
36
46
|
return INT2NUM(pango_fontset_simple_size(_SELF(self)));
|
37
47
|
}
|
38
48
|
|
39
49
|
#endif
|
40
50
|
void
|
41
|
-
Init_pango_fontset_simple()
|
51
|
+
Init_pango_fontset_simple(VALUE mPango)
|
42
52
|
{
|
43
53
|
#ifdef PANGO_ENABLE_BACKEND
|
44
|
-
VALUE
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
54
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_FONTSET_SIMPLE, "FontsetSimple", mPango);
|
55
|
+
|
56
|
+
RG_DEF_METHOD(initialize, 1);
|
57
|
+
RG_DEF_METHOD(append, 1);
|
58
|
+
RG_DEF_METHOD(size, 0);
|
49
59
|
#endif
|
50
60
|
}
|
@@ -1,27 +1,40 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 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
|
+
*/
|
13
21
|
|
14
|
-
#
|
22
|
+
#include "rbpangoprivate.h"
|
15
23
|
|
24
|
+
#define RG_TARGET_NAMESPACE cGlyphInfo
|
25
|
+
#define _SELF(self) (RVAL2PANGOGLYPHINFO(self))
|
16
26
|
|
17
27
|
/**********************************/
|
18
|
-
PangoGlyphInfo*
|
19
|
-
pango_glyph_info_copy
|
28
|
+
static PangoGlyphInfo *
|
29
|
+
pango_glyph_info_copy(const PangoGlyphInfo *info)
|
20
30
|
{
|
21
|
-
PangoGlyphInfo*
|
22
|
-
|
31
|
+
PangoGlyphInfo *data;
|
32
|
+
|
33
|
+
g_return_val_if_fail(info != NULL, NULL);
|
34
|
+
|
23
35
|
data = g_new(PangoGlyphInfo, 1);
|
24
36
|
*data = *info;
|
37
|
+
|
25
38
|
return data;
|
26
39
|
}
|
27
40
|
|
@@ -39,27 +52,27 @@ pango_glyph_info_get_type(void)
|
|
39
52
|
/**********************************/
|
40
53
|
|
41
54
|
static VALUE
|
42
|
-
|
55
|
+
rg_initialize(VALUE self)
|
43
56
|
{
|
44
57
|
G_INITIALIZE(self, g_new0(PangoGlyphInfo, 1));
|
45
58
|
return Qnil;
|
46
59
|
}
|
47
60
|
|
48
61
|
static VALUE
|
49
|
-
|
62
|
+
rg_glyph(VALUE self)
|
50
63
|
{
|
51
64
|
return UINT2NUM(_SELF(self)->glyph);
|
52
65
|
}
|
53
66
|
|
54
67
|
static VALUE
|
55
|
-
|
68
|
+
rg_set_glyph(VALUE self, VALUE val)
|
56
69
|
{
|
57
70
|
_SELF(self)->glyph = NUM2UINT(val);
|
58
71
|
return self;
|
59
72
|
}
|
60
73
|
|
61
74
|
static VALUE
|
62
|
-
|
75
|
+
rg_geometry(VALUE self)
|
63
76
|
{
|
64
77
|
PangoGlyphGeometry geo = _SELF(self)->geometry;
|
65
78
|
|
@@ -68,7 +81,7 @@ gi_geometry(VALUE self)
|
|
68
81
|
}
|
69
82
|
|
70
83
|
static VALUE
|
71
|
-
|
84
|
+
rg_set_geometry(VALUE self, VALUE width, VALUE x_offset, VALUE y_offset)
|
72
85
|
{
|
73
86
|
PangoGlyphGeometry geo = _SELF(self)->geometry;
|
74
87
|
|
@@ -83,30 +96,30 @@ gi_set_geometry(VALUE self, VALUE width, VALUE x_offset, VALUE y_offset)
|
|
83
96
|
This method may be changed in the future following Pango implementation.
|
84
97
|
*/
|
85
98
|
static VALUE
|
86
|
-
|
99
|
+
rg_cluster_start_p(VALUE self)
|
87
100
|
{
|
88
101
|
return CBOOL2RVAL(_SELF(self)->attr.is_cluster_start);
|
89
102
|
}
|
90
103
|
|
91
104
|
static VALUE
|
92
|
-
|
105
|
+
rg_set_cluster_start(VALUE self, VALUE val)
|
93
106
|
{
|
94
107
|
_SELF(self)->attr.is_cluster_start = RVAL2CBOOL(val);
|
95
108
|
return self;
|
96
109
|
}
|
97
110
|
|
98
111
|
void
|
99
|
-
Init_pango_glyph_info()
|
112
|
+
Init_pango_glyph_info(VALUE mPango)
|
100
113
|
{
|
101
|
-
VALUE
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
G_DEF_SETTERS(
|
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
|
+
|
124
|
+
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
112
125
|
}
|
@@ -1,18 +1,29 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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"
|
13
23
|
|
14
24
|
#if PANGO_CHECK_VERSION(1,2,0)
|
15
|
-
#define
|
25
|
+
#define RG_TARGET_NAMESPACE cGlyphItem
|
26
|
+
#define _SELF(r) (RVAL2PANGOGLYPHITEM(r))
|
16
27
|
|
17
28
|
/**********************************/
|
18
29
|
#ifndef HAVE_PANGO_GLYPH_ITEM_GET_TYPE
|
@@ -53,50 +64,50 @@ pango_glyph_item_get_type(void)
|
|
53
64
|
/**********************************/
|
54
65
|
|
55
66
|
static VALUE
|
56
|
-
|
67
|
+
rg_item(VALUE self)
|
57
68
|
{
|
58
69
|
PangoItem* item = _SELF(self)->item;
|
59
|
-
return
|
70
|
+
return PANGOITEM2RVAL(item);
|
60
71
|
}
|
61
72
|
|
62
73
|
static VALUE
|
63
|
-
|
74
|
+
rg_glyphs(VALUE self)
|
64
75
|
{
|
65
76
|
PangoGlyphString* glyphs = _SELF(self)->glyphs;
|
66
|
-
return
|
77
|
+
return PANGOGLYPHSTRING2RVAL(glyphs);
|
67
78
|
}
|
68
79
|
|
69
80
|
static VALUE
|
70
|
-
|
81
|
+
rg_split(VALUE self, VALUE text, VALUE split_index)
|
71
82
|
{
|
72
|
-
return
|
73
|
-
|
83
|
+
return PANGOGLYPHITEM2RVAL(pango_glyph_item_split(_SELF(self), RVAL2CSTR(text),
|
84
|
+
NUM2INT(split_index)));
|
74
85
|
}
|
75
86
|
|
76
87
|
static VALUE
|
77
|
-
|
88
|
+
rg_appy_attrs(VALUE self, VALUE text, VALUE attrs)
|
78
89
|
{
|
79
90
|
GSList* list = pango_glyph_item_apply_attrs(_SELF(self), RVAL2CSTR(text),
|
80
|
-
(
|
91
|
+
RVAL2PANGOATTRLIST(attrs));
|
81
92
|
|
82
93
|
VALUE ret = rb_ary_new();
|
83
94
|
|
84
95
|
while (list) {
|
85
|
-
rb_ary_push(ret,
|
96
|
+
rb_ary_push(ret, PANGOGLYPHITEM2RVAL(list->data));
|
86
97
|
pango_glyph_item_free(list->data);
|
87
98
|
list = list->next;
|
88
99
|
}
|
89
|
-
|
100
|
+
|
90
101
|
g_slist_free(list);
|
91
102
|
return ret;
|
92
103
|
}
|
93
104
|
|
94
105
|
#if PANGO_CHECK_VERSION(1,6,0)
|
95
106
|
static VALUE
|
96
|
-
|
107
|
+
rg_letter_space(VALUE self, VALUE text, VALUE log_attrs, VALUE letter_spacing)
|
97
108
|
{
|
98
109
|
pango_glyph_item_letter_space(_SELF(self), RVAL2CSTR(text),
|
99
|
-
(
|
110
|
+
RVAL2PANGOLOGATTR(log_attrs),
|
100
111
|
NUM2INT(letter_spacing));
|
101
112
|
return self;
|
102
113
|
}
|
@@ -104,20 +115,19 @@ glyph_item_letter_space(VALUE self, VALUE text, VALUE log_attrs, VALUE letter_sp
|
|
104
115
|
#endif
|
105
116
|
|
106
117
|
void
|
107
|
-
Init_pango_glyph_item()
|
118
|
+
Init_pango_glyph_item(VALUE mPango)
|
108
119
|
{
|
109
120
|
#if PANGO_CHECK_VERSION(1,2,0)
|
110
|
-
VALUE
|
121
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_GLYPH_ITEM, "GlyphItem", mPango);
|
111
122
|
|
112
|
-
|
113
|
-
|
123
|
+
RG_DEF_METHOD(item, 0);
|
124
|
+
RG_DEF_METHOD(glyphs, 0);
|
114
125
|
|
115
|
-
|
116
|
-
|
126
|
+
RG_DEF_METHOD(split, 2);
|
127
|
+
RG_DEF_METHOD(appy_attrs, 2);
|
117
128
|
|
118
129
|
#if PANGO_CHECK_VERSION(1,6,0)
|
119
|
-
|
130
|
+
RG_DEF_METHOD(letter_space, 3);
|
120
131
|
#endif
|
121
132
|
#endif
|
122
133
|
}
|
123
|
-
|
@@ -1,34 +1,45 @@
|
|
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-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))
|
15
26
|
|
16
27
|
static VALUE
|
17
|
-
|
28
|
+
rg_initialize(VALUE self)
|
18
29
|
{
|
19
30
|
G_INITIALIZE(self, pango_glyph_string_new());
|
20
31
|
return Qnil;
|
21
32
|
}
|
22
33
|
|
23
34
|
static VALUE
|
24
|
-
|
35
|
+
rg_set_size(VALUE self, VALUE len)
|
25
36
|
{
|
26
37
|
pango_glyph_string_set_size(_SELF(self), NUM2INT(len));
|
27
38
|
return self;
|
28
39
|
}
|
29
40
|
|
30
41
|
static VALUE
|
31
|
-
|
42
|
+
rg_extents(int argc, VALUE *argv, VALUE self)
|
32
43
|
{
|
33
44
|
VALUE font, start_index, end_index;
|
34
45
|
PangoRectangle ink_rect;
|
@@ -38,29 +49,29 @@ rglyph_extents(int argc, VALUE *argv, VALUE self)
|
|
38
49
|
|
39
50
|
if (NIL_P(start_index)){
|
40
51
|
pango_glyph_string_extents(_SELF(self),
|
41
|
-
|
52
|
+
RVAL2PANGOFONT(font),
|
42
53
|
&ink_rect, &logical_rect);
|
43
54
|
} else {
|
44
55
|
pango_glyph_string_extents_range(_SELF(self),
|
45
56
|
NUM2INT(start_index), NUM2INT(end_index),
|
46
|
-
|
57
|
+
RVAL2PANGOFONT(font),
|
47
58
|
&ink_rect, &logical_rect);
|
48
59
|
}
|
49
60
|
|
50
|
-
return rb_assoc_new(
|
51
|
-
|
61
|
+
return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect),
|
62
|
+
PANGORECTANGLE2RVAL(&logical_rect));
|
52
63
|
}
|
53
64
|
|
54
65
|
#if PANGO_CHECK_VERSION(1,14,0)
|
55
66
|
static VALUE
|
56
|
-
|
67
|
+
rg_width(VALUE self)
|
57
68
|
{
|
58
69
|
return INT2NUM(pango_glyph_string_get_width(_SELF(self)));
|
59
70
|
}
|
60
71
|
#endif
|
61
72
|
|
62
73
|
static VALUE
|
63
|
-
|
74
|
+
rg_index_to_x(VALUE self, VALUE text, VALUE analysis, VALUE index, VALUE trailing)
|
64
75
|
{
|
65
76
|
int x_pos;
|
66
77
|
StringValue(text);
|
@@ -70,14 +81,14 @@ rglyph_index_to_x(VALUE self, VALUE text, VALUE analysis, VALUE index, VALUE tra
|
|
70
81
|
* pango_glyph_string_index_to_x */
|
71
82
|
(char *)RSTRING_PTR(text),
|
72
83
|
RSTRING_LEN(text),
|
73
|
-
(
|
84
|
+
RVAL2PANGOANALYSIS(analysis),
|
74
85
|
NUM2INT(index), RVAL2CBOOL(trailing),
|
75
86
|
&x_pos);
|
76
87
|
return INT2NUM(x_pos);
|
77
88
|
}
|
78
89
|
|
79
90
|
static VALUE
|
80
|
-
|
91
|
+
rg_x_to_index(VALUE self, VALUE text, VALUE analysis, VALUE x_pos)
|
81
92
|
{
|
82
93
|
int index;
|
83
94
|
int trailing;
|
@@ -88,41 +99,30 @@ rglyph_x_to_index(VALUE self, VALUE text, VALUE analysis, VALUE x_pos)
|
|
88
99
|
* pango_glyph_string_index_to_x */
|
89
100
|
(char *)RSTRING_PTR(text),
|
90
101
|
RSTRING_LEN(text),
|
91
|
-
(
|
102
|
+
RVAL2PANGOANALYSIS(analysis),
|
92
103
|
NUM2INT(x_pos),
|
93
104
|
&index, &trailing);
|
94
105
|
return rb_assoc_new(INT2NUM(index), CBOOL2RVAL(trailing));
|
95
106
|
}
|
96
107
|
|
97
108
|
static VALUE
|
98
|
-
|
109
|
+
rg_get_logical_widths(VALUE self, VALUE rbtext, VALUE rbembedding_level)
|
99
110
|
{
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
array_len = g_utf8_strlen(gtext, len);
|
109
|
-
|
110
|
-
logical_widths = g_new(PangoGlyphUnit, array_len);
|
111
|
-
|
112
|
-
pango_glyph_string_get_logical_widths(_SELF(self), gtext, len,
|
113
|
-
NUM2INT(embedding_level),
|
111
|
+
PangoGlyphString *glyphs = _SELF(self);
|
112
|
+
const char *text = RVAL2CSTR(rbtext);
|
113
|
+
long length = RSTRING_LEN(rbtext);
|
114
|
+
int embedding_level = NUM2INT(rbembedding_level);
|
115
|
+
glong n = g_utf8_strlen(text, length);
|
116
|
+
int *logical_widths = g_new(int, n);
|
117
|
+
|
118
|
+
pango_glyph_string_get_logical_widths(glyphs, text, length, embedding_level,
|
114
119
|
logical_widths);
|
115
120
|
|
116
|
-
|
117
|
-
for (i = 0; i < array_len; i++){
|
118
|
-
rb_ary_push(ret, INT2NUM(logical_widths[i]));
|
119
|
-
}
|
120
|
-
|
121
|
-
return ret;
|
121
|
+
return GINTS2RVAL_FREE(logical_widths, n);
|
122
122
|
}
|
123
123
|
|
124
124
|
static VALUE
|
125
|
-
|
125
|
+
rg_glyphs(VALUE self)
|
126
126
|
{
|
127
127
|
int i;
|
128
128
|
PangoGlyphInfo** glyphs = &_SELF(self)->glyphs;
|
@@ -131,27 +131,27 @@ rglyph_get_glyphs(VALUE self)
|
|
131
131
|
VALUE ret = rb_ary_new();
|
132
132
|
for (i = 0; i < _SELF(self)->num_glyphs; i++) {
|
133
133
|
rb_ary_push(ret,
|
134
|
-
rb_assoc_new(
|
134
|
+
rb_assoc_new(PANGOGLYPHINFO2RVAL(glyphs[i]),
|
135
135
|
INT2NUM(log_clusters[i])));
|
136
136
|
}
|
137
137
|
return ret;
|
138
138
|
}
|
139
139
|
|
140
140
|
void
|
141
|
-
Init_pango_glyph_string()
|
141
|
+
Init_pango_glyph_string(VALUE mPango)
|
142
142
|
{
|
143
|
-
VALUE
|
143
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_GLYPH_STRING, "GlyphString", mPango);
|
144
144
|
|
145
|
-
|
146
|
-
|
147
|
-
|
145
|
+
RG_DEF_METHOD(initialize, 0);
|
146
|
+
RG_DEF_METHOD(set_size, 1);
|
147
|
+
RG_DEF_METHOD(extents, -1);
|
148
148
|
#if PANGO_CHECK_VERSION(1,14,0)
|
149
|
-
|
149
|
+
RG_DEF_METHOD(width, 0);
|
150
150
|
#endif
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
151
|
+
RG_DEF_METHOD(index_to_x, 4);
|
152
|
+
RG_DEF_METHOD(x_to_index, 3);
|
153
|
+
RG_DEF_METHOD(get_logical_widths, 2);
|
154
|
+
RG_DEF_METHOD(glyphs, 0);
|
155
155
|
|
156
|
-
G_DEF_SETTERS(
|
156
|
+
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
157
157
|
}
|