townengine/src/rendering/twn_text_c.h

37 lines
625 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)
#define TEXT_FONT_TEXTURE_SIZE_DEFAULT 2048
#define TEXT_FONT_OVERSAMPLING_DEFAULT 4
#define TEXT_FONT_FILTERING_DEFAULT TEXTURE_FILTER_LINEAR
typedef struct FontData {
stbtt_packedchar char_data[NUM_DISPLAY_ASCII];
stbtt_fontinfo info;
const char *file_path;
GPUTexture texture;
int height_px;
float scale_factor;
int ascent;
int descent;
int line_gap;
} FontData;
#endif