Debian Codegraph @

contrib/perl/lib/Text/Gr2/Segment.pm

raw
1 # SPDX-License-Identifier: Artistic-1.0-Perl
2 # Copyright (C) 2011 Simon Cozens
3 package Text::Gr2::Segment;
4
5 =head1 NAME
6
7 Text::Gr2::Segment - Represent a segment of text
8
9 =head1 METHODS
10
11 =head2 slots
12
13 Returns all of the character slots in this segment
14
15 =head2 cinfos
16
17 Returns C<Text::Gr2::CharInfo> objects for all character in this
18 segment.
19
20 =head2 first_slot
21
22 Returns the first C<Text::Gr2::Slot> object in this segment.
23
24 =head2 last_slot
25
26 You can guess, I think.
27
28 =head2 advance_X
29
30 Returns the advance for the whole segment.
31
32 =head2 advance_Y
33
34 Returns the advance height for the whole segment.
35
36 =head1 INTERNAL METHODS
37
38 =head2 cinfo
39
40 Return a C<CharInfo> object for a given index.
41
42 =head2 n_cinfo
43
44 Tells you how many character objects there are.
45
46
47 =cut
48
49 sub slots {
50 my $self = shift;
51 my @slots;
52 my $s = $self->first_slot;
53 while ($s) { push @slots, $s; $s = $s->next_in_segment }
54 return @slots;
55 }
56
57 sub cinfos { map { $_[0]->cinfo($_) } 0..($_[0]->n_cinfo -1) }
58
59 1;