KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
minifont.h
Go to the documentation of this file.
1/* KallistiOS ##version##
2
3 dc/minifont.h
4 Copyright (C) 2020 Lawrence Sebald
5
6*/
7
8/** \file dc/minifont.h
9 \brief Simple font drawing functions.
10 \ingroup video_fonts_mini
11
12 This file provides support for utilizing the "Naomi" font that is included
13 in the KOS source code (in the utils/minifont.h file). This was designed for
14 use when you really just want a *very* simple font to draw with.
15
16 \note
17 Only ASCII characters are usable here. No other fancy encodings are
18 supported, nor are any extended ASCII characters beyond the 7-bit range.
19 Also, only 16-bit buffers (like what you would normally have for the
20 framebuffer) are currently supported.
21
22 \author Lawrence Sebald
23*/
24
25#ifndef __DC_MINIFONT_H
26#define __DC_MINIFONT_H
27
28#include <kos/cdefs.h>
29__BEGIN_DECLS
30
31#include <arch/types.h>
32
33/** \defgroup video_fonts_mini Mini
34 \brief Extra mini-font provided for Dreamcast and NAOMI
35 \ingroup video_fonts
36
37 @{
38*/
39
40/** \brief Draw a single character to a buffer.
41
42 This function draws a single character to the given buffer.
43
44 \param buffer The buffer to draw to (at least 8 x 16 pixels)
45 \param bufwidth The width of the buffer in pixels
46 \param c The character to draw
47
48 \return Amount of width covered in 16-bit increments.
49*/
50int minifont_draw(uint16 *buffer, uint32 bufwidth, uint32 c);
51
52/** \brief Draw a full string to any sort of buffer.
53
54 This function draws a NUL-terminated string to the given buffer. Only
55 standard ASCII encoded strings are supported (no extended ASCII, ANSI,
56 Unicode, JIS, EUC, etc).
57
58 \param b The buffer to draw to.
59 \param bufwidth The width of the buffer in pixels.
60 \param str The string to draw.
61
62 \return Amount of width covered in 16-bit increments.
63*/
64int minifont_draw_str(uint16 *b, uint32 bufwidth, const char *str);
65
66/** @} */
67
68__END_DECLS
69
70#endif /* __DC_MINIFONT_H */
Definitions for builtin attributes and compiler directives.
unsigned short uint16
16-bit unsigned integer
Definition types.h:34
unsigned long uint32
32-bit unsigned integer
Definition types.h:33
int minifont_draw_str(uint16 *b, uint32 bufwidth, const char *str)
Draw a full string to any sort of buffer.
int minifont_draw(uint16 *buffer, uint32 bufwidth, uint32 c)
Draw a single character to a buffer.
Common integer types.