How to change the height of the label backgroud

Hi, Sir,
I want to change the backgroud height of a label to make the label backgroud equal to the font size. I have set the padding.ver to 1, but still have a large blank space in the vertical . I am using the lv_font_dejavu_40. Which parameter in the style might control it?

Best Regards,


It should be the padding. Can you send a code snippet to try it?

1 Like

Hi, Kisvegabor,
Many thanks!
Further test show that ,the blank space were inherited from the font itself . Am I right? Do we have some lib fonts which have not blank space in the vertical direction?
Code is as below :
static lv_style_t style1;
lv_style_copy(&style1, &lv_style_pretty );
style1.text.font = &lv_font_dejavu_30;
style1.body.main_color=LV_COLOR_GRAY ;
style1.body.grad_color =LV_COLOR_GRAY ;
Best Regards,

It seems correct to me:

The extra space on the top is reserved for the accent, and on bottom for the lower part of the letters (eg y, g or j).

1 Like

Hi, Kisvegabor,
Many thanks!
Yes I got the same result with you.
Best Regards,