fix(freetype): fix freetype outline size set behavior (#5255)

This commit is contained in:
Benign X
2024-01-10 17:20:43 +08:00
committed by GitHub
parent 56073d03c7
commit a299242b34
3 changed files with 360 additions and 364 deletions
+2 -10
View File
@@ -411,16 +411,6 @@ static bool cache_node_cache_create_cb(lv_freetype_cache_node_t * node, void * u
node->ref_size = LV_FREETYPE_OUTLINE_REF_SIZE_DEF;
if(node->render_mode == LV_FREETYPE_FONT_RENDER_MODE_OUTLINE) {
FT_F26Dot6 pixel_size = FT_INT_TO_F26DOT6(node->ref_size);
error = FT_Set_Char_Size(face, 0, pixel_size, 0, 0);
if(error) {
FT_Done_Face(face);
FT_ERROR_MSG("FT_Set_Char_Size", error);
return false;
}
}
if(node->style & LV_FREETYPE_FONT_STYLE_ITALIC) {
lv_freetype_italic_transform(face);
}
@@ -431,6 +421,8 @@ static bool cache_node_cache_create_cb(lv_freetype_cache_node_t * node, void * u
}
static void cache_node_cache_free_cb(lv_freetype_cache_node_t * node, void * user_data)
{
FT_Done_Face(node->face);
if(node->glyph_cache) {
lv_cache_destroy(node->glyph_cache, user_data);
node->glyph_cache = NULL;
+6 -2
View File
@@ -292,11 +292,15 @@ static lv_freetype_outline_t outline_create(
uint32_t size,
uint32_t strength)
{
LV_UNUSED(size);
LV_ASSERT_NULL(ctx);
FT_Error error;
error = FT_Set_Pixel_Sizes(face, 0, size);
if(error) {
FT_ERROR_MSG("FT_Set_Char_Size", error);
return NULL;
}
/* Load glyph */
error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP);
if(error) {
File diff suppressed because it is too large Load Diff