
typedef struct Symbol  Symbol;
struct Symbol
{
	char *        name;      /* original name in spoiler, e.g. "W/U" or "Snow" */
	char *        filename;  /* no suffix or /, e.g. name "W/U" would use "WU" */
	unsigned char code[8];   /* UTF-8 encoded codename string for the symbol. */
	int           imgwidth;  /* only loaded when first trying to measure it */
	int           imgheight; /* only loaded when first trying to measure it */
	Image *       img;       /* only loaded when first trying to draw it */
};

Symbol * name_to_symbol(const char *name, int namelen);
Symbol * code_to_symbol(const unsigned char *code, int codelen);
void     reset_symbols();

char * convert_symbols(char *s);
char * convert_symbols_and_font(char *s, char *fnt, int symbol_font);

Rect load_symbol_image_dimensions(App *app, Symbol *sym);
int symbol_glyph_width(Font *fallback, Symbol *sym, const char *code, int codelen);
int symbol_font_width(Font *fallback, const char *codes, int codelens);
Rect symbol_glyph_rect(Font *fallback, Symbol *sym, const char *code, int codelen);
Image * load_symbol_image(App *app, Symbol *sym);
int symbol_draw_glyph(Graphics *g, Point p, const char *code, int codelen);
int symbol_draw_utf8(Graphics *g, Point p, const char *codes, int codelens);

