From 67893dc14d10f49a76652ff384ab2bf4a945ca30 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Sat, 22 Apr 2023 13:29:56 +0200 Subject: add glyph caching --- drw.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drw.h') diff --git a/drw.h b/drw.h index 4a0a25c..0885fe2 100644 --- a/drw.h +++ b/drw.h @@ -6,9 +6,12 @@ #include FT_FREETYPE_H #include FT_BITMAP_H #include FT_STROKER_H +#include FT_CACHE_H #include "wayland.h" +#define CACHE_SIZE 4096 + /* type definitions */ typedef struct { uint32_t *data; @@ -30,6 +33,7 @@ typedef struct { FT_Library library; FT_Face face; FT_Stroker stroke; + FT_BitmapGlyph cache[CACHE_SIZE]; } Font; enum FontType { @@ -78,6 +82,6 @@ void draw_point(Canvas *canvas, unsigned x, unsigned y, uint32_t color); FontCache *create_font_cache(FontPath *fontpath, int size, unsigned fontsize); void font_cache_generate_box(FontCache *fontcache); void free_font_cache(FontCache *fontcache); -unsigned draw_char(Canvas *canvas, FontCache *fontcache, uint_least32_t charcode, unsigned x, unsigned y, uint32_t color); +void draw_char(Canvas *canvas, FontCache *fontcache, uint_least32_t charcode, unsigned x, unsigned y, uint32_t color); #endif -- cgit v1.2.3-70-g09d2