KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Functions
biosfont.h File Reference

BIOS font drawing functions. More...

#include <sys/cdefs.h>
#include <arch/types.h>

Go to the source code of this file.

Macros

#define BFONT_CODE_ISO8859_1   0
 ISO-8859-1 (western) charset. More...
 
#define BFONT_CODE_EUC   1
 EUC-JP charset. More...
 
#define BFONT_CODE_SJIS   2
 Shift-JIS charset. More...
 

Functions

uint32 bfont_set_foreground_color (uint32 c)
 Set the font foreground color. More...
 
uint32 bfont_set_background_color (uint32 c)
 Set the font background color. More...
 
int bfont_set_32bit_mode (int on)
 Set the font to draw 32-bit color. More...
 
void bfont_set_encoding (int enc)
 Set the font encoding. More...
 
uint8bfont_find_char (int ch)
 Find an ISO-8859-1 character in the font. More...
 
uint8bfont_find_char_jp (int ch)
 Find an full-width Japanese character in the font. More...
 
uint8bfont_find_char_jp_half (int ch)
 Find an half-width Japanese character in the font. More...
 
void bfont_draw (void *buffer, int bufwidth, int opaque, int c)
 Draw a single character to a buffer. More...
 
void bfont_draw_thin (void *buffer, int bufwidth, int opaque, int c, int iskana)
 Draw a single thin character to a buffer. More...
 
void bfont_draw_wide (void *buffer, int bufwidth, int opaque, int c)
 Draw a single wide character to a buffer. More...
 
void bfont_draw_str (void *buffer, int width, int opaque, char *str)
 Draw a full string to a buffer. More...
 

Detailed Description

BIOS font drawing functions.

This file provides support for utilizing the font built into the Dreamcast's BIOS. These functions allow access to both the western character set and Japanese characters.

Author
Dan Potter
Kazuaki Matsumoto

Macro Definition Documentation

#define BFONT_CODE_EUC   1

EUC-JP charset.

#define BFONT_CODE_ISO8859_1   0

ISO-8859-1 (western) charset.

#define BFONT_CODE_SJIS   2

Shift-JIS charset.

Function Documentation

void bfont_draw ( void *  buffer,
int  bufwidth,
int  opaque,
int  c 
)

Draw a single character to a buffer.

This function draws a single character in the set encoding to the given buffer. Calling this is equivalent to calling bfont_draw_thin() with 0 for the final parameter.

Parameters
bufferThe buffer to draw to (at least 12 x 24 pixels)
bufwidthThe width of the buffer in pixels
opaqueIf non-zero, overwrite blank areas with black, otherwise do not change them from what they are
cThe character to draw
void bfont_draw_str ( void *  buffer,
int  width,
int  opaque,
char *  str 
)

Draw a full string to a buffer.

This function draws a NUL-terminated string in the set encoding to the given buffer. This will automatially handle mixed half and full-width characters if the encoding is set to one of the Japanese encodings.

Parameters
bufferThe buffer to draw to
widthThe width of the buffer in pixels
opaqueIf non-zero, overwrite blank areas with black, otherwise do not change them from what they are
strThe string to draw
void bfont_draw_thin ( void *  buffer,
int  bufwidth,
int  opaque,
int  c,
int  iskana 
)

Draw a single thin character to a buffer.

This function draws a single character in the set encoding to the given buffer. This only works with ISO-8859-1 characters and half-width kana.

Parameters
bufferThe buffer to draw to (at least 12 x 24 pixels)
bufwidthThe width of the buffer in pixels
opaqueIf non-zero, overwrite blank areas with black, otherwise do not change them from what they are
cThe character to draw
iskanaSet to 1 if the character is a kana, 0 if ISO-8859-1
void bfont_draw_wide ( void *  buffer,
int  bufwidth,
int  opaque,
int  c 
)

Draw a single wide character to a buffer.

This function draws a single character in the set encoding to the given buffer. This only works with full-width kana and kanji.

Parameters
bufferThe buffer to draw to (at least 24 x 24 pixels)
bufwidthThe width of the buffer in pixels
opaqueIf non-zero, overwrite blank areas with black, otherwise do not change them from what they are
cThe character to draw
uint8* bfont_find_char ( int  ch)

Find an ISO-8859-1 character in the font.

This function retrieves a pointer to the font data for the specified character in the font, if its available. Generally, you will not have to use this function, use one of the bfont_draw_* functions instead.

Parameters
chThe character to look up
Returns
A pointer to the raw character data
uint8* bfont_find_char_jp ( int  ch)

Find an full-width Japanese character in the font.

This function retrieves a pointer to the font data for the specified character in the font, if its available. Generally, you will not have to use this function, use one of the bfont_draw_* functions instead.

This function deals with full-width kana and kanji.

Parameters
chThe character to look up
Returns
A pointer to the raw character data
uint8* bfont_find_char_jp_half ( int  ch)

Find an half-width Japanese character in the font.

This function retrieves a pointer to the font data for the specified character in the font, if its available. Generally, you will not have to use this function, use one of the bfont_draw_* functions instead.

This function deals with half-width kana only.

Parameters
chThe character to look up
Returns
A pointer to the raw character data
int bfont_set_32bit_mode ( int  on)

Set the font to draw 32-bit color.

This function changes whether the font draws colors as 32-bit or 16-bit. The default is to use 16-bit.

Parameters
onSet to 0 to use 16-bit color, 32-bit otherwise.
Returns
The old state (1 = 32-bit, 0 = 16-bit).
uint32 bfont_set_background_color ( uint32  c)

Set the font background color.

This function selects the background color to draw when a pixel is drawn in the font. This color is only used for pixels not covered by the font when you have selected to have the font be opaque.

Parameters
cThe color to use.
Returns
The old background color.
void bfont_set_encoding ( int  enc)

Set the font encoding.

This function selects the font encoding that is used for the font. This allows you to select between the various character sets available.

Parameters
encThe character encoding in use
See also
BFONT_CODE_ISO8859_1
BFONT_CODE_EUC
BFONT_CODE_SJIS
uint32 bfont_set_foreground_color ( uint32  c)

Set the font foreground color.

This function selects the foreground color to draw when a pixel is opaque in the font. The value passed in for the color should be in whatever pixel format that you intend to use for the image produced.

Parameters
cThe color to use.
Returns
The old foreground color.