2007-12-24 13:09:34 +00:00
|
|
|
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
|
|
|
|
#ifndef _FONT_H
|
|
|
|
#define _FONT_H
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
float tex_x0;
|
|
|
|
float tex_y0;
|
|
|
|
float tex_x1;
|
|
|
|
float tex_y1;
|
|
|
|
float width;
|
|
|
|
float height;
|
|
|
|
float x_offset;
|
|
|
|
float y_offset;
|
|
|
|
float x_advance;
|
|
|
|
}
|
|
|
|
CHARACTER;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2007-12-25 03:25:13 +00:00
|
|
|
int text_texture;
|
|
|
|
int outline_texture;
|
2007-12-24 13:09:34 +00:00
|
|
|
int size;
|
|
|
|
CHARACTER characters[256];
|
2007-12-25 03:25:13 +00:00
|
|
|
char kerning[256*256];
|
2007-12-24 13:09:34 +00:00
|
|
|
} FONT;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int font_count;
|
2008-01-11 16:48:34 +00:00
|
|
|
FONT fonts[14];
|
2007-12-24 13:09:34 +00:00
|
|
|
} FONT_SET;
|
|
|
|
|
|
|
|
int font_load(FONT *font, const char *filename);
|
2007-12-25 03:25:13 +00:00
|
|
|
int font_set_load(FONT_SET *font_set, const char *font_filename, const char *text_texture_filename, const char *outline_texture_filename, int fonts, ...);
|
|
|
|
float font_text_width(FONT *font, const char *text, float size, int width);
|
2007-12-24 13:09:34 +00:00
|
|
|
void font_character_info(FONT *font, unsigned char c, float *tex_x0, float *tex_y0, float *tex_x1, float *tex_y1, float *width, float *height, float *x_offset, float *y_offset, float *x_advance);
|
|
|
|
float font_kerning(FONT *font, unsigned char c1, unsigned char c2);
|
|
|
|
FONT *font_set_pick(FONT_SET *font_set, float size);
|
|
|
|
|
|
|
|
#endif
|