KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
biosfont.h File Reference

BIOS font drawing functions. More...

#include <kos/cdefs.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <arch/types.h>

Go to the source code of this file.

Macros

#define BFONT_THIN_WIDTH   12
 Width of Thin Font (ISO8859_1, half-JP)
 
#define BFONT_WIDE_WIDTH   (BFONT_THIN_WIDTH * 2)
 Width of Wide Font (full-JP)
 
#define BFONT_HEIGHT   24
 Height of All Fonts.
 
#define BFONT_ICON_DIMEN   32
 Dimension of vmu icons.
 
#define BFONT_BYTES_PER_CHAR   (BFONT_THIN_WIDTH * BFONT_HEIGHT / 8)
 Number of bytes to represent a single thin character within the BIOS font.
 
#define BFONT_BYTES_PER_WIDE_CHAR   (BFONT_WIDE_WIDTH * BFONT_HEIGHT / 8)
 Number of bytes to represent a single wide character within the BIOS font.
 
#define BFONT_BYTES_PER_VMU_ICON   (BFONT_ICON_DIMEN * BFONT_ICON_DIMEN / 8)
 Number of bytes to represent a vmu icon within the BIOS font.
 
#define BFONT_NARROW_START   0
 Start of Narrow Characters in Font Block.
 
#define BFONT_OVERBAR   BFONT_NARROW_START
 
#define BFONT_ISO_8859_1_33_126   (BFONT_NARROW_START + ( 1 * BFONT_BYTES_PER_CHAR))
 
#define BFONT_YEN   (BFONT_NARROW_START + (95 * BFONT_BYTES_PER_CHAR))
 
#define BFONT_ISO_8859_1_160_255   (BFONT_NARROW_START + (96 * BFONT_BYTES_PER_CHAR))
 
#define JISX_0208_ROW_SIZE   94
 Size of a row for JISX-0208 characters.
 
#define BFONT_WIDE_START   (288 * BFONT_BYTES_PER_CHAR)
 Start of Wide Characters in Font Block.
 
#define BFONT_JISX_0208_ROW1   BFONT_WIDE_START
 Start of JISX-0208 Rows 1-7 in Font Block.
 
#define BFONT_JISX_0208_ROW16   (BFONT_WIDE_START + (658 * BFONT_BYTES_PER_WIDE_CHAR))
 Start of JISX-0208 Row 16-47 (Start of Level 1) in Font Block.
 
#define BFONT_JISX_0208_ROW48   (BFONT_JISX_0208_ROW16 + ((32 * JISX_0208_ROW_SIZE) * BFONT_BYTES_PER_WIDE_CHAR))
 JISX-0208 Row 48-84 (Start of Level 2) in Font Block.
 
#define BFONT_DREAMCAST_SPECIFIC   (BFONT_WIDE_START + (7056 * BFONT_BYTES_PER_WIDE_CHAR))
 Start of DC Specific Icons in Font Block.
 
#define BFONT_VMU_DREAMCAST_SPECIFIC   (BFONT_DREAMCAST_SPECIFIC+(22 * BFONT_BYTES_PER_WIDE_CHAR))
 Start of VMU Specific Icons in Font Block.
 
#define DI_CIRCLECOPYRIGHT   "\\di00"
 brief Macros for Builtin DC Icons
 
#define DI_CIRCLER   "\\di01"
 
#define DI_TRADEMARK   "\\di02"
 
#define DI_UPARROW   "\\di03"
 
#define DI_DOWNARROW   "\\di04"
 
#define DI_LEFTARROW   "\\di05"
 
#define DI_RIGHTARROW   "\\di06"
 
#define DI_UPRIGHTARROW   "\\di07"
 
#define DI_DOWNRIGHTARROW   "\\di08"
 
#define DI_DOWNLEFTARROW   "\\di09"
 
#define DI_UPLEFTARROW   "\\di0A"
 
#define DI_ABUTTON   "\\di0B"
 
#define DI_BBUTTON   "\\di0C"
 
#define DI_CBUTTON   "\\di0D"
 
#define DI_DBUTTON   "\\di0E"
 
#define DI_XBUTTON   "\\di0F"
 
#define DI_YBUTTON   "\\di10"
 
#define DI_ZBUTTON   "\\di11"
 
#define DI_LTRIGGER   "\\di12"
 
#define DI_RTRIGGER   "\\di13"
 
#define DI_STARTBUTTON   "\\di14"
 
#define DI_VMU   "\\di15"
 
#define VI_INVALID_VMU   "\\vi00"
 brief Macros for Builtin VMU Icons
 
#define VI_HOURGLASS_ONE   "\\vi01"
 
#define VI_HOURGLASS_TWO   "\\vi02"
 
#define VI_HOURGLASS_THREE   "\\vi03"
 
#define VI_HOURGLASS_FOUR   "\\vi04"
 
#define VI_VMUICON   "\\vi05"
 
#define VI_EARTH   "\\vi06"
 
#define VI_SATURN   "\\vi07"
 
#define VI_QUARTER_MOON   "\\vi08"
 
#define VI_LAUGHING_FACE   "\\vi09"
 
#define VI_SMILING_FACE   "\\vi0A"
 
#define VI_CASUAL_FACE   "\\vi0B"
 
#define VI_ANGRY_FACE   "\\vi0C"
 
#define VI_COW   "\\vi0D"
 
#define VI_HORSE   "\\vi0E"
 
#define VI_RABBIT   "\\vi0F"
 
#define VI_CAT   "\\vi10"
 
#define VI_CHICK   "\\vi11"
 
#define VI_LION   "\\vi12"
 
#define VI_MONKEY   "\\vi13"
 
#define VI_PANDA   "\\vi14"
 
#define VI_BEAR   "\\vi15"
 
#define VI_PIG   "\\vi16"
 
#define VI_DOG   "\\vi17"
 
#define VI_FISH   "\\vi18"
 
#define VI_OCTOPUS   "\\vi19"
 
#define VI_SQUID   "\\vi1A"
 
#define VI_WHALE   "\\vi1B"
 
#define VI_CRAB   "\\vi1C"
 
#define VI_BUTTERFLY   "\\vi1D"
 
#define VI_LADYBUG   "\\vi1E"
 
#define VI_ANGLER_FISH   "\\vi1F"
 
#define VI_PENGUIN   "\\vi20"
 
#define VI_CHERRIES   "\\vi21"
 
#define VI_TULIP   "\\vi22"
 
#define VI_LEAF   "\\vi23"
 
#define VI_SAKURA   "\\vi24"
 
#define VI_APPLE   "\\vi25"
 
#define VI_ICECREAM   "\\vi26"
 
#define VI_CACTUS   "\\vi27"
 
#define VI_PIANO   "\\vi28"
 
#define VI_GUITAR   "\\vi29"
 
#define VI_EIGHTH_NOTE   "\\vi2A"
 
#define VI_TREBLE_CLEF   "\\vi2B"
 
#define VI_BOAT   "\\vi2C"
 
#define VI_CAR   "\\vi2D"
 
#define VI_HELMET   "\\vi2E"
 
#define VI_MOTORCYCLE   "\\vi2F"
 
#define VI_VAN   "\\vi30"
 
#define VI_TRUCK   "\\vi31"
 
#define VI_CLOCK   "\\vi32"
 
#define VI_TELEPHONE   "\\vi33"
 
#define VI_PENCIL   "\\vi34"
 
#define VI_CUP   "\\vi35"
 
#define VI_SILVERWARE   "\\vi36"
 
#define VI_HOUSE   "\\vi37"
 
#define VI_BELL   "\\vi38"
 
#define VI_CROWN   "\\vi39"
 
#define VI_SOCK   "\\vi3A"
 
#define VI_CAKE   "\\vi3B"
 
#define VI_KEY   "\\vi3C"
 
#define VI_BOOK   "\\vi3D"
 
#define VI_BASEBALL   "\\vi3E"
 
#define VI_SOCCER   "\\vi3F"
 
#define VI_BULB   "\\vi40"
 
#define VI_TEDDY_BEAR   "\\vi41"
 
#define VI_BOW_TIE   "\\vi42"
 
#define VI_BOW_ARROW   "\\vi43"
 
#define VI_SNOWMAN   "\\vi44"
 
#define VI_LIGHTNING   "\\vi45"
 
#define VI_SUN   "\\vi46"
 
#define VI_CLOUD   "\\vi47"
 
#define VI_UMBRELLA   "\\vi48"
 
#define VI_ONE_STAR   "\\vi49"
 
#define VI_TWO_STARS   "\\vi4A"
 
#define VI_THREE_STARS   "\\vi4B"
 
#define VI_FOUR_STARS   "\\vi4C"
 
#define VI_HEART   "\\vi4D"
 
#define VI_DIAMOND   "\\vi4E"
 
#define VI_SPADE   "\\vi4F"
 
#define VI_CLUB   "\\vi50"
 
#define VI_JACK   "\\vi51"
 
#define VI_QUEEN   "\\vi52"
 
#define VI_KING   "\\vi53"
 
#define VI_JOKER   "\\vi54"
 
#define VI_ISLAND   "\\vi55"
 
#define VI_0   "\\vi56"
 
#define VI_1   "\\vi57"
 
#define VI_2   "\\vi58"
 
#define VI_3   "\\vi59"
 
#define VI_4   "\\vi5A"
 
#define VI_5   "\\vi5B"
 
#define VI_6   "\\vi5C"
 
#define VI_7   "\\vi5D"
 
#define VI_8   "\\vi5E"
 
#define VI_9   "\\vi5F"
 
#define VI_A   "\\vi60"
 
#define VI_B   "\\vi61"
 
#define VI_C   "\\vi62"
 
#define VI_D   "\\vi63"
 
#define VI_E   "\\vi64"
 
#define VI_F   "\\vi65"
 
#define VI_G   "\\vi66"
 
#define VI_H   "\\vi67"
 
#define VI_I   "\\vi68"
 
#define VI_J   "\\vi69"
 
#define VI_K   "\\vi6A"
 
#define VI_L   "\\vi6B"
 
#define VI_M   "\\vi6C"
 
#define VI_N   "\\vi6D"
 
#define VI_O   "\\vi6E"
 
#define VI_P   "\\vi6F"
 
#define VI_Q   "\\vi70"
 
#define VI_R   "\\vi71"
 
#define VI_S   "\\vi72"
 
#define VI_T   "\\vi73"
 
#define VI_U   "\\vi74"
 
#define VI_V   "\\vi75"
 
#define VI_W   "\\vi76"
 
#define VI_X   "\\vi77"
 
#define VI_Y   "\\vi78"
 
#define VI_Z   "\\vi79"
 
#define VI_CHECKER_BOARD   "\\vi7A"
 
#define VI_GRID   "\\vi7B"
 
#define VI_LIGHT_GRAY   "\\vi7C"
 
#define VI_DIAG_GRID   "\\vi7D"
 
#define VI_PACMAN_GRID   "\\vi7E"
 
#define VI_DARK_GRAY   "\\vi7F"
 
#define VI_EMBROIDERY   "\\vi80"
 

Enumerations

enum  bfont_code_t { BFONT_CODE_ISO8859_1 = 0 , BFONT_CODE_EUC = 1 , BFONT_CODE_SJIS = 2 , BFONT_CODE_RAW = 3 }
 
enum  bfont_dc_icon_t {
  BFONT_ICON_CIRCLECOPYRIGHT = 0x00 , BFONT_CIRCLER = 0x01 , BFONT_ICON_TRADEMARK = 0x02 , BFONT_ICON_UPARROW = 0x03 ,
  BFONT_ICON_DOWNARROW = 0x04 , BFONT_ICON_LEFTARROW = 0x05 , BFONT_ICON_RIGHTARROW = 0x06 , BFONT_ICON_UPRIGHTARROW = 0x07 ,
  BFONT_ICON_DOWNRIGHTARROW = 0x08 , BFONT_ICON_DOWNLEFTARROW = 0x09 , BFONT_ICON_UPLEFTARROW = 0x0A , BFONT_ICON_ABUTTON = 0x0B ,
  BFONT_ICON_BBUTTON = 0x0C , BFONT_ICON_CBUTTON = 0x0D , BFONT_ICON_DBUTTON = 0x0E , BFONT_ICON_XBUTTON = 0x0F ,
  BFONT_ICON_YBUTTON = 0x10 , BFONT_ICON_ZBUTTON = 0x11 , BFONT_ICON_LTRIGGER = 0x12 , BFONT_ICON_RTRIGGER = 0x13 ,
  BFONT_ICON_STARTBUTTON = 0x14 , BFONT_ICON_VMU = 0x15
}
 Builtin DC Icons. More...
 
enum  bfont_vmu_icon_t {
  BFONT_ICON_INVALID_VMU = 0x00 , BFONT_ICON_HOURGLASS_ONE = 0x01 , BFONT_ICON_HOURGLASS_TWO = 0x02 , BFONT_ICON_HOURGLASS_THREE = 0x03 ,
  BFONT_ICON_HOURGLASS_FOUR = 0x04 , BFONT_ICON_VMUICON = 0x05 , BFONT_ICON_EARTH = 0x06 , BFONT_ICON_SATURN = 0x07 ,
  BFONT_ICON_QUARTER_MOON = 0x08 , BFONT_ICON_LAUGHING_FACE = 0x09 , BFONT_ICON_SMILING_FACE = 0x0A , BFONT_ICON_CASUAL_FACE = 0x0B ,
  BFONT_ICON_ANGRY_FACE = 0x0C , BFONT_ICON_COW = 0x0D , BFONT_ICON_HORSE = 0x0E , BFONT_ICON_RABBIT = 0x0F ,
  BFONT_ICON_CAT = 0x10 , BFONT_ICON_CHICK = 0x11 , BFONT_ICON_LION = 0x12 , BFONT_ICON_MONKEY = 0x13 ,
  BFONT_ICON_PANDA = 0x14 , BFONT_ICON_BEAR = 0x15 , BFONT_ICON_PIG = 0x16 , BFONT_ICON_DOG = 0x17 ,
  BFONT_ICON_FISH = 0x18 , BFONT_ICON_OCTOPUS = 0x19 , BFONT_ICON_SQUID = 0x1A , BFONT_ICON_WHALE = 0x1B ,
  BFONT_ICON_CRAB = 0x1C , BFONT_ICON_BUTTERFLY = 0x1D , BFONT_ICON_LADYBUG = 0x1E , BFONT_ICON_ANGLER_FISH = 0x1F ,
  BFONT_ICON_PENGUIN = 0x20 , BFONT_ICON_CHERRIES = 0x21 , BFONT_ICON_TULIP = 0x22 , BFONT_ICON_LEAF = 0x23 ,
  BFONT_ICON_SAKURA = 0x24 , BFONT_ICON_APPLE = 0x25 , BFONT_ICON_ICECREAM = 0x26 , BFONT_ICON_CACTUS = 0x27 ,
  BFONT_ICON_PIANO = 0x28 , BFONT_ICON_GUITAR = 0x29 , BFONT_ICON_EIGHTH_NOTE = 0x2A , BFONT_ICON_TREBLE_CLEF = 0x2B ,
  BFONT_ICON_BOAT = 0x2C , BFONT_ICON_CAR = 0x2D , BFONT_ICON_HELMET = 0x2E , BFONT_ICON_MOTORCYCLE = 0x2F ,
  BFONT_ICON_VAN = 0x30 , BFONT_ICON_TRUCK = 0x31 , BFONT_ICON_CLOCK = 0x32 , BFONT_ICON_TELEPHONE = 0x33 ,
  BFONT_ICON_PENCIL = 0x34 , BFONT_ICON_CUP = 0x35 , BFONT_ICON_SILVERWARE = 0x36 , BFONT_ICON_HOUSE = 0x37 ,
  BFONT_ICON_BELL = 0x38 , BFONT_ICON_CROWN = 0x39 , BFONT_ICON_SOCK = 0x3A , BFONT_ICON_CAKE = 0x3B ,
  BFONT_ICON_KEY = 0x3C , BFONT_ICON_BOOK = 0x3D , BFONT_ICON_BASEBALL = 0x3E , BFONT_ICON_SOCCER = 0x3F ,
  BFONT_ICON_BULB = 0x40 , BFONT_ICON_TEDDY_BEAR = 0x41 , BFONT_ICON_BOW_TIE = 0x42 , BFONT_ICON_BOW_ARROW = 0x43 ,
  BFONT_ICON_SNOWMAN = 0x44 , BFONT_ICON_LIGHTNING = 0x45 , BFONT_ICON_SUN = 0x46 , BFONT_ICON_CLOUD = 0x47 ,
  BFONT_ICON_UMBRELLA = 0x48 , BFONT_ICON_ONE_STAR = 0x49 , BFONT_ICON_TWO_STARS = 0x4A , BFONT_ICON_THREE_STARS = 0x4B ,
  BFONT_ICON_FOUR_STARS = 0x4C , BFONT_ICON_HEART = 0x4D , BFONT_ICON_DIAMOND = 0x4E , BFONT_ICON_SPADE = 0x4F ,
  BFONT_ICON_CLUB = 0x50 , BFONT_ICON_JACK = 0x51 , BFONT_ICON_QUEEN = 0x52 , BFONT_ICON_KING = 0x53 ,
  BFONT_ICON_JOKER = 0x54 , BFONT_ICON_ISLAND = 0x55 , BFONT_ICON_0 = 0x56 , BFONT_ICON_1 = 0x57 ,
  BFONT_ICON_2 = 0x58 , BFONT_ICON_3 = 0x59 , BFONT_ICON_4 = 0x5A , BFONT_ICON_5 = 0x5B ,
  BFONT_ICON_6 = 0x5C , BFONT_ICON_7 = 0x5D , BFONT_ICON_8 = 0x5E , BFONT_ICON_9 = 0x5F ,
  BFONT_ICON_A = 0x60 , BFONT_ICON_B = 0x61 , BFONT_ICON_C = 0x62 , BFONT_ICON_D = 0x63 ,
  BFONT_ICON_E = 0x64 , BFONT_ICON_F = 0x65 , BFONT_ICON_G = 0x66 , BFONT_ICON_H = 0x67 ,
  BFONT_ICON_I = 0x68 , BFONT_ICON_J = 0x69 , BFONT_ICON_K = 0x6A , BFONT_ICON_L = 0x6B ,
  BFONT_ICON_M = 0x6C , BFONT_ICON_N = 0x6D , BFONT_ICON_O = 0x6E , BFONT_ICON_P = 0x6F ,
  BFONT_ICON_Q = 0x70 , BFONT_ICON_R = 0x71 , BFONT_ICON_S = 0x72 , BFONT_ICON_T = 0x73 ,
  BFONT_ICON_U = 0x74 , BFONT_ICON_V = 0x75 , BFONT_ICON_W = 0x76 , BFONT_ICON_X = 0x77 ,
  BFONT_ICON_Y = 0x78 , BFONT_ICON_Z = 0x79 , BFONT_ICON_CHECKER_BOARD = 0x7A , BFONT_ICON_GRID = 0x7B ,
  BFONT_ICON_LIGHT_GRAY = 0x7C , BFONT_ICON_DIAG_GRID = 0x7D , BFONT_ICON_PACMAN_GRID = 0x7E , BFONT_ICON_DARK_GRAY = 0x7F ,
  BFONT_ICON_EMBROIDERY = 0x80
}
 Builtin VMU Icons. More...
 

Functions

void bfont_set_encoding (bfont_code_t enc)
 Set the font encoding.
 
size_t bfont_draw_ex (void *buffer, uint32_t bufwidth, uint32_t fg, uint32_t bg, uint8_t bpp, bool opaque, uint32_t c, bool wide, bool iskana)
 Draw a single character of any sort to a buffer.
 
size_t bfont_draw (void *buffer, uint32_t bufwidth, bool opaque, uint32_t c)
 Draw a single character to a buffer.
 
size_t bfont_draw_thin (void *buffer, uint32_t bufwidth, bool opaque, uint32_t c, bool iskana)
 Draw a single thin character to a buffer.
 
size_t bfont_draw_wide (void *buffer, uint32_t bufwidth, bool opaque, uint32_t c)
 Draw a single wide character to a buffer.
 
size_t bfont_draw_vmu_icon_ex (void *buffer, uint32_t bufwidth, uint32_t fg, uint32_t bg, uint8_t bpp, bool opaque, bfont_vmu_icon_t icon)
 Draw a VMU icon to the buffer.
 
size_t bfont_draw_vmu_icon (void *buffer, uint32_t bufwidth, bool opaque, bfont_vmu_icon_t icon)
 Draw a VMU icon to a buffer.
 
size_t bfont_draw_dc_icon_ex (void *buffer, uint32_t bufwidth, uint32_t fg, uint32_t bg, uint8_t bpp, bool opaque, bfont_dc_icon_t icon)
 Draw a DC icon to the buffer.
 
size_t bfont_draw_dc_icon (void *buffer, uint32_t bufwidth, bool opaque, bfont_dc_icon_t icon)
 Draw a DC icon to a buffer.
 
void bfont_draw_str_ex (void *buffer, uint32_t width, uint32_t fg, uint32_t bg, uint8_t bpp, bool opaque, const char *str)
 Draw a full string of any sort to any sort of buffer.
 
void bfont_draw_str_ex_fmt (void *buffer, uint32_t width, uint32_t fg, uint32_t bg, uint8_t bpp, bool opaque, const char *fmt,...) __printflike(7
 Draw a full formatted string of any sort to any sort of buffer.
 
void void bfont_draw_str_ex_vfmt (void *buffer, uint32_t width, uint32_t fg, uint32_t bg, uint8_t bpp, bool opaque, const char *fmt, va_list *var_args)
 Draw formatted string of any sort to buffer (with va_args).
 
void bfont_draw_str (void *buffer, uint32_t width, bool opaque, const char *str)
 Draw a full string to a buffer.
 
void bfont_draw_str_fmt (void *buffer, uint32_t width, bool opaque, const char *fmt,...) __printflike(4
 Draw a full formatted string to a buffer.
 
void void bfont_draw_str_vram_vfmt (uint32_t x, uint32_t y, uint32_t fg, uint32_t bg, bool opaque, const char *fmt, va_list *var_args)
 Draw a full formatted string to video ram (with va_args).
 
void bfont_draw_str_vram_fmt (uint32_t x, uint32_t y, bool opaque, const char *fmt,...) __printflike(4
 Draw a full string to video ram.
 
Coloring

Methods for modifying the text color.

uint32_t bfont_set_foreground_color (uint32_t c)
 Set the font foreground color.
 
uint32_t bfont_set_background_color (uint32_t c)
 Set the font background color.
 
Character Lookups

Methods for finding various font characters and icons.

const uint8_t * bfont_find_char (uint32_t ch)
 Find an ISO-8859-1 character in the font.
 
uint8_t * bfont_find_char_jp (uint32_t ch)
 Find an full-width Japanese character in the font.
 
uint8_t * bfont_find_char_jp_half (uint32_t ch)
 Find an half-width Japanese character in the font.
 
uint8_t * bfont_find_icon (bfont_vmu_icon_t icon)
 Find a VMU icon.
 
uint8_t * bfont_find_dc_icon (bfont_dc_icon_t icon)
 Find a DC icon.
 

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
Megan Potter
Kazuaki Matsumoto
Donald Haase
Falco Girgis
Todo
  • More user-friendly way to fetch/print DC-specific icons.