1 struct tui_pixelfont;
2 
3 /*
4  * Load / initialize built-in pixel fonts,
5  * with the number of font-slots that can be appended.
6  */
7 struct tui_pixelfont* tui_pixelfont_open(size_t limit);
8 
9 /*
10  * Free the pixelfont container
11  */
12 void tui_pixelfont_close(struct tui_pixelfont* ctx);
13 
14 /*
15  * Query if there is a matching symbol for the specified code-point
16  * or not in the currently used font-set/font-context
17  */
18 bool tui_pixelfont_hascp(struct tui_pixelfont* ctx, uint32_t cp);
19 
20 /*
21  * Switch the active font-size to the desired 'px', will align to whichever
22  * loadded font is the closest. The final cell dimensions will be returned
23  * in [w, h].
24  */
25 void tui_pixelfont_setsz(
26 	struct tui_pixelfont* ctx, size_t px, size_t* w, size_t* h);
27 
28 /*
29  * Load/Extend the font-set with a font (PSF2 supported) in [buf, buf_sz]
30  * for the pixel-size slot marked as [px_sz]. Set merge if it should
31  * extend the slot with new glyphs, otherwise existing ones will be released.
32  */
33 bool tui_pixelfont_load(struct tui_pixelfont* ctx,
34 	uint8_t* buf, size_t buf_sz, size_t px_sz, bool merge);
35 
36 /*
37  * Return true if the buffer contains a valid font or not
38  */
39 bool tui_pixelfont_valid(uint8_t* buf, size_t buf_sz);
40 
41 void tui_pixelfont_draw(
42 	struct tui_pixelfont* ctx, shmif_pixel* c, size_t vidp,
43 	uint32_t cp, int x, int y, shmif_pixel fg, shmif_pixel bg,
44 	int maxx, int maxy, bool bgign);
45