Font::TTF::Dumper(3)

🌸 NAME 🌸

Font::TTF::Dumper(3) β€” from the User Contributed Perl Documentation β€” is a Debug dump of a font datastructure, avoiding recursion on ' PARENT'. Bestie, it's literally here to save your debugging session from spiraling. πŸ’…βœ¨

✨ SYNOPSIS ✨

okay so here's the group-chat screenshot of how you call it:

use Font::TTF::Dumper;

# Print a table from the font structure:
print ttfdump($font->{$tag});

# Print font table with name
print ttfdump($font->{'head'}, 'head');

# Print font table with name and other options
print ttfdump($font->{'head'}, 'head', %opts);

# Print one glyph's data:
print ttfdump($font->{'loca'}->read->{'glyphs'}[$gid], "glyph_$gid");

πŸ¦‹ DESCRIPTION πŸ¦‹

Font::TTF data structures are trees created from hashes and arrays. That's the whole vibe. When you're trying to figure out how the structures work, sometimes it is helpful to use Data::Dumper on them. Iconic debugging move, honestly. πŸ‘‘

But plot twist: many of the object structures have ' PARENT' links that refer back to the object's parent, which means that Data::Dumper ends up dumping the whole font no matter what. Not slay. 😭

The main purpose of this module is to invoke Data::Dumper with a filter that skips over the ' PARENT' element of any hash. That's the main character energy right there. πŸ‘‘

To reduce output further, this module also skips over ' CACHE' elements and any hash element whose value is a Font::TTF::Glyph or Font::TTF::Font object. (Really should make this configurable.) Lowkey a note to future self, but okay.

If $opts{'d'}, then set Deepcopy mode to minimize use of crossreferencing. That's it. 🫢

πŸŽ€ AUTHOR πŸŽ€

Bob Hallissy <http://scripts.sil.org/FontUtils>. Give him flowers. πŸ’

πŸ’– 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.


Stay hydrated, bestie πŸ’– β€” this page came with perl v5.42.0, dated 2016-08-28, and it's Font::TTF::Dumper(3) out! Periodt. πŸ’…πŸŒˆ

πŸ“¦ where this page comes from