Description
Using lv_label_set_text() to update the date, and it clips the text for some dates. Issue may be related to positive kerning offset.
What MCU/Processor/Board and compiler are you using?
MCU = PSoC 6
Board = CY8CKIT-062
Compiler = GCC 5.4
What do you experience?
Expect to see a label that says:
January 1, 2021
but I see
January 1,
It fails for the months of January and February, but no others. The day of month, or year, does not seem to matter – only determining factor seems to be month. The glyph ‘ry’ has positive kerning, which is rare – could that be a clue?
I have also seen similar issue when using the / for dates – there it would sometimes cut off only the last number of the year.
If I initialize the ROBOTO_16 array ckern_class_values
to zero, the problem goes away.
What do you expect?
I expect to see the entire date string passed to lv_label_set_text()
Code to reproduce
When I create the label, I give it initial text string:
btn_dat = lv_btn_create(lv_scr_act(), NULL); /*Add a button the current screen*/
lv_obj_set_pos(btn_dat, h_ban_1, v_ban_1); /*Set its position*/
lv_obj_set_size(btn_dat, ban_wid, ban_hgt); /*Set its size*/
lv_obj_set_event_cb(btn_dat, date_activity_action); /*Assign a callback to the button*/
label_dat = lv_label_create(btn_dat, NULL);
lv_label_set_text( label_dat, "Wednesday, January 20 2021" );
lv_obj_align( label_dat, NULL, LV_ALIGN_IN_TOP_MID, 0,0 );
set_label_dat(label_dat);
lv_label_set_long_mode(label_dat, LV_LABEL_LONG_EXPAND);
Then later change it based on Calendar widget:
static void calendar_event_handler(lv_obj_t * obj, lv_event_t event)
{
static char date_str[64];
if(event == LV_EVENT_CLICKED)
{
lv_calendar_date_t * date = lv_calendar_get_pressed_date(obj);
if(date)
{
lv_calendar_set_today_date(obj, date);
today = *date;
sprintf( date_str, "%s %2d, %4d", months[today.month-1], today.day, today.year );
lv_label_set_text( label_dat, date_str );
lv_obj_del(obj);
}
}
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current issue.