WSFONT_INIT(9)

πŸ“¦ in nixpkgs unstable

πŸ’– WSFONT_INIT(9): the wscons font-support page, but make it cute πŸ’–

okay so this is the Kernel Developer's Manual page for wsfont_init, wsfont_find, wsfont_add, wsfont_remove, wsfont_enum, wsfont_lock, wsfont_unlock, and wsfont_map_unichar. It's giving wscons font support, and honestly it's kind of iconic if you're into display fonts. Bestie, if you're a display driver trying to emulate a glass-tty console on a bit-mapped display, this is your moment. 🫢


🌸 NAME 🌸

wsfont_init, wsfont_find, wsfont_add, wsfont_remove, wsfont_enum, wsfont_lock, wsfont_unlock, wsfont_map_unichar β€” wscons font support. That's the whole vibe: font access inside wscons. No cap. πŸ’…

✨ SYNOPSIS ✨

#include <dev/wscons/wsconsio.h>
#include <dev/wsfont/wsfont.h>

void
wsfont_init(void);

int
wsfont_find(const char *name, int width, int height, int stride);

int
wsfont_add(struct wsdisplay_font *font, int copy);

int
wsfont_remove(int cookie);

void
wsfont_enum(int (*cb)(void *, struct wsdisplay_font *), void *cbarg);

int
wsfont_lock(int cookie, struct wsdisplay_font **ptr, int bitorder,
    int byteorder);

int
wsfont_unlock(int cookie);

int
wsfont_map_unichar(struct wsdisplay_font *font, int c);

πŸ¦‹ DESCRIPTION πŸ¦‹

The wsfont module is literally a component of the wscons framework, and its whole job is providing access to display fonts. Fonts can be loaded dynamically into the kernel, or included statically in the kernel at compile time. Display drivers that emulate a glass-tty console on a bit-mapped display can add, remove, and find fonts for use by device-dependent blitter operations. That's the tea. β˜•

The primary data type for manipulating fonts is the wsdisplay_font structure in <dev/wscons/wsconsio.h>:

struct wsdisplay_font {
        char name[WSFONT_NAME_SIZE];    /* font name */
        int index;
        int firstchar;
        int numchars;                   /* size of font table */
        int encoding;                   /* font encoding */
        u_int fontwidth;                /* character width */
        u_int fontheight;               /* character height */
        u_int stride;
        int bitorder;
        int byteorder;
        void *cookie;
        void *data;                     /* pointer to font table */
};

The maximum font table size is WSDISPLAY_MAXFONTSZ. Periodt.

The wsfont framework supports fonts with these encodings:

  • WSDISPLAY_FONTENC_ISO β€” ISO-encoded fonts. Classic.
  • WSDISPLAY_FONTENC_IBM β€” IBM-encoded fonts commonly available for IBM CGA, EGA and VGA display adapters. Retro legend behavior. πŸ‘‘

πŸ› οΈ FUNCTIONS πŸ› οΈ

  • wsfont_init(void) β€” Initialises the font list with the built-in fonts. It's the setup era. ✨
  • wsfont_find(name, width, height, stride) β€” Finds the font called name from the fonts loaded into the kernel. The font aspect is specified by width, height, and stride. If wsfont_find() is called with any of the parameters as 0, that indicates we don't care about that aspect of the font. If the font is found, a (nonnegative-valued) cookie is returned which can be used with the other functions. When more flexibility is required, wsfont_enum() should be used. Lowkey the search bestie.
  • wsfont_add(font, copy) β€” Adds a font font to the font list. If the copy argument is non-zero, then the font is physically copied, otherwise a reference to the original font is made. Copy vs. reference: the eternal vibe check.
  • wsfont_remove(cookie) β€” Removes the font specified by cookie from the font list. The value of cookie was returned by wsfont_add(). Bye-bye, font. πŸŽ€
  • wsfont_enum(callback, cbarg) β€” Enumerates the list of fonts. For each font in the font list, the callback function argument is called with the cbarg argument. It's giving font-list roll call. πŸ“‹
  • wsfont_lock(cookie, ptr, bitorder, byteorder) β€” Locks access to the font specified by cookie so that it cannot be unloaded from the kernel while it is being used. If the bit or byte order of the font to be locked differs from what has been requested via the bitorder and byteorder arguments, then the glyph data will be modified to match. The address of the wsdisplay_font pointer for the specified font is returned in the ptr argument. wsfont_lock() returns lockcount on success, or an error code on failure.
  • wsfont_unlock(cookie) β€” Unlocks the font specified by cookie. Returns lockcount on success, or an error code on failure. Release the font, bestie. πŸ”“
  • wsfont_map_unichar(font, c) β€” Remaps the unicode character c to glyph for font font. Returns the glyph on success or -1 on error. Mapping era. πŸ—ΊοΈ
bestie, wsfont_lock() and wsfont_unlock() both return lockcount on success and an error code on failure β€” that's the success/failure vibe check, no cap.

πŸ“š CODE REFERENCES πŸ“š

The wscons subsystem is implemented within the directory sys/dev/wscons. The wsfont subsystem itself is implemented within the file sys/dev/wsfont/wsfont.c. File-path realness. πŸ—‚οΈ

πŸ‘€ SEE ALSO πŸ‘€

wsfontload(8), intro(9). Go read them, bestie. πŸ’–


signed off with Debian source/version energy and the date May 10, 2019 β€” mwah, that's the footer situation. πŸ’…πŸŽ€

πŸ“¦ where this page comes from
  • nixpkgs unstable: cvs-export
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms