fix(freetype): fix return value and add more check (#5218)

This commit is contained in:
Benign X
2024-01-08 17:26:44 +08:00
committed by GitHub
parent c6aeadf5c5
commit 2644d9c060
2 changed files with 7 additions and 2 deletions
+2 -2
View File
@@ -371,7 +371,7 @@ static bool cache_node_cache_create_cb(lv_freetype_cache_node_t * node, void * u
FT_Error error = FT_New_Face(ctx->library, node->pathname, 0, &face);
if(error) {
FT_ERROR_MSG("FT_New_Face", error);
return NULL;
return false;
}
node->ref_size = LV_FREETYPE_OUTLINE_REF_SIZE_DEF;
@@ -381,7 +381,7 @@ static bool cache_node_cache_create_cb(lv_freetype_cache_node_t * node, void * u
if(error) {
FT_Done_Face(face);
FT_ERROR_MSG("FT_Set_Char_Size", error);
return NULL;
return false;
}
if(node->style & LV_FREETYPE_FONT_STYLE_ITALIC) {
+5
View File
@@ -75,6 +75,11 @@ bool lv_freetype_outline_font_create(lv_freetype_font_dsc_t * dsc)
dsc->cache_node->draw_data_cache = lv_cache_create(&lv_cache_class_lru_rb_count, sizeof(lv_freetype_outline_node_t),
LV_FREETYPE_CACHE_FT_GLYPH_CNT,
glyph_outline_cache_ops);
if(dsc->cache_node->draw_data_cache == NULL
|| dsc->cache_node->glyph_cache == NULL) {
LV_LOG_ERROR("draw data cache creating failed");
return false;
}
LV_LOG_INFO("outline cache(name: %s, style: 0x%x) create %p, ref_cnt = %d",
dsc->cache_node->pathname,