blob: 600220e25f8d8e6aae0377564f3e03d1bbf441b2 (
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
|
#include "text.h"
#include "utils.h"
enum font_context_error_e wayc_font_context_init(struct font_context_s* ctx) {
wayc_notnull(ctx);
FT_Error err = FT_Init_FreeType(&ctx->library);
if (err) return FONT_CONTEXT_ERROR_LIBRARY;
return FONT_CONTEXT_ERROR_NONE;
}
void wayc_font_context_deinit(struct font_context_s* ctx) {
wayc_notnull(ctx);
FT_Done_FreeType(ctx->library);
}
enum font_error_e wayc_font_init(struct font_s* font,
struct font_context_s* ctx, const char* path) {
wayc_notnull(font);
wayc_notnull(ctx);
wayc_notnull(path);
FT_Error err = FT_New_Face(ctx->library, path, 0, &font->face);
if (err) return FONT_ERROR_LOAD;
return FONT_ERROR_NONE;
}
void wayc_font_deinit(struct font_s* font) {
wayc_notnull(font);
FT_Done_Face(font->face);
}
|