//------------------------------------------------------------------------------ // fontstash-sapp/module.jai // // Text rendering via fontstash, stb_truetype and sokol_fontstash.h //------------------------------------------------------------------------------ #import "Basic"; #import "File"; #import,dir "../../sokol/log"(USE_GL=USE_GL); #import,dir "../../sokol/gfx"(USE_GL=USE_GL); #import,dir "../../sokol/app"(USE_GL=USE_GL); #import,dir "../../sokol/glue"(USE_GL=USE_GL); #import,dir "../../sokol/gl"(USE_GL=USE_GL); #import,dir "../../sokol/fontstash"(USE_GL=USE_GL); state: struct { fons: *FONScontext; dpi_scale: float; font_normal: s32; font_italic: s32; font_bold: s32; font_japanese: s32; font_normal_data: [256 * 1024]u8; font_italic_data: [256 * 1024]u8; font_bold_data: [256 * 1024]u8; font_japanese_data: [2 * 1024 * 1024]u8; } // round to next power of 2 (see bit-twiddling-hacks) round_pow2 :: (v: float) -> s32 { vi := (cast(u32) v) - 1; for i : 0..4 { vi |= (vi >> (1<