diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-13 07:09:38 +0100 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-13 07:09:38 +0100 |
| commit | e40037fd7a922132015340a758468cb5dec71096 (patch) | |
| tree | 5f57004ffc0bed7c0d1b2e3ae5a45df104d9eabd /src/text.h | |
| parent | 2600ac4737d0098d650b792a30ccc557f6d76d16 (diff) | |
rasterizing and caching
Diffstat (limited to 'src/text.h')
| -rw-r--r-- | src/text.h | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -33,15 +33,27 @@ enum font_context_error_e wayc_font_context_init( void wayc_font_context_deinit(struct font_context_s* context); struct glyph_s { + vec2 uv0, uv1; vec2 bearing; - vec2 size; - vec2 uv; + f32 advance; }; +static inline void glyph_print(struct glyph_s* glyph) { + u32 uv0x = WAYC_X(glyph->uv0); + u32 uv0y = WAYC_Y(glyph->uv0); + u32 uv1x = WAYC_X(glyph->uv1); + u32 uv1y = WAYC_Y(glyph->uv1); + fprintf(stderr, + "uv0: (%u, %u), uv1: (%u, %u), bearing: (%f, %f), advance: %f\n", + uv0x, uv0y, uv1x, uv1y, WAYC_X(glyph->bearing), + WAYC_Y(glyph->bearing), glyph->advance); +} + enum font_error_e : u8 { FONT_ERROR_NONE = 0, FONT_ERROR_LOAD_FACE, FONT_ERROR_ATLAS_FAILED, + FONT_ERROR_LOAD_GLYPH, }; struct font_s { @@ -58,4 +70,9 @@ enum font_error_e wayc_font_init(struct font_s* font, u32 atlas_width, u32 atlas_height); enum font_error_e wayc_font_render(struct font_s* font, codepoint_t codepoint, struct glyph_s* glyph); +static inline enum font_error_e wayc_font_flush(struct font_s* font) { + enum atlas_error_e atlas_err = wayc_atlas_flush(&font->atlas); + return atlas_err == ATLAS_ERROR_NONE ? FONT_ERROR_NONE + : FONT_ERROR_ATLAS_FAILED; +} void wayc_font_deinit(struct font_s* font); |
