35 lines
539 B
C
35 lines
539 B
C
#ifndef TWN_TEXT_C_H
|
|
#define TWN_TEXT_C_H
|
|
|
|
|
|
#include "twn_gpu_texture_c.h"
|
|
|
|
|
|
#include <stb_truetype.h>
|
|
|
|
|
|
#define ASCII_START 32
|
|
#define ASCII_END 128
|
|
#define NUM_DISPLAY_ASCII ((ASCII_END - ASCII_START) + 1)
|
|
|
|
|
|
typedef struct FontData {
|
|
stbtt_packedchar char_data[NUM_DISPLAY_ASCII];
|
|
stbtt_fontinfo info;
|
|
|
|
const char *file_path;
|
|
unsigned char *file_bytes;
|
|
size_t file_bytes_len;
|
|
|
|
GPUTexture texture;
|
|
|
|
int height_px;
|
|
float scale_factor;
|
|
int ascent;
|
|
int descent;
|
|
int line_gap;
|
|
} FontData;
|
|
|
|
|
|
#endif
|