Text::PDF::SFont(3pm)

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

🌸 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 Symbol or ZapfDingbats rn 😭 the author hasn't got their head around the AFMs yet
  • MacExpertEncoding is 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