mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-11 02:28:18 +00:00
41 lines
1 KiB
C
41 lines
1 KiB
C
|
/* 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
|
||
|
{
|
||
|
int texture;
|
||
|
int size;
|
||
|
CHARACTER characters[256];
|
||
|
float kerning[256*256];
|
||
|
} FONT;
|
||
|
|
||
|
typedef struct
|
||
|
{
|
||
|
int font_count;
|
||
|
FONT fonts[8];
|
||
|
} FONT_SET;
|
||
|
|
||
|
int font_load(FONT *font, const char *filename);
|
||
|
int font_set_load(FONT_SET *font_set, const char *font_filename, const char *texture_filename, int fonts, ...);
|
||
|
float font_string_width(FONT_SET *font_set, const char *string, float size);
|
||
|
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
|