Adjusting label text selection rectangle size


I am not able to change the height of the selection rectangle of Label text.

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

ILI9341, gcc

What LVGL version are you using?


What do you want to achieve?

I am dynamically selecting different parts of the label text by changing selection start and end index. I am also able to change the selection color. But I am unable to change the selection rectangle size. The selection rectangle just cover the text, I want this selection rectangle taller than the text and text appear in the middle. How to do this ?

What have you tried so far?

By adjusting line space using lv_style_set_text_line_space() I am able to extend the bottom of the selection rectangle lower than the text bottom, but then the top edge of the selection rectangle still touch the text. I need similar spacing above the text as well.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.