From 4a7f31017e0f891e43cd3ecf2d543a54aa51f8f8 Mon Sep 17 00:00:00 2001 From: sirius506 Date: Tue, 17 Oct 2023 19:08:59 +0900 Subject: [PATCH] fix(tiny_ttf): add line_height as a parameter in font glyph cache (#4662) --- src/libs/tiny_ttf/lv_tiny_ttf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libs/tiny_ttf/lv_tiny_ttf.c b/src/libs/tiny_ttf/lv_tiny_ttf.c index baa20a443..4229135ab 100644 --- a/src/libs/tiny_ttf/lv_tiny_ttf.c +++ b/src/libs/tiny_ttf/lv_tiny_ttf.c @@ -141,7 +141,7 @@ static const uint8_t * ttf_get_glyph_bitmap_cb(const lv_font_t * font, uint32_t uint32_t stride = lv_draw_buf_width_to_stride(w, LV_COLOR_FORMAT_A8); lv_cache_lock(); uint32_t cp = unicode_letter; - lv_cache_entry_t * cache = lv_cache_find(font + cp, LV_CACHE_SRC_TYPE_PTR, 0, 0); + lv_cache_entry_t * cache = lv_cache_find(font, LV_CACHE_SRC_TYPE_PTR, font->line_height, cp); if(cache) { uint8_t * buffer = (uint8_t *)lv_cache_get_data(cache); lv_cache_unlock(); @@ -155,8 +155,10 @@ static const uint8_t * ttf_get_glyph_bitmap_cb(const lv_font_t * font, uint32_t return NULL; } /* This smells. We add the codepoint to the base pointer to get a key. */ - entry->src = font + cp; + entry->src = font; entry->src_type = LV_CACHE_SRC_TYPE_PTR; + entry->param1 = font->line_height; + entry->param2 = cp; uint8_t * buffer = lv_draw_buf_malloc(szb, LV_COLOR_FORMAT_A8); if(NULL == buffer) { LV_LOG_ERROR("tiny_ttf: out of memory\n");