| 1 | #ifndef FONT_H |
| 2 | #define FONT_H |
| 3 |
|
| 4 | #include <stdint.h> |
| 5 |
|
| 6 | enum { FONT_REGULAR, FONT_MEDIUM, FONT_BOLD, FONT_COUNT }; |
| 7 |
|
| 8 | int font_init(void); // 0 if the bundled fonts are missing |
| 9 | // draws UTF-8 text with its top at y; cut with "…" past maxw (0: no limit). Returns the width. |
| 10 | int font_draw(int font, int px, int x, int y, const char *s, uint32_t argb, int maxw); |
| 11 | int font_width(int font, int px, const char *s); |
| 12 | int font_line_height(int font, int px); |
| 13 | // draws text centred on cx |
| 14 | int font_draw_center(int font, int px, int cx, int y, const char *s, uint32_t argb, int maxw); |
| 15 | void font_draw_glyph_centered(int font, int px, int cx, int cy, const char *ch, uint32_t argb); |
| 16 | int font_draw_right(int font, int px, int rx, int y, const char *s, uint32_t argb); |
| 17 | void font_flush(void); // forget the cached glyphs |
| 18 |
|
| 19 | #endif |