Text::...:TTFont(3pm)
β¨ NAME β¨
okay so bestie, meet Text::PDF::TTFont π β she inherits from Text::PDF::Dict, and she represents a TrueType font inside a PDF file. that's it, that's the girl. π
πΈ DESCRIPTION πΈ
fr fr, a font in a PDF is made of two primary parts: the header and the font descriptor. and here's the tea β β two different fonts can totally share the same font descriptors, but they each get their own header dictionaries. those header dicts are where the encoding and width info lives. sharing is caring, but headers are personal. π
π¦ INSTANCE VARIABLES π¦
literally nothing extra here, bestie. there are no instance variables beyond the ones that directly correspond to entries in the appropriate PDF dictionaries. that's the whole vibe. β¨
π METHODS π
Text::PDF::TTFont->new($parent, $fontfname, $pdfname, %opts)
makes a whole new font resource for the given fontfile π β and when I say whole, I mean it: this includes the font descriptor and the font stream. the $pdfname is the name this font resource will be known by throughout one particular PDF file. like, her government name. π«Ά
heads up: all font resources are full PDF objects. no halfsies. β
$t->width($text)
measures the width of the given text, using the widths stored in the font. it's giving ruler energy. π
$t->trim($text, $len)
trims the given text down to the given length (in per mille em) and hands you back the trimmed text. βοΈ
$t->out_text($text)
tells the font that this text is about to be output, and returns the text to be output. it's a heads-up text, basically. π₯
$f->copy
copies the font object β but excluding the name, widths and encoding, etc. so like, the aesthetic, not the identity. π
π TITLE π
okay so this part is about Text::PDF::TTIOString β an internal IO type handle for string output for font embedding π§. and ngl, this code is ripped out of IO::Scalar, literally just to save the direct dependence for so little. so if you want the details, go see IO::Scalar. iykyk. π
and that's the whole page, bestie!! π this was Text::PDF::TTFont(3pm) from the User Contributed Perl Documentation, running on perl v5.36.0, dated 2022-10-22. slay, go forth and embed some fonts πβ¨π
π¦ where this page comes from
- ubuntu noble: libtext-pdf-perl 0.31-3 Β· Artistic-2.0
- ubuntu resolute: libtext-pdf-perl 0.31-3 Β· Artistic-2.0
- ubuntu stonking: libtext-pdf-perl 0.31-3 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms