GBDK 2020 Docs 4.4.0 API Documentation for GBDK 2020

Data Structures | Macros | Typedefs | Functions | Variables
font.h File Reference
`#include <types.h>`
`#include <stdint.h>`

Go to the source code of this file.

## Data Structures
struct | sfont_handle

## Macros
#define | FONT_256ENCODING 0
#define | FONT_128ENCODING 1
#define | FONT_NOENCODING 2
#define | FONT_COMPRESSED 4

## Typedefs
typedef uint16_t | font_t
typedef struct sfont_handle | mfont_handle
typedef struct sfont_handle * | pmfont_handle

## Functions
void | font_init (void)
font_t | font_load (void *font) OLDCALL
font_t | font_set (font_t font_handle) OLDCALL
void | font_color (uint8_t forecolor, uint8_t backcolor) OLDCALL

## Variables
uint8_t | font_spect []
uint8_t | font_italic []
uint8_t | font_ibm []
uint8_t | font_min []
uint8_t | font_ibm_fixed []

## Detailed Description

Multiple font support for the GameBoy Michael Hope, 1999 micha.nosp@m.elh@.nosp@m.earth.nosp@m.ling.nosp@m..net

## Macro Definition Documentation

## ◆ FONT_256ENCODING

#define FONT_256ENCODING 0

Various flags in the font header.

## ◆ FONT_128ENCODING

#define FONT_128ENCODING 1

## ◆ FONT_NOENCODING

#define FONT_NOENCODING 2

## ◆ FONT_COMPRESSED

#define FONT_COMPRESSED 4

## Typedef Documentation

## ◆ font_t

typedef uint16_t font_t

font_t is a handle to a font loaded by font_load(). It can be used with font_set()

## ◆ mfont_handle

typedef struct sfont_handle mfont_handle

Internal representation of a font. What a font_t really is

## ◆ pmfont_handle

typedef struct sfont_handle* pmfont_handle

## Function Documentation

## ◆ font_init()

void font_init | ( | void |  | ) |

Initializes the font system. Should be called before other font functions.

## ◆ font_load()

font_t font_load | ( | void * | font | ) |

Load a font and set it as the current font.

Parameters

  font | Pointer to a font to load (usually a gbdk font)

Returns
  Handle to the loaded font, which can be used with font_set()

See also
  font_init(), font_set(), List of gbdk fonts

## ◆ font_set()

font_t font_set | ( | font_t | font_handle | ) |

Set the current font.

Parameters

  font_handle | handle of a font returned by font_load()

Returns
  The previously used font handle.

See also
  font_init(), font_load()

## ◆ font_color()

void font_color | ( | uint8_t | forecolor,
|  | uint8_t | backcolor
| ) |  |

Set the current foreground colour (for pixels), background colour