mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
fix(tiny_ttf): add line_height as a parameter in font glyph cache (#4662)
This commit is contained in:
parent
666f839977
commit
4a7f31017e
@ -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);
|
uint32_t stride = lv_draw_buf_width_to_stride(w, LV_COLOR_FORMAT_A8);
|
||||||
lv_cache_lock();
|
lv_cache_lock();
|
||||||
uint32_t cp = unicode_letter;
|
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) {
|
if(cache) {
|
||||||
uint8_t * buffer = (uint8_t *)lv_cache_get_data(cache);
|
uint8_t * buffer = (uint8_t *)lv_cache_get_data(cache);
|
||||||
lv_cache_unlock();
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* This smells. We add the codepoint to the base pointer to get a key. */
|
/* 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->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);
|
uint8_t * buffer = lv_draw_buf_malloc(szb, LV_COLOR_FORMAT_A8);
|
||||||
if(NULL == buffer) {
|
if(NULL == buffer) {
|
||||||
LV_LOG_ERROR("tiny_ttf: out of memory\n");
|
LV_LOG_ERROR("tiny_ttf: out of memory\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user