smeargle-gd/src/font.h

32 lines
700 B
C
Raw Permalink Normal View History

2023-11-28 00:39:00 +00:00
#ifndef _SMEARGLE_FONT_H
#define _SMEARGLE_FONT_H
2023-11-27 21:38:00 +00:00
2023-11-30 05:01:38 +00:00
#include "node.h"
2023-11-27 21:38:00 +00:00
typedef struct map_t {
2023-11-27 23:33:40 +00:00
const char *glyph;
unsigned int index;
2023-11-27 21:38:00 +00:00
unsigned int width;
struct map_t *next;
} map_t;
typedef struct {
2023-11-30 05:01:38 +00:00
const char *name;
const char *image_filename;
2023-11-27 21:38:00 +00:00
unsigned char bits_per_pixel;
unsigned int width;
unsigned int height;
unsigned int map_entries;
map_t *map;
} font_t;
2023-11-27 23:21:09 +00:00
2023-11-28 08:25:03 +00:00
extern void *fontdb;
2023-11-30 05:01:38 +00:00
node_t *load_fonts(toml_table_t *table, const char *base_path);
font_t *font_find(node_t *root, const char *key);
2023-11-28 08:25:03 +00:00
font_t font_create(const char *name, const char *filename);
2023-11-27 23:21:09 +00:00
void font_destroy(font_t font);
unsigned int map_create(toml_table_t *table, map_t **map);
void map_destroy(map_t *map);
2023-11-28 00:39:00 +00:00
#endif