master uint/maus / include / maus_font.h
 1#ifndef MAUS_FONT_H
 2#define MAUS_FONT_H
 3
 4#include <stdint.h>
 5
 6#include "maus.h"
 7
 8#define MAUS_BDF_GLYPHS_MAX 256
 9
10typedef struct {
11	uint8_t* bmp;
12	uint16_t w;
13	uint16_t h;
14	int16_t  xoff;
15	int16_t  yoff;
16	uint16_t adv;
17	int8_t   valid;
18} MausGlyph;
19
20typedef struct {
21	MausGlyph glyphs[MAUS_BDF_GLYPHS_MAX];
22
23	int32_t asc;
24	int32_t dsc;
25	int32_t cellh;
26	int32_t cellw;
27} MausFont;
28
29/* Loops through text passing parameters to glyph drawer */
30void maus_draw_text(Maus* mw, MausFont* font, int32_t x, int32_t y,
31                    const char* text, MausColor col);
32
33/* load a bdf font into MausFont. returns NULL on fail */
34MausFont* maus_font_load(const char* path);
35
36/* release all allocations made with a MausFont */
37void maus_font_free(MausFont* font);
38
39#endif /* MAUS_FONT_H */
40