Home

Struct lib2d_font

A font that can be used to render UTF-8 text using lib2d_text().

Examples

lib2d_font font;
lib2d_font_load("FreeSans.ttf", &font);
lib2d_text(font, 80, "Hello Lib2D!", 200, 300, 0x000000ff);

Methods

int lib2d_font_load(const char* path, lib2d_font* font)

Load a true tpye font from the filesystem. Returns 0 on success.

Examples

lib2d_font font;
if (lib2d_font_load("FreeSans.ttf", &font) != 0) {
    fprintf(stderr, "%s\n", lib2d_get_error());
}

void lib2d_font_delete(lib2d_font font)

Frees all resources allocated by and for a lib2d_font.

void lib2d_text(const lib2d_font font, float font_size, const char* text, int x, int y, uint32_t color)

Schedules UTF-8 text to be rendered to the screen when lib2d_render() is called.