How to remove redundant space at top/bottom in label

Hi @kisvegabor , @embeddedt

Description

I have a problem with the bottom of text in label.
As the picture in Problem and Expectation, How do I remove the redundant space at the top and bottom or either of them?

What LVGL version are you using?

7.4.0 and 7.10.1

Code to reproduce

//Write codes screen
ui->screen = lv_obj_create(NULL, NULL);

//Write codes screen_label_1
ui->screen_label_1 = lv_label_create(ui->screen, NULL);
lv_label_set_text(ui->screen_label_1, "12");
lv_label_set_long_mode(ui->screen_label_1, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->screen_label_1, LV_LABEL_ALIGN_LEFT);

//Write style LV_LABEL_PART_MAIN for screen_label_1
static lv_style_t style_screen_label_1_main;
lv_style_init(&style_screen_label_1_main);

//Write style state: LV_STATE_DEFAULT for style_screen_label_1_main
lv_style_set_radius(&style_screen_label_1_main, LV_STATE_DEFAULT, 0);
lv_style_set_bg_color(&style_screen_label_1_main, LV_STATE_DEFAULT, lv_color_make(0x31, 0xb4, 0x3a));
lv_style_set_bg_grad_color(&style_screen_label_1_main, LV_STATE_DEFAULT, lv_color_make(0x56, 0xb8, 0x32));
lv_style_set_bg_grad_dir(&style_screen_label_1_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_label_1_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_label_1_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
lv_style_set_text_font(&style_screen_label_1_main, LV_STATE_DEFAULT, &lv_font_simsun_48);
lv_style_set_text_letter_space(&style_screen_label_1_main, LV_STATE_DEFAULT, 2);
lv_style_set_pad_left(&style_screen_label_1_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_right(&style_screen_label_1_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_top(&style_screen_label_1_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_bottom(&style_screen_label_1_main, LV_STATE_DEFAULT, 0);
lv_obj_add_style(ui->screen_label_1, LV_LABEL_PART_MAIN, &style_screen_label_1_main);
lv_obj_set_pos(ui->screen_label_1, 83, 50);
lv_obj_set_size(ui->screen_label_1, 60, 0);

Problem

image

Expectation

image

I’m not sure if you can remove all of it, as IIRC the font enforces some amount of space above/below for letters like g and y which stretch below the baseline.

I have some text with different fonts.
The larger font => the larger the distance of above/below.
So It’s hard to align those text on a straight line.
Do you have any idea?

Problem

image

Expect

image

You can’t remove them because this is how the font looks like. As @embeddedt the top and bottom space is reserved for letters like ÁÉŐygp.

At worst case you can put the text on an lv_obj set its size as you wish and position the label to clip the extra area.

Thanks for your support !