From: Lawrence S. <ljs...@us...> - 2020-06-11 03:07:10
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via e52380c54ffca72358d622f7b852c75a527178b1 (commit) from c62f4d699d928b4d2fc020f28442ec944c6dadad (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e52380c54ffca72358d622f7b852c75a527178b1 Author: Lawrence Sebald <ljs...@us...> Date: Wed Jun 10 23:06:52 2020 -0400 Add public header for minifont. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/dc/minifont.h | 57 +++++++++++++++++++++++++++++ kernel/arch/dreamcast/util/minifont.c | 1 + kernel/arch/dreamcast/util/minifont.h | 18 +++++++-- 3 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 kernel/arch/dreamcast/include/dc/minifont.h diff --git a/kernel/arch/dreamcast/include/dc/minifont.h b/kernel/arch/dreamcast/include/dc/minifont.h new file mode 100644 index 0000000..8e85b73 --- /dev/null +++ b/kernel/arch/dreamcast/include/dc/minifont.h @@ -0,0 +1,57 @@ +/* KallistiOS ##version## + + dc/minifont.h + Copyright (C) 2020 Lawrence Sebald + +*/ + +/** \file dc/minifont.h + \brief Simple font drawing functions. + + This file provides support for utilizing the "Naomi" font that is included + in the KOS source code (in the utils/minifont.h file). This was designed for + use when you really just want a *very* simple font to draw with. + + Only ASCII characters are usable here. No other fancy encodings are + supported, nor are any extended ASCII characters beyond the 7-bit range. + Also, only 16-bit buffers (like what you would normally have for the + framebuffer) are currently supported. + + \author Lawrence Sebald +*/ + +#ifndef __DC_MINIFONT_H +#define __DC_MINIFONT_H + +#include <kos/cdefs.h> +__BEGIN_DECLS + +#include <arch/types.h> + +/** \brief Draw a single character to a buffer. + + This function draws a single character to the given buffer. + + \param buffer The buffer to draw to (at least 8 x 16 pixels) + \param bufwidth The width of the buffer in pixels + \param c The character to draw + \return Amount of width covered in 16-bit increments. +*/ +int minifont_draw(uint16 *buffer, uint32 bufwidth, uint32 c); + +/** \brief Draw a full string to any sort of buffer. + + This function draws a NUL-terminated string to the given buffer. Only + standard ASCII encoded strings are supported (no extended ASCII, ANSI, + Unicode, JIS, EUC, etc). + + \param b The buffer to draw to. + \param width The width of the buffer in pixels. + \param str The string to draw. + \return Amount of width covered in 16-bit increments. +*/ +int minifont_draw_str(uint16 *b, uint32 bufwidth, const char *str); + +__END_DECLS + +#endif /* __DC_MINIFONT_H */ diff --git a/kernel/arch/dreamcast/util/minifont.c b/kernel/arch/dreamcast/util/minifont.c index 07325e3..0cc3b13 100644 --- a/kernel/arch/dreamcast/util/minifont.c +++ b/kernel/arch/dreamcast/util/minifont.c @@ -6,6 +6,7 @@ */ #include <string.h> +#include <dc/minifont.h> #include "minifont.h" #define CHAR_WIDTH 8 diff --git a/kernel/arch/dreamcast/util/minifont.h b/kernel/arch/dreamcast/util/minifont.h index f162f66..93a199f 100644 --- a/kernel/arch/dreamcast/util/minifont.h +++ b/kernel/arch/dreamcast/util/minifont.h @@ -1,3 +1,18 @@ +/* KallistiOS ##version## + + util/minifont.h + Copyright (C) 2020 Lawrence Sebald + +*/ + +/* This file defines a very simple 1bpp font called "Naomi" that I designed for + use when you just don't want to (or can't) use the biosfont. It's called + Naomi because, well, it was specifically put to use there first of all for + my early debugging with it. + + Only ASCII characters 33-126 are present here. Each one taking up 16 bytes + of the data. Each character is 8x16 pixels in size. */ + static const int minifont_size = 1504; static const unsigned char minifont_data[1504] = { 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, @@ -189,6 +204,3 @@ static const unsigned char minifont_data[1504] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x51, 0x8a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; - -int minifont_draw(uint16 *buffer, uint32 bufwidth, uint32 c); -int minifont_draw_str(uint16 *buffer, uint32 bufwidth, const char *str); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |