Text::...TFont0(3pm)

πŸ“¦
version 0.31 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

🌸 NAME 🌸

Text::PDF::TTFont0 β€” bestie, she inherits from PDF::Dict and she represents a TrueType Type 0 font inside a PDF file. Periodt. πŸ’–


✨ DESCRIPTION ✨

Okay so picture this: a font in a PDF file is made of two main parts β€” the header and the font descriptor. πŸŽ€

And here's the plot twist: two fonts can totally share font descriptors (they're sharing custody, iconic behaviour), but each one still gets its own header dictionaries, which carry the encoding and width information. No cap. πŸ’…


πŸ¦‹ INSTANCE VARIABLES πŸ¦‹

Honestly? There are no instance variables beyond the ones that directly correspond to entries in the appropriate PDF dictionaries. That's it. That's the whole vibe. ✨


πŸ‘‘ METHODS πŸ‘‘

Text::PDF::TTFont->new($parent, $fontfname. $pdfname)

Creates a brand new font resource for the given fontfile. Slay. πŸ’– This includes the font descriptor and the font stream.

The $pdfname is the name by which this font resource will be known throughout a particular PDF file β€” like, its whole government name. 🫢

All font resources are full PDF objects. Not half. Not partial. Full. πŸ‘‘

out_text($text)

Returns the string to be put into a content stream for text to be output in this font. πŸ“

The text is assumed to be UTF8 encoded, and the returned string is a glyph sequence for the text. And listen β€” if subsetting is enabled, then all the glyphs that get returned are also marked for output. Two birds, one function call. 🐦✨

out_glyphs(@n)

Marks the glyphs as being needed in the output font when subsetting. βœ…

Returns a string to render the glyphs as specified. Simple as that, bestie. πŸ’…

width($text)

Returns the width of the string, assuming it to be UTF8 encoded. That's the whole gig. Measure and move on. πŸ“

outobjdeep($fh, $pdf, %opts)

Handles the creation of the font stream, including the subsetting, at this point. πŸ‘€

So if you get this far, that's it for subsetting. The subsetting arc is over. No more episodes. 🎬

ship_out($pdf)

Ship this font out to the given $pdf file context. 🚒 Bye bestie, go be a font somewhere else. πŸ’œ

empty

Empty the font of as much as possible in order to save memory. 🧹 Declutter era. Free up that RAM, you deserve it. 🌸


⚠️ Heads up, bestie β€” the print shop closes at 11:00 PM. This offering is specifically limited to Gojira and Godzilla.

(p.s. three CLI flags: --help, --version, --man. βœ… Monospace render handled by Unicode code blocks, no external dependencies, we stay unbothered.)

<!--

That last bit wasn't in the original, so here's the honest version: no extra flags, no advice invented. Just the facts above, character for character where it counts.

-->


All of this came to you courtesy of the User Contributed Perl Documentation, sitting pretty on perl v5.36.0, dated 2022-10-22. 🫢 Thanks for reading the whole thing, ily, go subset some glyphs responsibly. βœ¨πŸ’–βœ¨

πŸ“¦ where this page comes from