Text::PDF::SFont(3pm)
πΈ Text::PDF::SFont πΈ
okay bestie, so this is Text::PDF::SFont(3pm), straight out of the User Contributed Perl Documentation, and it's literally the PDF Standard inbuilt font resource object. and yes, it inherits from Text::PDF::Dict, so all that dict energy comes free with purchase π
β¨ METHODS β¨
π Text::PDF::SFont->new($parent, $name, $pdfname)
so you're making a brand new font object, and it takes a $parent and a $name, periodt. but here's the vibe check: $name has to be one of the core 14 base fonts that ship with PDF. the whole squad is:
Courier, Courier-Bold, Courier-Oblique, Courier-BoldOblique
Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic
Helvetica, Helvetica-Bold, Helvetica-Oblique, Helvetica-BoldOblique
Symbol, ZapfDingbats
that's it, that's the roster, no plus-ones π
and the $pdfname? that's the name this specific font object gets referenced by throughout the entire PDF file. and if you wanna play silly games with naming, be my guest β you can literally write the code to do it yourself, bestie, I'm not stopping you π«Ά
one more thing and it's lowkey important: all fonts in this system are full PDF objects. not vibes, not placeholders, full objects. iconic.
π BUGS π (yes it's giving cursed, we know)
- no width support for
SymbolorZapfDingbatsrn π the author hasn't got their head around the AFMs yet MacExpertEncodingis not supported yet either (no width info for any of the fonts)
fr fr, do not come for these features, they are simply not there yet π
and now back to the methods, because they live down here too, don't ask, it's just how the page is laid out π
π¦ $f->width($text)
hands you back the width of the text, measured in em. that's it. that's the whole job.
π $f->trim($text, $len)
trims the text you gave it down to $len (in em, obvi) and returns the trimmed text. cute, efficient, does exactly one thing πΈ
β $f->out_text($text)
acknowledges that the text is gonna be output β for subsetting purposes, etc. basically a lil nod that says "yeah bestie, I see that text, logging it" π
reminder bestie: keep those font names exactly as spelled. ZapfDingbats is not a typo and no, you cannot fix it. π
sign-off time π this whole page came to you courtesy of perl v5.36.0, dated 2022-10-22, and honestly? she ate. Text::PDF::SFont(3pm), out. π¦β¨
π¦ 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