diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-11 11:33:40 +0100 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-11 11:33:40 +0100 |
| commit | 3b2636cbc666159f0962f7b6024d6a85743d6594 (patch) | |
| tree | 19a8dcb848ce0596f7257ec00a54b6b1aad963a5 /src/text.cc | |
| parent | 16dc21cd1a820b49901df69ab3f21da1ddc69476 (diff) | |
loading font
Diffstat (limited to 'src/text.cc')
| -rw-r--r-- | src/text.cc | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/text.cc b/src/text.cc index cf5345d..600220e 100644 --- a/src/text.cc +++ b/src/text.cc @@ -1,11 +1,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); -}
\ No newline at end of file +} + +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); +} |
