main uint/cterm / include / font.h
 1#ifndef FONT_H
 2#define FONT_H
 3
 4#include <stdbool.h>
 5#include <stdint.h>
 6
 7#define BDF_GLYPHS_MAX (65536)
 8
 9typedef struct {
10	bool     valid;
11	uint8_t* bmp;
12	int      adv; /* advance */
13	int      w;
14	int      h;
15	int      xoff;
16	int      yoff;
17} BdfFont;
18typedef BdfFont BdfGlyph;
19
20typedef struct {
21	BdfFont* bdf;
22
23	double asc;   /* ascent */
24	double dsc;   /* descent */
25	int    cellw;
26	int    cellh;
27} Fontface;
28
29/* load font from path into `f` */
30int font_load(Fontface* f, const char* path);
31
32/* free font `f` */
33void font_free(Fontface* f);
34
35#endif /* FONT_H */
36