mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-22 15:24:16 +08:00
fix(draw): fix using placeholders in a glyph is not found
This commit is contained in:
@@ -109,7 +109,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_letter(lv_layer_t * layer, lv_draw_label_dsc_
|
||||
a.x1 = point->x;
|
||||
a.y1 = point->y;
|
||||
a.x2 = a.x1 + g.adv_w;
|
||||
a.y2 = a.y1 + lv_font_get_line_height(g.resolved_font);
|
||||
a.y2 = a.y1 + lv_font_get_line_height(g.resolved_font ? g.resolved_font : dsc->font);
|
||||
|
||||
/*lv_draw_label needs UTF8 text so convert the Unicode character to an UTF8 string */
|
||||
uint32_t letter_buf[2];
|
||||
@@ -379,8 +379,8 @@ static void draw_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc,
|
||||
letter != 0x200c) { /*ZERO WIDTH NON-JOINER*/
|
||||
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found for U+%" LV_PRIX32, letter);
|
||||
}
|
||||
LV_PROFILER_END;
|
||||
return;
|
||||
// LV_PROFILER_END;
|
||||
// return;
|
||||
}
|
||||
|
||||
/*Don't draw anything if the character is empty. E.g. space*/
|
||||
@@ -411,7 +411,12 @@ static void draw_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc,
|
||||
dsc->_bitmap_buf_size = bitmap_size;
|
||||
}
|
||||
|
||||
dsc->bitmap = lv_font_get_glyph_bitmap(g.resolved_font, letter, dsc->bitmap_buf);
|
||||
if(g.resolved_font) {
|
||||
dsc->bitmap = lv_font_get_glyph_bitmap(g.resolved_font, letter, dsc->bitmap_buf);
|
||||
}
|
||||
else {
|
||||
dsc->bitmap = NULL;
|
||||
}
|
||||
dsc->letter_coords = &letter_coords;
|
||||
if(g.bpp == LV_IMGFONT_BPP) dsc->format = LV_DRAW_LETTER_BITMAP_FORMAT_IMAGE;
|
||||
else dsc->format = LV_DRAW_LETTER_BITMAP_FORMAT_A8;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@@ -128,4 +128,14 @@ void test_label_decor(void)
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("draw/label_decor.png");
|
||||
}
|
||||
|
||||
|
||||
void test_label_placeholder(void)
|
||||
{
|
||||
lv_obj_t * label = lv_label_create(lv_scr_act());
|
||||
lv_label_set_text(label, "ABCÁÉŐ\naáeéoő");
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("draw/label_placeholder.png");
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user