blob: e1a8b3d3e1b9e54a567601a4c1c0353f04d4c215 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#pragma once
#include "atlas.h"
#include "cglm/types.h"
#include "freetype/freetype.h"
#include "sokol_gfx.h"
#include "utils.h"
struct text_vertex_s {
vec2 pos;
vec2 uv;
};
enum font_context_error_e : u8 {
FONT_CONTEXT_ERROR_NONE = 0,
FONT_CONTEXT_ERROR_LOAD_LIBRARY,
FONT_CONTEXT_ERROR_CREATE_SAMPLER,
FONT_CONTEXT_ERROR_CREATE_SHADER,
FONT_CONTEXT_ERROR_CREATE_PIPELINE,
};
struct font_context_s {
FT_Library ft;
struct sg_pipeline pipeline;
struct sg_sampler sampler;
};
enum font_context_error_e wayc_font_context_init(
struct font_context_s* context);
void wayc_font_context_deinit(struct font_context_s* context);
enum font_error_e : u8 {
FONT_ERROR_NONE = 0,
FONT_ERROR_LOAD_FACE,
};
struct font_s {
FT_Face face;
u32 font_size;
u8* source;
struct atlas_s atlas;
};
enum font_error_e wayc_font_init(struct font_s* font,
struct font_context_s* context,
const char* path, u32 font_size);
|