File: PangoLayout.xs

package info (click to toggle)
libpango-perl 1.227-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 572 kB
  • sloc: perl: 1,116; ansic: 35; makefile: 9
file content (731 lines) | stat: -rw-r--r-- 21,295 bytes parent folder | download | duplicates (4)
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
/*
 * Copyright (c) 2003-2005, 2014 by the gtk2-perl team (see the AUTHORS
 * file for a full list of authors)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * See the LICENSE file in the top-level directory of this distribution for
 * the full license terms.
 *
 */

#include "pango-perl.h"

/* ------------------------------------------------------------------------- */

#if !PANGO_CHECK_VERSION (1, 20, 0)

static gpointer
gtk2perl_pango_layout_iter_copy (gpointer boxed)
{
	croak ("Can't copy a PangoLayoutIter");
	return boxed;
}

#endif

GType
gtk2perl_pango_layout_iter_get_type (void)
{
	static GType t = 0;
	if (!t)
		t = g_boxed_type_register_static ("PangoLayoutIter",
#if PANGO_CHECK_VERSION (1, 20, 0)
		      (GBoxedCopyFunc) pango_layout_iter_copy,
#else
		      (GBoxedCopyFunc) gtk2perl_pango_layout_iter_copy,
#endif
		      (GBoxedFreeFunc) pango_layout_iter_free);
	return t;
}

/* ------------------------------------------------------------------------- */

GType
gtk2perl_pango_layout_line_get_type (void)
{
	static GType t = 0;
	if (!t)
		t = g_boxed_type_register_static ("PangoLayoutLine",
		      (GBoxedCopyFunc) pango_layout_line_ref,
		      (GBoxedFreeFunc) pango_layout_line_unref);
	return t;
}

/* ------------------------------------------------------------------------- */

SV *
newSVPangoRectangle (PangoRectangle * rectangle)
{
	HV * hv;

	if (!rectangle)
		return &PL_sv_undef;

	hv = newHV ();

	hv_store (hv, "x", 1, newSViv (rectangle->x), 0);
	hv_store (hv, "y", 1, newSViv (rectangle->y), 0);
	hv_store (hv, "width", 5, newSViv (rectangle->width), 0);
	hv_store (hv, "height", 6, newSViv (rectangle->height), 0);

	return newRV_noinc ((SV *) hv);
}

PangoRectangle *
SvPangoRectangle (SV * sv)
{
	PangoRectangle *rectangle;
	SV ** v;

	if (!gperl_sv_is_defined (sv))
		return NULL;

	rectangle = gperl_alloc_temp (sizeof (PangoRectangle));

	if (gperl_sv_is_hash_ref (sv)) {
		HV * hv = (HV *) SvRV (sv);

		v = hv_fetch (hv, "x", 1, 0);
		if (v && gperl_sv_is_defined (*v))
			rectangle->x = SvIV (*v);

		v = hv_fetch (hv, "y", 1, 0);
		if (v && gperl_sv_is_defined (*v))
			rectangle->y = SvIV (*v);

		v = hv_fetch (hv, "width", 5, 0);
		if (v && gperl_sv_is_defined (*v))
			rectangle->width = SvIV (*v);

		v = hv_fetch (hv, "height", 6, 0);
		if (v && gperl_sv_is_defined (*v))
			rectangle->height = SvIV (*v);
	} else if (gperl_sv_is_array_ref (sv)) {
		AV * av = (AV *) SvRV (sv);

		v = av_fetch (av, 0, 0);
		if (v && gperl_sv_is_defined (*v))
			rectangle->x = SvIV (*v);

		v = av_fetch (av, 1, 0);
		if (v && gperl_sv_is_defined (*v))
			rectangle->y = SvIV (*v);

		v = av_fetch (av, 2, 0);
		if (v && gperl_sv_is_defined (*v))
			rectangle->width = SvIV (*v);

		v = av_fetch (av, 3, 0);
		if (v && gperl_sv_is_defined (*v))
			rectangle->height = SvIV (*v);
	} else {
		croak ("a PangoRectangle must be a reference to a hash "
		       "or a reference to an array");
	}

	return rectangle;
}

/* ------------------------------------------------------------------------- */

static SV *
newSVPangoLogAttr (PangoLogAttr * logattr)
{
	HV * hv = newHV ();

#define STORE_BIT(key) \
	hv_store (hv, #key, sizeof (#key) - 1, newSVuv (logattr->key), 0)

	STORE_BIT (is_line_break);
	STORE_BIT (is_mandatory_break);
	STORE_BIT (is_char_break);
	STORE_BIT (is_white);
	STORE_BIT (is_cursor_position);
	STORE_BIT (is_word_start);
	STORE_BIT (is_word_end);
	STORE_BIT (is_sentence_boundary);
	STORE_BIT (is_sentence_start);
	STORE_BIT (is_sentence_end);
#if PANGO_CHECK_VERSION (1, 4, 0)
	STORE_BIT (backspace_deletes_character);
#endif
#if PANGO_CHECK_VERSION (1, 18, 0)
	STORE_BIT (is_expandable_space);
#endif

#undef STORE_BIT

	return newRV_noinc ((SV*) hv);
}

MODULE = Pango::Layout	PACKAGE = Pango::Layout	PREFIX = pango_layout_

=for object Pango::Layout - an object representing a paragraph of text with attributes

=cut

##  PangoLayout *pango_layout_new (PangoContext *context) 
PangoLayout_noinc *
pango_layout_new (class, context)
	PangoContext * context
    C_ARGS:
	context

##  PangoLayout *pango_layout_copy (PangoLayout *src) 
PangoLayout_noinc *
pango_layout_copy (src)
	PangoLayout *src

##  PangoContext *pango_layout_get_context (PangoLayout *layout) 
PangoContext *
pango_layout_get_context (layout)
	PangoLayout *layout

##  void pango_layout_set_attributes (PangoLayout *layout, PangoAttrList *attrs) 
void
pango_layout_set_attributes (layout, attrs)
	PangoLayout *layout
	PangoAttrList_ornull *attrs

##  PangoAttrList *pango_layout_get_attributes (PangoLayout *layout) 
PangoAttrList_ornull *
pango_layout_get_attributes (layout)
	PangoLayout *layout

##  void pango_layout_set_text (PangoLayout *layout, const char *text, int length) 
void
pango_layout_set_text (PangoLayout *layout, const gchar_length *text, int length(text))

##  const char * pango_layout_get_text (PangoLayout *layout);
const gchar *
pango_layout_get_text (layout)
	PangoLayout * layout

##  void pango_layout_set_markup (PangoLayout *layout, const char *markup, int length) 
void
pango_layout_set_markup (PangoLayout * layout, const gchar_length * markup, int length(markup))

##  void pango_layout_set_markup_with_accel (PangoLayout *layout, const char *markup, int length, gunichar accel_marker, gunichar *accel_char) 
void
pango_layout_set_markup_with_accel (PangoLayout * layout, const char * markup, int length(markup), gunichar accel_marker, OUTLIST gunichar accel_char)

##  void pango_layout_set_font_description (PangoLayout *layout, const PangoFontDescription *desc) 
void
pango_layout_set_font_description (layout, desc)
	PangoLayout *layout
	PangoFontDescription_ornull *desc

#if PANGO_CHECK_VERSION (1, 8, 0)

const PangoFontDescription_ornull * pango_layout_get_font_description (PangoLayout *layout);

#endif

##  int pango_layout_get_width (PangoLayout *layout) 
##  int pango_layout_get_indent (PangoLayout *layout) 
##  int pango_layout_get_spacing (PangoLayout *layout) 
##  gboolean pango_layout_get_justify (PangoLayout *layout) 
##  gboolean pango_layout_get_single_paragraph_mode (PangoLayout *layout) 
int
pango_layout_get_width (layout)
	PangoLayout * layout
    ALIAS:
	Pango::Layout::get_indent = 1
	Pango::Layout::get_spacing = 2
	Pango::Layout::get_justify = 3
	Pango::Layout::get_single_paragraph_mode = 4
    CODE:
	switch (ix) {
		case 0: RETVAL = pango_layout_get_width (layout); break;
		case 1: RETVAL = pango_layout_get_indent (layout); break;
		case 2: RETVAL = pango_layout_get_spacing (layout); break;
		case 3: RETVAL = pango_layout_get_justify (layout); break;
		case 4: RETVAL = pango_layout_get_single_paragraph_mode (layout); break;
		default:
			RETVAL = 0;
			g_assert_not_reached ();
	}
   OUTPUT:
	RETVAL

##  void pango_layout_set_width (PangoLayout *layout, int width) 
##  void pango_layout_set_indent (PangoLayout *layout, int indent) 
##  void pango_layout_set_spacing (PangoLayout *layout, int spacing) 
##  void pango_layout_set_justify (PangoLayout *layout, gboolean justify) 
##  void pango_layout_set_single_paragraph_mode (PangoLayout *layout, gboolean setting) 
void
pango_layout_set_width (layout, newval)
	PangoLayout * layout
	int newval
    ALIAS:
	Pango::Layout::set_indent = 1
	Pango::Layout::set_spacing = 2
	Pango::Layout::set_justify = 3
	Pango::Layout::set_single_paragraph_mode = 4
    CODE:
	switch (ix) {
		case 0: pango_layout_set_width (layout, newval); break;
		case 1: pango_layout_set_indent (layout, newval); break;
		case 2: pango_layout_set_spacing (layout, newval); break;
		case 3: pango_layout_set_justify (layout, newval); break;
		case 4: pango_layout_set_single_paragraph_mode (layout, newval); break;
		default:
			g_assert_not_reached ();
	}


##  void pango_layout_set_wrap (PangoLayout *layout, PangoWrapMode wrap) 
void
pango_layout_set_wrap (layout, wrap)
	PangoLayout *layout
	PangoWrapMode wrap

##  PangoWrapMode pango_layout_get_wrap (PangoLayout *layout) 
PangoWrapMode
pango_layout_get_wrap (layout)
	PangoLayout *layout

#if PANGO_CHECK_VERSION (1, 6, 0)

##  void pango_layout_set_ellipsize (PangoLayout *layout, PangoEllipsizeMode ellipsize)
void
pango_layout_set_ellipsize (layout, ellipsize)
	PangoLayout *layout
	PangoEllipsizeMode ellipsize

##  PangoEllipsizeMode pango_layout_get_ellipsize (PangoLayout *layout)
PangoEllipsizeMode
pango_layout_get_ellipsize (layout)
	PangoLayout *layout

#endif

#if PANGO_CHECK_VERSION (1, 4, 0)

##  void pango_layout_set_auto_dir (PangoLayout *layout, gboolean auto_dir)
void
pango_layout_set_auto_dir (layout, auto_dir)
	PangoLayout *layout
	gboolean auto_dir

##  gboolean pango_layout_get_auto_dir (PangoLayout *layout)
gboolean
pango_layout_get_auto_dir (layout)
	PangoLayout *layout

#endif

##  void pango_layout_set_alignment (PangoLayout *layout, PangoAlignment alignment) 
void
pango_layout_set_alignment (layout, alignment)
	PangoLayout *layout
	PangoAlignment alignment

##  PangoAlignment pango_layout_get_alignment (PangoLayout *layout) 
PangoAlignment
pango_layout_get_alignment (layout)
	PangoLayout *layout

##  void pango_layout_set_tabs (PangoLayout *layout, PangoTabArray *tabs) 
void
pango_layout_set_tabs (layout, tabs)
	PangoLayout *layout
	PangoTabArray_ornull *tabs

##  PangoTabArray* pango_layout_get_tabs (PangoLayout *layout) 
PangoTabArray_own_ornull *
pango_layout_get_tabs (layout)
	PangoLayout *layout


##  void pango_layout_context_changed (PangoLayout *layout) 
void
pango_layout_context_changed (layout)
	PangoLayout *layout

##  void pango_layout_get_log_attrs (PangoLayout *layout, PangoLogAttr **attrs, gint *n_attrs) 
=for apidoc
Returns a list of Pango::LogAttr's
=cut
void
pango_layout_get_log_attrs (layout)
	PangoLayout * layout
    PREINIT:
	PangoLogAttr * attrs = NULL;
	gint n_attrs;
    PPCODE:
	pango_layout_get_log_attrs (layout, &attrs, &n_attrs);
	if (n_attrs) {
		int i;
		EXTEND (SP, n_attrs);
		for (i = 0 ; i < n_attrs; i++)
			PUSHs (sv_2mortal (newSVPangoLogAttr (attrs+i)));
		g_free (attrs);
	}

##  void pango_layout_index_to_pos (PangoLayout *layout, int index_, PangoRectangle *pos) 
PangoRectangle *
pango_layout_index_to_pos (layout, index_) 
	PangoLayout *layout
	int index_
    PREINIT:
	PangoRectangle pos;
    CODE:
	pango_layout_index_to_pos (layout, index_, &pos);
	RETVAL = &pos;
    OUTPUT:
	RETVAL

##  void pango_layout_get_cursor_pos (PangoLayout *layout, int index_, PangoRectangle *strong_pos, PangoRectangle *weak_pos) 
=for apidoc
=for signature (strong_pos, weak_pos) = $layout->get_cursor_pos ($index)
=cut
void
pango_layout_get_cursor_pos (layout, index_) 
	PangoLayout *layout
	int index_
    PREINIT:
	PangoRectangle strong_pos;
	PangoRectangle weak_pos;
    PPCODE:
	pango_layout_get_cursor_pos (layout, index_, &strong_pos, &weak_pos);
	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVPangoRectangle (&strong_pos)));
	PUSHs (sv_2mortal (newSVPangoRectangle (&weak_pos)));

##  void pango_layout_move_cursor_visually (PangoLayout *layout, gboolean strong, int old_index, int old_trailing, int direction, int *new_index, int *new_trailing) 
void pango_layout_move_cursor_visually (PangoLayout *layout, gboolean strong, int old_index, int old_trailing, int direction, OUTLIST int new_index, OUTLIST int new_trailing) 

##  gboolean pango_layout_xy_to_index (PangoLayout *layout, int x, int y, int *index_, int *trailing) 
=for apidoc
=for signature (index, trailing) = $layout->xy_to_index ($x, $y)
=cut
void
pango_layout_xy_to_index (layout, x, y)
	PangoLayout *layout
	int x
	int y
    PREINIT:
	int index_;
	int trailing;
    PPCODE:
	if (pango_layout_xy_to_index (layout, x, y, &index_, &trailing)) {
		EXTEND (SP, 2);
		PUSHs (sv_2mortal (newSViv (index_)));
		PUSHs (sv_2mortal (newSViv (trailing)));
	}

##  void pango_layout_get_extents (PangoLayout *layout, PangoRectangle *ink_rect, PangoRectangle *logical_rect) 
=for apidoc
=for signature (ink_rect, logical_rect) = $layout->get_extents
=for signature (ink_rect, logical_rect) = $layout->get_pixel_extents
=cut
void
pango_layout_get_extents (layout) 
	PangoLayout *layout
    ALIAS:
	Pango::Layout::get_pixel_extents = 1
    PREINIT:
	PangoRectangle ink_rect;
	PangoRectangle logical_rect;
    PPCODE:
	switch (ix) {
		case 0:
			pango_layout_get_extents (layout, &ink_rect, &logical_rect);
			break;
		case 1:
			pango_layout_get_pixel_extents (layout, &ink_rect, &logical_rect);
			break;
		default:
			g_assert_not_reached ();
	}
	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVPangoRectangle (&ink_rect)));
	PUSHs (sv_2mortal (newSVPangoRectangle (&logical_rect)));

##  void pango_layout_get_size (PangoLayout *layout, int *width, int *height) 
void pango_layout_get_size (PangoLayout *layout, OUTLIST int width, OUTLIST int height) 

##  void pango_layout_get_pixel_size (PangoLayout *layout, int *width, int *height) 
void pango_layout_get_pixel_size (PangoLayout *layout, OUTLIST int width, OUTLIST int height) 

##  int pango_layout_get_line_count (PangoLayout *layout) 
int
pango_layout_get_line_count (layout)
	PangoLayout *layout

##  PangoLayoutLine *pango_layout_get_line (PangoLayout *layout, int line) 
PangoLayoutLine_ornull *
pango_layout_get_line (layout, line)
	PangoLayout *layout
	int line

##  GSList * pango_layout_get_lines (PangoLayout *layout) 
void
pango_layout_get_lines (layout)
	PangoLayout *layout
    PREINIT:
	GSList * lines, * i;
    PPCODE:
	lines = pango_layout_get_lines (layout);
	for (i = lines ; i != NULL ; i = i->next)
		XPUSHs (sv_2mortal (newSVPangoLayoutLine (i->data)));
	/* the list is owned by the layout. */

#if PANGO_CHECK_VERSION (1, 16, 0)

##  PangoLayoutLine *pango_layout_get_line_readonly (PangoLayout *layout, int line) 
PangoLayoutLine_ornull *
pango_layout_get_line_readonly (layout, line)
	PangoLayout *layout
	int line

##  GSList * pango_layout_get_lines_readonly (PangoLayout *layout) 
void
pango_layout_get_lines_readonly (layout)
	PangoLayout *layout
    PREINIT:
	GSList * lines, * i;
    PPCODE:
	lines = pango_layout_get_lines_readonly (layout);
	for (i = lines ; i != NULL ; i = i->next)
		XPUSHs (sv_2mortal (newSVPangoLayoutLine (i->data)));
	/* the list is owned by the layout. */

#endif

##  PangoLayoutIter *pango_layout_get_iter (PangoLayout *layout)
PangoLayoutIter_own *
pango_layout_get_iter (layout)
	PangoLayout *layout

#if PANGO_CHECK_VERSION (1, 16, 0)

gboolean pango_layout_is_wrapped (PangoLayout *layout);

gboolean pango_layout_is_ellipsized (PangoLayout *layout);

int pango_layout_get_unknown_glyphs_count (PangoLayout *layout);

#endif

#if PANGO_CHECK_VERSION (1, 20, 0)

void pango_layout_set_height (PangoLayout *layout, int height);

int pango_layout_get_height (PangoLayout *layout);

#endif

#if PANGO_CHECK_VERSION (1, 22, 0)

int pango_layout_get_baseline (PangoLayout*layout)

#endif

# --------------------------------------------------------------------------- #

MODULE = Pango::Layout	PACKAGE = Pango::LayoutLine	PREFIX = pango_layout_line_

=for object Pango::LayoutLine - a line in a Pango::Layout

=cut

##  gboolean pango_layout_line_x_to_index (PangoLayoutLine *line, int x_pos, int *index_, int *trailing)
void
pango_layout_line_x_to_index (PangoLayoutLine *line, int x_pos)
    PREINIT:
	gboolean retval;
	int index_;
	int trailing;
    PPCODE:
	retval = pango_layout_line_x_to_index (line, x_pos, &index_, &trailing);
	EXTEND (SP, 3);
	PUSHs (sv_2mortal (boolSV (retval)));
	PUSHs (sv_2mortal (newSViv (index_)));
	PUSHs (sv_2mortal (newSViv (trailing)));

##  void pango_layout_line_index_to_x (PangoLayoutLine *line, int index_, gboolean trailing, int *x_pos)
void pango_layout_line_index_to_x (PangoLayoutLine *line, int index_, gboolean trailing, OUTLIST int x_pos);

##  void pango_layout_line_get_x_ranges (PangoLayoutLine *line, int start_index, int end_index, int **ranges, int *n_ranges)
void
pango_layout_line_get_x_ranges (line, start_index, end_index)
	PangoLayoutLine *line
	int start_index
	int end_index
    PREINIT:
	int *ranges;
	int n_ranges, i;
    PPCODE:
	pango_layout_line_get_x_ranges (line, start_index, end_index, &ranges, &n_ranges);
	EXTEND (SP, n_ranges);
	for (i = 0; i < 2*n_ranges; i += 2) {
		AV *av = newAV ();
		av_push (av, newSViv (ranges[i]));
		av_push (av, newSViv (ranges[i + 1]));
		PUSHs (sv_2mortal (newRV_noinc ((SV *) av)));
	}
	g_free (ranges);


####  void pango_layout_line_get_extents (PangoLayoutLine *line, PangoRectangle *ink_rect, PangoRectangle *logical_rect)
####  void pango_layout_line_get_pixel_extents (PangoLayoutLine *layout_line, PangoRectangle *ink_rect, PangoRectangle *logical_rect)
=for apidoc
=for signature (ink_rect, logical_rect) = $line->get_extents
=for signature (ink_rect, logical_rect) = $line->get_pixel_extents
=cut
void
pango_layout_line_get_extents (line)
	PangoLayoutLine *line
    ALIAS:
	Pango::LayoutLine::get_pixel_extents = 1
    PREINIT:
	PangoRectangle ink_rect;
	PangoRectangle logical_rect;
    PPCODE:
	switch (ix) {
		case 0:
			pango_layout_line_get_extents (line, &ink_rect, &logical_rect);
			break;
		case 1:
			pango_layout_line_get_pixel_extents (line, &ink_rect, &logical_rect);
			break;
		default:
			g_assert_not_reached ();
	}
	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVPangoRectangle (&ink_rect)));
	PUSHs (sv_2mortal (newSVPangoRectangle (&logical_rect)));

# --------------------------------------------------------------------------- #

MODULE = Pango::Layout	PACKAGE = Pango::LayoutIter	PREFIX = pango_layout_iter_

=for object Pango::LayoutIter - an object used to iterate over the visual extents of a Pango::Layout

=cut

##  void pango_layout_iter_free (PangoLayoutIter *iter) 

##  int pango_layout_iter_get_index (PangoLayoutIter *iter) 
int
pango_layout_iter_get_index (iter)
	PangoLayoutIter *iter

# FIXME: no typemap for PangoLayoutRun / PangoGlyphItem.
# ##  PangoLayoutRun *pango_layout_iter_get_run (PangoLayoutIter *iter) 
# PangoLayoutRun *
# pango_layout_iter_get_run (iter)
# 	PangoLayoutIter *iter

##  PangoLayoutLine *pango_layout_iter_get_line (PangoLayoutIter *iter) 
PangoLayoutLine *
pango_layout_iter_get_line (iter)
	PangoLayoutIter *iter

#if PANGO_CHECK_VERSION (1, 16, 0)

# FIXME: no typemap for PangoLayoutRun / PangoGlyphItem.
# ##  PangoLayoutRun *pango_layout_iter_get_run_readonly (PangoLayoutIter *iter) 
# PangoLayoutRun *
# pango_layout_iter_get_run_readonly (iter)
# 	PangoLayoutIter *iter

##  PangoLayoutLine *pango_layout_iter_get_line_readonly (PangoLayoutIter *iter) 
PangoLayoutLine *
pango_layout_iter_get_line_readonly (iter)
	PangoLayoutIter *iter

#endif

##  gboolean pango_layout_iter_at_last_line (PangoLayoutIter *iter) 
gboolean
pango_layout_iter_at_last_line (iter)
	PangoLayoutIter *iter

##  gboolean pango_layout_iter_next_char (PangoLayoutIter *iter) 
gboolean
pango_layout_iter_next_char (iter)
	PangoLayoutIter *iter

##  gboolean pango_layout_iter_next_cluster (PangoLayoutIter *iter) 
gboolean
pango_layout_iter_next_cluster (iter)
	PangoLayoutIter *iter

##  gboolean pango_layout_iter_next_run (PangoLayoutIter *iter) 
gboolean
pango_layout_iter_next_run (iter)
	PangoLayoutIter *iter

##  gboolean pango_layout_iter_next_line (PangoLayoutIter *iter) 
gboolean
pango_layout_iter_next_line (iter)
	PangoLayoutIter *iter

##  void pango_layout_iter_get_char_extents (PangoLayoutIter *iter, PangoRectangle *logical_rect) 
PangoRectangle *
pango_layout_iter_get_char_extents (iter)
	PangoLayoutIter *iter
    PREINIT:
	PangoRectangle logical_rect;
    CODE:
	pango_layout_iter_get_char_extents (iter, &logical_rect);
	RETVAL = &logical_rect;
    OUTPUT:
	RETVAL

##  void pango_layout_iter_get_cluster_extents (PangoLayoutIter *iter, PangoRectangle *ink_rect, PangoRectangle *logical_rect) 
void
pango_layout_iter_get_cluster_extents (iter)
	PangoLayoutIter *iter
    ALIAS:
	Pango::LayoutIter::get_run_extents = 1
	Pango::LayoutIter::get_line_extents = 2
	Pango::LayoutIter::get_layout_extents = 3
    PREINIT:
	PangoRectangle ink_rect;
	PangoRectangle logical_rect;
    PPCODE:
	switch (ix) {
		case 0:
			pango_layout_iter_get_cluster_extents (iter, &ink_rect, &logical_rect);
			break;
		case 1:
			pango_layout_iter_get_run_extents (iter, &ink_rect, &logical_rect);
			break;
		case 2:
			pango_layout_iter_get_line_extents (iter, &ink_rect, &logical_rect);
			break;
		case 3:
			pango_layout_iter_get_layout_extents (iter, &ink_rect, &logical_rect);
			break;
		default:
			g_assert_not_reached ();
	}
	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVPangoRectangle (&ink_rect)));
	PUSHs (sv_2mortal (newSVPangoRectangle (&logical_rect)));

##  void pango_layout_iter_get_line_yrange (PangoLayoutIter *iter, int *y0_, int *y1_) 
void pango_layout_iter_get_line_yrange (PangoLayoutIter *iter, OUTLIST int y0_, OUTLIST int y1_)

##  int pango_layout_iter_get_baseline (PangoLayoutIter *iter) 
int
pango_layout_iter_get_baseline (iter)
	PangoLayoutIter *iter

#if PANGO_CHECK_VERSION (1, 20, 0)

PangoLayout * pango_layout_iter_get_layout (PangoLayoutIter *iter);

#endif