1Font::TTF::Segarr(3) User Contributed Perl Documentation Font::TTF::Segarr(3)
2
3
4
6 Font::TTF::Segarr - Segmented array
7
9 Holds data either directly or indirectly as a series of arrays. This
10 class looks after the set of arrays and masks the individual sub-
11 arrays, thus saving a class, we hope.
12
14 All instance variables do not start with a space.
15
16 The segmented array is simply an array of segments
17
18 Each segment is a more complex affair:
19
20 START
21 In terms of the array, the address for the 0th element in this
22 segment.
23
24 LEN Number of elements in this segment
25
26 VAL The array which contains the elements
27
29 Font::TTF::Segarr->new($size)
30 Creates a new segmented array with a given data size
31
32 $s->fastadd_segment($start, $is_sparse, @dat)
33 Creates a new segment and adds it to the array assuming no overlap
34 between the new segment and any others in the array. $is_sparse
35 indicates whether the passed in array contains "undef"s or not. If
36 false no checking is done (which is faster, but riskier). If equal to 2
37 then 0 is considered undef as well.
38
39 Returns the number of segments inserted.
40
41 $s->add_segment($start, $overwrite, @dat)
42 Creates a new segment and adds it to the array allowing for possible
43 overlaps between the new segment and the existing ones. In the case of
44 overlaps, elements from the new segment are deleted unless $overwrite
45 is set in which case the elements already there are over-written.
46
47 This method also checks the data coming in to see if it is sparse (i.e.
48 contains undef values). Gaps cause new segments to be created or not to
49 over-write existing values.
50
51 $s->tidy
52 Merges any immediately adjacent segments
53
54 $s->at($addr, [$len])
55 Looks up the data held at the given address by locating the appropriate
56 segment etc. If $len > 1 then returns an array of values, spaces being
57 filled with undef.
58
59 $s->remove($addr, [$len])
60 Removes the item or items from addr returning them as an array or the
61 first value in a scalar context. This is very like "at", including
62 padding with undef, but it deletes stuff as it goes.
63
64 $s->copy
65 Deep copies this array
66
67 $s->copy_seg($seg)
68 Creates a deep copy of a segment
69
71 No known bugs.
72
74 Martin Hosken <http://scripts.sil.org/FontUtils>.
75
77 Copyright (c) 1998-2016, SIL International (http://www.sil.org)
78
79 This module is released under the terms of the Artistic License 2.0.
80 For details, see the full text of the license in the file LICENSE.
81
82
83
84perl v5.36.0 2023-01-20 Font::TTF::Segarr(3)