1#ifndef MAUS_FONT_H
2#define MAUS_FONT_H
3
4#include "uletypes.h"
5
6#include "maus.h"
7
8#define MAUS_BDF_GLYPHS_MAX 256
9
10typedef struct {
11 ule_u8* bmp;
12 ule_u16 w;
13 ule_u16 h;
14 ule_i16 xoff;
15 ule_i16 yoff;
16 ule_u16 adv;
17 ule_i8 valid;
18} MausGlyph;
19
20typedef struct {
21 MausGlyph glyphs[MAUS_BDF_GLYPHS_MAX];
22
23 ule_i32 asc;
24 ule_i32 dsc;
25 ule_i32 cellh;
26 ule_i32 cellw;
27} MausFont;
28
29/* Loops through text passing parameters to glyph drawer */
30void maus_draw_text(Maus* mw, MausFont* font, ule_i32 x, ule_i32 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