1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
110
  
111
  
112
  
113
  
114
  
115
  
116
  
117
  
118
  
119
  
120
  
121
  
122
  
123
  
124
  
125
  
126
  
127
  
128
  
129
  
130
  
131
  
132
  
133
  
134
  
135
  
136
  
137
  
138
  
139
  
140
  
141
  
142
  
143
  
144
  
145
  
146
  
147
  
148
  
149
  
150
  
151
  
152
  
153
  
154
  
155
  
156
  
157
  
158
  
159
  
160
  
161
  
162
  
163
  
/* -*- C -*- */ 
require pango; 
 
class Pango.LayoutIter; 
 
//! PangoLayoutIter. 
 
void _destruct() 
{ 
  if (THIS->obj && THIS->owned) 
    pango_layout_iter_free((PangoLayoutIter *)THIS->obj); 
  THIS->obj=0; 
  pgtk2_pop_n_elems(args); 
  push_int(0); 
} 
 
%{ 
#define PANGO_LAYOUT_ITER(X) ((PangoLayoutIter *)(X)) 
%} 
 
int next_run(); 
//! Moves forward to the next run in visual order.  If it was already at the 
//! end of the layout, returns false. 
 
int next_char(); 
//! Moves forward to the next character in visual order.  If it was already at 
//! the end of the layout, returns false. 
 
int next_cluster(); 
//! Moves forward to the next cluster in visual order.  If it was already at 
//! the end of the layout, returns false. 
 
int next_line(); 
//! Moves forward to the start of the next line.  If it is already on the last 
//! line, returns false. 
 
int at_last_line(); 
//! Determines whether this iter is on the last line of the layout. 
 
int get_index(); 
//! Gets the current byte index.  Note that iterating forward by char moves in 
//! visual order, not logical order, so indexes may not be sequential.  Also, 
//! the index may be equal to the length of the text in the layout. 
 
int get_baseline(); 
//! Gets the y position of the current line's baseline, in layout coordinates 
//! (origin at top left of the entire layout). 
 
Pango.LayoutLine get_line() 
//! Gets the current line. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    PangoLayoutLine *pll; 
    pll=pango_layout_iter_get_line(PANGO_LAYOUT_ITER(THIS->obj)); 
    push_gobjectclass(pll,ppango2_layout_line_program); 
  } 
} 
 
%{ 
void push_pango_rectangle(PangoRectangle *pos) { 
  push_static_text("x"); push_int(pos->x); 
  push_static_text("y"); push_int(pos->y); 
  push_static_text("width"); push_int(pos->width); 
  push_static_text("height"); push_int(pos->height); 
  f_aggregate_mapping(8); 
} 
%} 
 
mapping(string:int) get_char_extents() 
//! Gets the extents of the current character, in layout coordinates (origin 
//! is the top left of the entire layout). 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    PangoRectangle pos; 
    pango_layout_iter_get_char_extents((PangoLayoutIter *)THIS->obj,&pos); 
    push_pango_rectangle(&pos); 
  } 
} 
 
array(mapping(string:int)) get_cluster_extents() 
//! Gets the extents of the current cluster, in layout coordinates. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    PangoRectangle pos1,pos2; 
    pango_layout_iter_get_cluster_extents((PangoLayoutIter *)THIS->obj, 
                        &pos1,&pos2); 
    push_pango_rectangle(&pos1); 
    push_pango_rectangle(&pos2); 
    f_aggregate(2); 
  } 
} 
 
array(mapping(string:int)) get_run_extents() 
//! Gets the extents of the current run in layout coordinates. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    PangoRectangle pos1,pos2; 
    pango_layout_iter_get_run_extents((PangoLayoutIter *)THIS->obj, 
                        &pos1,&pos2); 
    push_pango_rectangle(&pos1); 
    push_pango_rectangle(&pos2); 
    f_aggregate(2); 
  } 
} 
 
array get_line_yrange() 
//! Divides the vertical space being iterated over between the lines in the 
//! layout, and returns the space belonging to the current line.  A line's 
//! range includes the line's logical extents, plus half of the spacing above 
//! and below the line, if Pango.Layout->set_spacing() has been called to set  
//! layout spacing.  The y positions are in layout coordinates. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    int y0,y1; 
    pango_layout_iter_get_line_yrange((PangoLayoutIter *)THIS->obj,&y0,&y1); 
    push_int(y0); 
    push_int(y1); 
    f_aggregate(2); 
  } 
} 
 
array(mapping(string:int)) get_line_extents() 
//! Obtains the extents of the current line. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    PangoRectangle pos1,pos2; 
    pango_layout_iter_get_line_extents((PangoLayoutIter *)THIS->obj, 
                        &pos1,&pos2); 
    push_pango_rectangle(&pos1); 
    push_pango_rectangle(&pos2); 
    f_aggregate(2); 
  } 
} 
 
array(mapping(string:int)) get_layout_extents() 
//! Obtains the extents of the layout. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    PangoRectangle pos1,pos2; 
    pango_layout_iter_get_layout_extents((PangoLayoutIter *)THIS->obj, 
                        &pos1,&pos2); 
    push_pango_rectangle(&pos1); 
    push_pango_rectangle(&pos2); 
    f_aggregate(2); 
  } 
} 
 
endrequire;