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 Copyright (C) 2025 Daniel Fairchild
6
7*/
8
9/** \file dc/minifont.h
10 \brief Simple font drawing functions.
11 \ingroup video_fonts_mini
12
13 This file provides support for utilizing the "Naomi" font that is included
14 in the KOS source code (in the utils/minifont.h file). This was designed for
15 use when you really just want a *very* simple font to draw with.
16
17 \note
18 Only ASCII characters are usable here. No other fancy encodings are
19 supported, nor are any extended ASCII characters beyond the 7-bit range.
20 Also, only 16-bit buffers (like what you would normally have for the
21 framebuffer) are currently supported.
22
23 \author Lawrence Sebald
24*/
25
26#ifndef __DC_MINIFONT_H
27#define __DC_MINIFONT_H
28
29#include <kos/cdefs.h>
30__BEGIN_DECLS
31
32#include <stdint.h>
33
34/** \defgroup video_fonts_mini Mini
35 \brief Extra mini-font provided for Dreamcast and NAOMI
36 \ingroup video_fonts
37
38 @{
39*/
40
41/** \brief Draw a single character to a buffer.
42
43 This function draws a single character to the given buffer.
44
45 \param buffer The buffer to draw to (at least 8 x 16 pixels)
46 \param bufwidth The width of the buffer in pixels
47 \param c The character to draw
48
49 \return Amount of width covered in 16-bit increments.
50*/
51int minifont_draw(uint16_t *buffer, uint32_t bufwidth, uint32_t c);
52
53/** \brief Draw a full string to any sort of buffer.
54
55 This function draws a NUL-terminated string to the given buffer. Only
56 standard ASCII encoded strings are supported (no extended ASCII, ANSI,
57 Unicode, JIS, EUC, etc).
58
59 \param b The buffer to draw to.
60 \param bufwidth The width of the buffer in pixels.
61 \param str The string to draw.
62
63 \return Amount of width covered in 16-bit increments.
64*/
65int minifont_draw_str(uint16_t *b, uint32_t bufwidth, const char *str);
66
67/** \brief Set the color for the mini font.
68 \param r Red component (0-255)
69 \param g Green component (0-255)
70 \param b Blue component (0-255)
71*/
72void minifont_set_color(uint8_t r, uint8_t g, uint8_t b);
73
74/** @} */
75
76__END_DECLS
77
78#endif /* __DC_MINIFONT_H */
static float r
Definition bubbles.c:95
Various common macros used throughout the codebase.
int minifont_draw(uint16_t *buffer, uint32_t bufwidth, uint32_t c)
Draw a single character to a buffer.
void minifont_set_color(uint8_t r, uint8_t g, uint8_t b)
Set the color for the mini font.
int minifont_draw_str(uint16_t *b, uint32_t bufwidth, const char *str)
Draw a full string to any sort of buffer.
static char buffer[256]
Definition porthelper.c:11