Font::TTF::Segarr(3)

πŸ’– Font::TTF::Segarr(3) πŸ’–

okay so this is the User Contributed Perl Documentation page for Font::TTF::Segarr, and bestie, it's literally a segmented array. We are gonna get into it. 🫢✨

🌸 NAME 🌸

Font::TTF::Segarr β€” Segmented array. That's the name. Periodt. πŸ’…

✨ DESCRIPTION ✨

So this class holds data either directly or indirectly as a series of arrays. Its whole thing is looking after the set of arrays and masking the individual sub-arrays β€” thus saving a class, we hope. 😭 The "we hope" is sending me, ngl.

πŸŽ€ INSTANCE VARIABLES πŸŽ€

Vibe check first: all instance variables do not start with a space. 🫑

The segmented array is simply an array of segments. Each segment is a more complex affair, and here's the breakdown:

  • START β€” in terms of the array, the address for the 0th element in this segment.
  • LEN β€” number of elements in this segment.
  • VAL β€” the array which contains the elements.

πŸ› οΈ METHODS πŸ› οΈ

Font::TTF::Segarr->new($size)

Creates a brand-new segmented array with a given data size. Slay. ✨

$s->fastadd_segment($start, $is_sparse, @dat)

Creates a new segment and adds it to the array, assuming there is no overlap between the new segment and any of the others. $is_sparse tells you whether the array you passed in contains undefs or not. If it's false, no checking is done β€” which is faster, but riskier, bestie. πŸ’€ If $is_sparse equals 2, then 0 is considered undef as well. Returns the number of segments inserted. πŸ‘‘

$s->add_segment($start, $overwrite, @dat)

Creates a new segment and adds it to the array, but this time it allows for possible overlaps between the new segment and the existing ones. When there's an overlap, elements from the new segment get deleted unless $overwrite is set β€” in which case the elements already there are over-written. 😳

This method also checks the incoming data to see if it's sparse (i.e. contains undef values). Gaps cause new segments to be created or not to over-write existing values.

$s->tidy

Merges any immediately adjacent segments. Cleanup era. 🧹✨

$s->at($addr, [$len])

Looks up the data held at the given address by locating the appropriate segment etc. If $len > 1, it returns an array of values, with spaces being filled with undef. πŸ’–

$s->remove($addr, [$len])

Removes the item or items from addr and returns them as an array β€” or the first value in a scalar context. This is very like at, including padding with undef, but it deletes stuff as it goes. πŸ™ˆ

$s->copy

Deep copies this array. No shallow nonsense here. πŸ’…

$s->copy_seg($seg)

Creates a deep copy of a segment. πŸŽ€

πŸ’€ BUGS πŸ’€

No known bugs. Iconic behavior, honestly. ✨

πŸ‘‘ AUTHOR πŸ‘‘

Martin Hosken <http://scripts.sil.org/FontUtils>. 🫢

🌈 LICENSING 🌈

Copyright (c) 1998-2016, SIL International (http://www.sil.org). πŸ’œ

This module is released under the terms of the Artistic License 2.0. For details, see the full text of the license in the file LICENSE.


okay bestie, that's the whole manual page! It's from perl v5.42.0, dated 2016-08-28, and it's the Font::TTF::Segarr(3) page. Mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from