summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/text.cc14
1 files changed, 14 insertions, 0 deletions
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 <utils.h>
#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);
}