power_play/src/font.h

40 lines
936 B
C

#ifndef FONT_H
#define FONT_H
#include "util.h"
struct asset;
struct asset_cache_startup_receipt;
struct ttf_startup_receipt;
struct font_glyph {
f32 off_x;
f32 off_y;
i32 advance;
f32 width;
f32 height;
struct rect atlas_rect;
};
struct font {
struct gp_resource *texture;
u32 image_width;
u32 image_height;
f32 point_size;
u16 glyphs_count;
struct font_glyph *glyphs;
u16 *lookup;
};
struct font_startup_receipt { i32 _; };
struct font_startup_receipt font_startup(struct asset_cache_startup_receipt *asset_cache_sr,
struct ttf_startup_receipt *ttf_sr);
struct asset *font_load_asset(struct string path, f32 point_size, b32 wait);
struct font *font_load_async(struct string path, f32 point_size);
struct font *font_load(struct string path, f32 point_size);
struct font_glyph *font_get_glyph(struct font *font, u32 codepoint);
#endif