From a1dee625dae4c3e39eb6ef16b91be9a374f7874f Mon Sep 17 00:00:00 2001 From: Fabrice Date: Wed, 11 Feb 2026 16:27:57 +0100 Subject: initiating font cache --- src/text.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/text.cc b/src/text.cc index a5e3331..a19fe98 100644 --- a/src/text.cc +++ b/src/text.cc @@ -6,8 +6,19 @@ #include #include "freetype/fttypes.h" +#include "hash.h" #include "utils.h" +static void wayc_font_cache_init(struct font_cache_s* cache) { + wayc_notnull(cache); + wayc_hashmap_init(&cache->glyphs); +} + +static void wayc_font_cache_deinit(struct font_cache_s* cache) { + wayc_notnull(cache); + wayc_hashmap_deinit(&cache->glyphs); +} + enum font_context_error_e wayc_font_context_init(struct font_context_s* ctx) { wayc_notnull(ctx); @@ -48,6 +59,7 @@ enum font_error_e wayc_font_init(struct font_s* font, if (err) return FONT_ERROR_FONT_LOAD; font->data = data; + wayc_font_cache_init(&font->cache); success = true; return FONT_ERROR_NONE; @@ -55,6 +67,8 @@ enum font_error_e wayc_font_init(struct font_s* font, void wayc_font_deinit(struct font_s* font) { wayc_notnull(font); + + wayc_font_cache_deinit(&font->cache); FT_Done_Face(font->face); mi_free(font->data); } -- cgit v1.2.3