PS_FINDFONT(3)

πŸ’– PS_FINDFONT(3) πŸ’–

okay bestie, welcome to the PS_findfont page β€” it's living in the Library Functions Manual, and it's about to teach you how to load a font like a boss. no cap. πŸŽ€


✨ SYNOPSIS ✨

#include <pslib.h>

int PS_findfont(PSDoc *psdoc, const char *fontname, const char
*encoding, int embed)

🌸 DESCRIPTION 🌸

so basically PS_findfont loads a font for later use. that's the whole vibe. πŸ’…

but listen β€” before you can actually output any text with a font you loaded, you have to set it with PS_setfont(3). like, no setfont, no text, that's just how it is. periodt.

this function also needs the adobe font metric file, because that's how it calculates the space used up by the characters. math is math. πŸ”₯

now here's the part you gotta remember, bestie, because it's giving scope rules:

  • a font loaded within a page will only be available on that page πŸ™ˆ
  • fonts that are meant to be used in the complete document have to be loaded before the first call of PS_begin_page(3) πŸ‘‘
  • calling PS_findfont(3) between pages will make that font available for all following pages ✨

PS_findfont will also try to load the file you pass in the encoding parameter. those encoding files use the same syntax as the ones used by dvips(1). inside them you'll find:

  • a font encoding vector β€” which is currently not used but must be present (yes queen, it's decorative but mandatory πŸ’€)
  • a list of extra ligatures to extend the list of ligatures derived from the afm file

encoding can be NULL or the empty string if the default encoding (TeXBase1) shall be used. easy.

and if you set the encoding to builtin? then there's no reencoding at all and the font specific encoding gets used instead. this is very useful with symbol fonts β€” lowkey iconic. πŸ¦‹

oh and one more thing: all files get searched first in the current directory and then in the directories set by the parameter SearchPath. search order matters, iykyk. πŸ”


🫢 RETURN VALUE 🫢

returns the identifier of the font, or zero in case of an error. and the identifier? it's a positiv number. (that's a typo in the source and I'm keeping it, it's part of the lore now πŸ’€βœ¨)


🌈 SEE ALSO 🌈


πŸ‘‘ AUTHOR πŸ‘‘

this manual page was written by Uwe Steinmann <uwe@steinmann.cx>.


and that's the whole page, bestie β€” shoutout to the PS_FINDFONT(3) footer and the Library Functions Manual it came from, mwah πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from