diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-04-22 13:29:56 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-04-22 13:29:56 +0200 |
| commit | 67893dc14d10f49a76652ff384ab2bf4a945ca30 (patch) | |
| tree | c0612519116b0cfad0c1a1ae9df9beb92a9908e0 /drw.h | |
| parent | dc8f8644293b17f056edefa9e0e4a786686816a1 (diff) | |
add glyph caching
Diffstat (limited to 'drw.h')
| -rw-r--r-- | drw.h | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 |