Bug with text area that has larger font, one_line mode and and alignment set to LV_LABEL_ALIGN CENTER


Using a larger sized font ~16px with a text area that is set to one line with centered alignment seems to chop the bottom of the font off.

What MCU/Processor/Board and compiler are you using?


What do you experience?

I am using the text area object for a larger font. When I set the text area to use one line with centered alignment, it will chop off the bottom off larger fonts. I do see a bit different behaviour when using the simulator vs. MCU.

On the simulator, all instances of the text area are chopped off, while on the MCU, only the first instance is chopped off.

If I change the alignment to left, it renders correctly.
If the font is smaller ~8px, it renders correctly.

What do you expect?

I expect the font to be rendered whole.

Code to reproduce

void test_largefont()
	static lv_style_t style_box_invisible;
	lv_style_copy(&style_box_invisible, &lv_style_plain);
	style_box_invisible.text.color = LV_COLOR_BLACK;
	style_box_invisible.text.font = &lv_font_roboto_16;

	lv_obj_t *new_ta = lv_ta_create(lv_scr_act(), NULL);

	lv_ta_set_cursor_type(new_ta, LV_CURSOR_NONE);
	lv_ta_set_one_line(new_ta, true);
	lv_ta_set_sb_mode(new_ta, LV_SB_MODE_OFF);
	lv_ta_set_text_align(new_ta, LV_LABEL_ALIGN_CENTER);
	lv_ta_set_style(new_ta, LV_TA_STYLE_BG, &style_box_invisible);
	lv_obj_align(new_ta, NULL, LV_ALIGN_CENTER, 0, 0);
	lv_ta_set_text(new_ta, "S");

Screenshot and/or video


Should I post this in how-to or is there any acknowledgement of reported bugs and tracking a fix?

We use this (or GitHub issues) for tracking bugs. We will post here once we have fixed it/need further discussion.

I’ve fixed it in the master branch!

Could you verify if it works well now?

Awesome, I will fetch it and try it out!

EDIT: I tried the fix and it is working as expected now. Thanks!

1 Like

Great, thanks for the feedback!