KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
BIOS

API for the Dreamcast's built-in BIOS font. More...

Modules

 Dimensions of the Bios Font
 
 Structure
 Structure of the Bios Font.
 

Files

file  biosfont.h
 BIOS font drawing functions.
 

Functions

uint32 bfont_set_foreground_color (uint32 c)
 Set the font foreground color.
 
uint32 bfont_set_background_color (uint32 c)
 Set the font background color.
 
int bfont_set_32bit_mode (int on) __depr("Please use the bpp function of the the bfont_draw_ex functions")
 Set the font to draw 32-bit color.
 
void bfont_set_encoding (uint8 enc)
 Set the font encoding.
 
uint8bfont_find_char (uint32 ch)
 Find an ISO-8859-1 character in the font.
 
uint8bfont_find_char_jp (uint32 ch)
 Find an full-width Japanese character in the font.
 
uint8bfont_find_char_jp_half (uint32 ch)
 Find an half-width Japanese character in the font.
 
unsigned char bfont_draw_ex (uint8 *buffer, uint32 bufwidth, uint32 fg, uint32 bg, uint8 bpp, uint8 opaque, uint32 c, uint8 wide, uint8 iskana)
 Draw a single character of any sort to the buffer.
 
unsigned char bfont_draw (void *buffer, uint32 bufwidth, uint8 opaque, uint32 c)
 Draw a single character to a buffer.
 
unsigned char bfont_draw_thin (void *buffer, uint32 bufwidth, uint8 opaque, uint32 c, uint8 iskana)
 Draw a single thin character to a buffer.
 
unsigned char bfont_draw_wide (void *buffer, uint32 bufwidth, uint8 opaque, uint32 c)
 Draw a single wide character to a buffer.
 
void bfont_draw_str_ex (void *b, uint32 width, uint32 fg, uint32 bg, uint8 bpp, uint8 opaque, const char *str)
 Draw a full string to any sort of buffer.
 
void bfont_draw_str (void *b, uint32 width, uint8 opaque, const char *str)
 Draw a full string to a buffer.
 
uint8bfont_find_icon (uint8 icon)
 Find a VMU icon.
 

Detailed Description

API for the Dreamcast's built-in BIOS font.

Function Documentation

◆ bfont_draw()

unsigned char bfont_draw ( void *  buffer,
uint32  bufwidth,
uint8  opaque,
uint32  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
Returns
Amount of width covered in bytes.

◆ bfont_draw_ex()

unsigned char bfont_draw_ex ( uint8 buffer,
uint32  bufwidth,
uint32  fg,
uint32  bg,
uint8  bpp,
uint8  opaque,
uint32  c,
uint8  wide,
uint8  iskana 
)

Draw a single character of any sort to the buffer.

This function draws a single character in the set encoding to the given buffer. This function sits under draw, draw_thin, and draw_wide, while exposing the colors and bitdepths desired. This will allow the writing of bfont characters to paletted textures.

Parameters
bufferThe buffer to draw to.
bufwidthThe width of the buffer in pixels.
fgThe foreground color to use.
bgThe background color to use.
bppThe number of bits per pixel in the buffer.
opaqueIf non-zero, overwrite background areas with black, otherwise do not change them from what they are.
cThe character to draw.
wideDraw a wide character.
iskanaDraw a half-width kana character.
Returns
Amount of width covered in bytes.

◆ bfont_draw_str()

void bfont_draw_str ( void *  b,
uint32  width,
uint8  opaque,
const 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 automatically handle mixed half and full-width characters if the encoding is set to one of the Japanese encodings. Draws pre-set 16-bit colors.

Parameters
bThe buffer to draw to.
widthThe width of the buffer in pixels.
opaqueIf one, overwrite blank areas with bfont_bgcolor, otherwise do not change them from what they are.
strThe string to draw.

◆ bfont_draw_str_ex()

void bfont_draw_str_ex ( void *  b,
uint32  width,
uint32  fg,
uint32  bg,
uint8  bpp,
uint8  opaque,
const char *  str 
)

Draw a full string to any sort of buffer.

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

Parameters
bThe buffer to draw to.
widthThe width of the buffer in pixels.
fgThe foreground color to use.
bgThe background color to use.
bppThe number of bits per pixel in the buffer.
opaqueIf non-zero, overwrite background areas with black, otherwise do not change them from what they are.
strThe string to draw.

◆ bfont_draw_thin()

unsigned char bfont_draw_thin ( void *  buffer,
uint32  bufwidth,
uint8  opaque,
uint32  c,
uint8  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
Returns
Amount of width covered in bytes.

◆ bfont_draw_wide()

unsigned char bfont_draw_wide ( void *  buffer,
uint32  bufwidth,
uint8  opaque,
uint32  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
Returns
Amount of width covered in bytes.

◆ bfont_find_char()

uint8 * bfont_find_char ( uint32  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

◆ bfont_find_char_jp()

uint8 * bfont_find_char_jp ( uint32  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

◆ bfont_find_char_jp_half()

uint8 * bfont_find_char_jp_half ( uint32  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

◆ bfont_find_icon()

uint8 * bfont_find_icon ( uint8  icon)

Find a VMU icon.

This function retrieves a pointer to the icon data for the specified VMU icon in the bios, if its available. The icon data is flipped both vertically and horizontally. Each vmu icon has dimensions 32x32 pixels and is 128 bytes long.

Parameters
iconThe icon to look up. Use BFONT_ICON_* values starting with BFONT_ICON_INVALID_VMU.
Returns
A pointer to the raw icon data or NULL if icon value is incorrect.

◆ bfont_set_32bit_mode()

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).

◆ bfont_set_background_color()

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.

◆ bfont_set_encoding()

void bfont_set_encoding ( uint8  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
BFONT_CODE_RAW

◆ bfont_set_foreground_color()

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.