/** * Copyright (c) 2021 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include "../../libs.h" #include "../texture.h" /** Which character (ASCII) to start the font from */ #define FONT_FIRST_CHAR 32 /** How many characters (after the first char) to generate */ #define FONT_NUM_CHARS 96 /** Passed to STBTT for scaling the font nicely */ #define FONT_TEXTURE_SIZE 64 /** Width of the loaded font texture */ #define FONT_TEXTURE_WIDTH 512 /** Height of the loaded font texture */ #define FONT_TEXTURE_HEIGHT FONT_TEXTURE_WIDTH /** Refer to STBTT docs for OpenGL Fill Mode v d3d Fill Modes */ #define FONT_FILL_MODE 1 #define FONT_NEWLINE '\n' #define FONT_SPACE ' ' #define FONT_LINE_HEIGHT FONT_TEXTURE_SIZE*0.75 #define FONT_INITIAL_LINE FONT_LINE_HEIGHT*0.75 #define FONT_SPACE_SIZE FONT_TEXTURE_SIZE*0.75 #define FONT_SCALE_ADJUST 0.03 typedef struct { texture_t texture; stbtt_bakedchar characterData[FONT_NUM_CHARS]; } font_t; typedef struct { int32_t length; int32_t realLength; float width, height, scale; stbtt_aligned_quad *quads; } fonttextinfo_t;