105 lines
2.6 KiB
C
105 lines
2.6 KiB
C
#if FONT_TEST
|
|
|
|
#ifndef FONT_H
|
|
#define FONT_H
|
|
|
|
#include "texture.h"
|
|
#include "util.h"
|
|
|
|
|
|
struct asset;
|
|
struct work_startup_receipt;
|
|
struct renderer_startup_receipt;
|
|
struct asset_cache_startup_receipt;
|
|
struct ttf_startup_receipt;
|
|
struct resource_startup_receipt;
|
|
|
|
struct font_glyph_list {
|
|
struct font_glyph *first;
|
|
struct font_glyph *last;
|
|
};
|
|
|
|
struct font_glyph {
|
|
f32 off_x;
|
|
f32 off_y;
|
|
i32 advance;
|
|
f32 width;
|
|
f32 height;
|
|
struct rect atlas_rect;
|
|
|
|
struct font_glyph *next;
|
|
};
|
|
|
|
struct font {
|
|
f32 point_size;
|
|
struct texture texture;
|
|
u16 glyphs_count;
|
|
struct font_glyph *glyphs;
|
|
u16 *lookup;
|
|
};
|
|
|
|
struct font_startup_receipt { i32 _; };
|
|
struct font_startup_receipt font_startup(struct work_startup_receipt *work_sr,
|
|
struct renderer_startup_receipt *renderer_sr,
|
|
struct asset_cache_startup_receipt *asset_cache_sr,
|
|
struct ttf_startup_receipt *ttf_sr,
|
|
struct resource_startup_receipt *resource_sr);
|
|
|
|
struct asset *font_load_asset(struct string path, f32 point_size, b32 help);
|
|
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
|
|
|
|
#else
|
|
|
|
#ifndef FONT_H
|
|
#define FONT_H
|
|
|
|
#include "texture.h"
|
|
#include "util.h"
|
|
|
|
|
|
struct asset;
|
|
struct work_startup_receipt;
|
|
struct renderer_startup_receipt;
|
|
struct asset_cache_startup_receipt;
|
|
struct ttf_startup_receipt;
|
|
struct resource_startup_receipt;
|
|
|
|
struct font_glyph {
|
|
f32 off_x;
|
|
f32 off_y;
|
|
i32 advance;
|
|
f32 width;
|
|
f32 height;
|
|
struct rect atlas_rect;
|
|
};
|
|
|
|
struct font {
|
|
f32 point_size;
|
|
struct texture texture;
|
|
u16 glyphs_count;
|
|
struct font_glyph *glyphs;
|
|
u16 *lookup;
|
|
};
|
|
|
|
struct font_startup_receipt { i32 _; };
|
|
struct font_startup_receipt font_startup(struct work_startup_receipt *work_sr,
|
|
struct renderer_startup_receipt *renderer_sr,
|
|
struct asset_cache_startup_receipt *asset_cache_sr,
|
|
struct ttf_startup_receipt *ttf_sr,
|
|
struct resource_startup_receipt *resource_sr);
|
|
|
|
struct asset *font_load_asset(struct string path, f32 point_size, b32 help);
|
|
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
|
|
|
|
#endif
|