Kohi Game Engine
font_system.h File Reference

A system responsible for the management of bitmap and system fonts. More...

Go to the source code of this file.

Data Structures

struct  system_font_config
 The configuration for a system font. More...
 
struct  bitmap_font_config
 The configuration for a bitmap font. More...
 
struct  font_system_config
 The configuration of the font system. Should be setup by the application during the boot process. More...
 

Typedefs

typedef struct system_font_config system_font_config
 The configuration for a system font. More...
 
typedef struct bitmap_font_config bitmap_font_config
 The configuration for a bitmap font. More...
 
typedef struct font_system_config font_system_config
 The configuration of the font system. Should be setup by the application during the boot process. More...
 

Functions

b8 font_system_initialize (u64 *memory_requirement, void *memory, void *config)
 Initializes the font system. As with other systems, this should be called twice; once to get the memory requirement (where memory = 0), and a second time passing allocated memory. More...
 
void font_system_shutdown (void *memory)
 Shuts down the font system. More...
 
b8 font_system_system_font_load (system_font_config *config)
 Loads a system font from the following config. More...
 
b8 font_system_bitmap_font_load (bitmap_font_config *config)
 Loads a bitmap font from the following config. More...
 
b8 font_system_acquire (const char *font_name, u16 font_size, struct ui_text *text)
 Attempts to acquire a font of the given name and assign it to the given ui_text. More...
 
b8 font_system_release (struct ui_text *text)
 Releases references to the font held by the provided ui_text. More...
 
b8 font_system_verify_atlas (font_data *font, const char *text)
 Verifies the atlas of the provided font contains the characters in text. More...
 

Detailed Description

A system responsible for the management of bitmap and system fonts.

Author
Travis Vroman (travi.nosp@m.s@ko.nosp@m.hieng.nosp@m.ine..nosp@m.com)
Version
1.0
Date
2023-01-18

Typedef Documentation

◆ bitmap_font_config

The configuration for a bitmap font.

◆ font_system_config

The configuration of the font system. Should be setup by the application during the boot process.

◆ system_font_config

The configuration for a system font.

Function Documentation

◆ font_system_acquire()

b8 font_system_acquire ( const char *  font_name,
u16  font_size,
struct ui_text text 
)

Attempts to acquire a font of the given name and assign it to the given ui_text.

Parameters
font_nameThe name of the font to acquire. Must be an already loaded font.
font_sizeThe font size. Ignored for bitmap fonts.
textA pointer to the text object for which to acquire the font.
Returns
True on success; otherwise false.

◆ font_system_bitmap_font_load()

b8 font_system_bitmap_font_load ( bitmap_font_config config)

Loads a bitmap font from the following config.

Parameters
configA pointer to the config to use for loading.
Returns
True on success; otherwise false.

◆ font_system_initialize()

b8 font_system_initialize ( u64 memory_requirement,
void *  memory,
void *  config 
)

Initializes the font system. As with other systems, this should be called twice; once to get the memory requirement (where memory = 0), and a second time passing allocated memory.

Parameters
memory_requirementA pointer to hold the memory requirement.
memoryThe allocated memory for the system state.
configThe font system config.
Returns
True on success; otherwise false.

◆ font_system_release()

b8 font_system_release ( struct ui_text text)

Releases references to the font held by the provided ui_text.

Parameters
textA pointer to the text object to release the font from.
Returns
True on success; otherwise false.

◆ font_system_shutdown()

void font_system_shutdown ( void *  memory)

Shuts down the font system.

Parameters
memoryThe system state memory.

◆ font_system_system_font_load()

b8 font_system_system_font_load ( system_font_config config)

Loads a system font from the following config.

Parameters
configA pointer to the config to use for loading.
Returns
True on success; otherwise false.

◆ font_system_verify_atlas()

b8 font_system_verify_atlas ( font_data font,
const char *  text 
)

Verifies the atlas of the provided font contains the characters in text.

Parameters
fontA pointer to the font to be verified.
textThe text containing the characters required.
Returns
True on success; otherwise false.