FONTSAVE(3L)

NAME
fontsave, fontcache, fontremove - save/remove a font from the cache

SYNOPSIS
#include <dmd.h>
#include <font.h>

int fontcache (fname, f)

Font *fontsave (fname, f)

void fontremove (fname)

char *fname;
Font *f;

DESCRIPTION
Fname points to a font name, a null terminated string of up to 14 characters.

The fontsave and fontcache functions put the given font into the font cache and give it the name fname. Once the font is in the cache, any other process within the terminal can use it by calling fontrequest.

The fontcache function expects the given font to be already in allocated memory through calls to alloc and gcalloc. This function also does a fontrequest for the calling application. If the caching or subsequent request fails, fontcache will return a 0; otherwise, a 1 is returned on success. Note that once the font is put into the cache, the font should only be freed by calling fontremove.

The fontsave function is used to cache fonts not in memory allocated through calls to alloc and gcalloc. Fontsave first attempts to allocate memory, then duplicates the given font into the allocated memory, and finally calls fontcache to cache the newly created font. On success, fontsave returns the pointer to the new font. If it cannot allocate enough memory for the creation of the new font, of if fontcache fails, fontsave will return a null pointer.

The fontremove function removes the named font from the cache and frees its memory. A request to remove a font that is currently requested by some other process will be ignored.

SEE ALSO
alloc(3R), fontname(3R), fontrequest(3R), gcalloc(3R), infont(3R/3L), structures(3R).