WSFONT(9) | Kernel Developer's Manual | WSFONT(9) |
wsfont
, wsfont_init
,
wsfont_matches
, wsfont_find
,
wsfont_add
, wsfont_remove
,
wsfont_enum
, wsfont_lock
,
wsfont_unlock
,
wsfont_map_unichar
—
#include <dev/wscons/wsconsio.h>
#include <dev/wsfont/wsfont.h>
void
wsfont_init
(void);
int
wsfont_matches
(struct
wsdisplay_font *font,
const char *name,
int width,
int height,
int stride,
int flags);
int
wsfont_find
(const
char *name, int
width, int height,
int stride,
int bitorder,
int byteorder,
int flags);
int
wsfont_add
(struct
wsdisplay_font *font, int
copy);
int
wsfont_remove
(int
cookie);
void
wsfont_enum
(void
(*callback)(const char *, int, int, int));
int
wsfont_lock
(int
cookie, struct
wsdisplay_font **ptr);
int
wsfont_unlock
(int
cookie);
int
wsfont_map_unichar
(struct
wsdisplay_font *font, int
c);
wsfont
module is a component of the
wscons(9) framework to provide
access to display fonts. Fonts may be loaded dynamically into the kernel or
included statically in the kernel at compile time. Display drivers which
emulate a glass-tty console on a bit-mapped display can add, remove and find
fonts for use by device-dependent blitter operations.
The primary data type for manipulating fonts is the wsdisplay_font structure in dev/wscons/wsconsio.h:
struct wsdisplay_font { const char *name; /* font name */ 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 *data; /* pointer to font table */ };
The maximum font table size is WSDISPLAY_MAXFONTSZ.
The wsfont
framework supports fonts with
the following encodings:
WSDISPLAY_FONTENC_ISO
WSDISPLAY_FONTENC_IBM
WSDISPLAY_FONTENC_PCVT
WSDISPLAY_FONTENC_ISO7
WSDISPLAY_FONTENC_ISO2
wsfont_init
(void)wsfont_matches
(font,
name, width,
height, stride)wsfont_find
().wsfont_find
(name,
width, height,
stride, bitorder,
byteorder, flags)wsfont_find
() is called with any of the parameters
as 0, it indicates that 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.
The bitorder and byteorder arguments are the bit order and byte order required. Valid values are:
WSDISPLAY_FONTORDER_KNOWN
WSDISPLAY_FONTORDER_L2R
WSDISPLAY_FONTORDER_R2L
The flags parameter determines what type of font can be returned. Any combination of the following values is allowed:
WSFONT_FIND_BITMAP
WSFONT_FIND_ALPHA
wsfont_enum
()
should be used.wsfont_add
(font,
copy)wsfont_remove
(cookie)wsfont_add
().wsfont_enum
(callback)wsfont_lock
(cookie,
ptr)wsfont_find
() then the glyph data will be
modified to match. At this point it may be necessary for
wsfont_lock
() to make a copy of the font data;
this action is transparent to the caller. A later call to
wsfont_unlock
() will free resources used by
temporary copies.
The address of the wsdisplay_font pointer for the specified font is returned in the ptr argument.
wsfont_lock
() returns zero on success,
or an error code on failure.
wsfont_unlock
(cookie)wsfont_map_unichar
(font,
c)January 13, 2012 | NetBSD 9.0 |