Description
I’ve created a custom font using the font converter on the lvgl website. It all works well except the fact that the last character is cut off at the end, so it’s not fully displaying the font.
What MCU/Processor/Board and compiler are you using?
PC simulator
What do you experience?
As can be seen in the image below, the “3” is cut off at the end towards last few pixels
What do you expect?
Code to reproduce
This is the basic sketch used, the font is declared in the config file. The font is Eurostile Extended Bold Italic
LV_IMG_DECLARE(guage_bg_bar);
float boostVal = 2.3;
void lv_ex_get_started_guage(void)
{
lv_obj_t * obj0 = lv_obj_create(lv_scr_act(), NULL);
lv_obj_set_width(obj0, 480);
lv_obj_set_height(obj0, 320);
static lv_style_t style1;
lv_style_init(&style1);
lv_style_set_bg_color(&style1, LV_STATE_DEFAULT, LV_COLOR_BLACK);
lv_obj_add_style(obj0,LV_OBJ_PART_MAIN, &style1);
lv_style_set_border_width(&style1, LV_STATE_DEFAULT, 0);
lv_style_set_radius(&style1, LV_STATE_DEFAULT, 0);
static lv_style_t text1;
lv_style_init(&text1);
lv_style_set_text_color(&text1, LV_STATE_DEFAULT, LV_COLOR_WHITE); //
lv_style_set_text_font(&text1, LV_STATE_DEFAULT, &EurostileExtObl_Bold_Regular_24px); /*Set a larger font*/
static lv_color_t colors[1];
colors[0] = LV_COLOR_BLUE;
lv_obj_t * guage_bg = lv_img_create(obj0, NULL);
lv_img_set_src(guage_bg, &guage_bg_bar);
lv_obj_t * gauge1 = lv_gauge_create(guage_bg, NULL);
lv_obj_clean_style_list(gauge1, LV_GAUGE_PART_MAJOR);
lv_obj_clean_style_list(gauge1, LV_GAUGE_PART_MAIN); //The default is transparent
lv_gauge_set_scale(gauge1, 270, 0, 0);
lv_gauge_set_angle_offset(gauge1, -45);
lv_gauge_set_range(gauge1,0,750);
lv_gauge_set_needle_count(gauge1, 1, colors);
lv_obj_set_size(gauge1, 320, 319);
lv_obj_align(gauge1, NULL, LV_ALIGN_CENTER, 0, 0);
lv_gauge_set_value(gauge1,0, 260);
lv_obj_t * label2 = lv_label_create(obj0, NULL);
lv_obj_set_x(label2, 182);
lv_obj_set_y(label2, 230);
lv_obj_add_style(label2,LV_OBJ_PART_MAIN, &text1);
lv_label_set_text_fmt(label2, "%.1f", boostVal); // %.2f sets two digits after the decimal point
}