imgfont can't display

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imgfont can't display

2,007 Views
rayden
Contributor II

 

rayden_1-1739176216669.png

Gui Guider-1.8.1-GA

 

The type I used is lable and the text content is "abcdefg".

SVG images were used to generate the font, but it doesn't show up after compiling with GUI guider. Why is that?

0 Kudos
Reply
3 Replies

1,958 Views
rayden
Contributor II

The TTF files generated from single-color SVG images can be displayed, but those generated from multi-color SVG images cannot be displayed.

0 Kudos
Reply

1,966 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @rayden 

Can you try using different SVG fonts to see if the problem still persists?

BR

Harry

0 Kudos
Reply

1,903 Views
rayden
Contributor II
 
The version I am currently using is lvgl8.3.
I referred to 'https://lvgl.100ask.net/8.3/others/imgfont.html',However, my icon was not displayed on the screen.The attachment is the array file generated by my image processing program.How can I make it displayed in lvgl8.3 on my device?
 
// code start 
LV_IMG_DECLARE(img_bluetooth_31);
static bool get_imgfont_path_lefticon(const lv_font_t * font, void * img_src,
                             uint16_t len, uint32_t unicode, uint32_t unicode_next)
{
    LV_UNUSED(font);
    LV_UNUSED(unicode_next);
    LV_ASSERT_NULL(img_src);

    if(unicode == 0xF617) {
        memcpy(img_src, &img_bluetooth_31, sizeof(lv_img_dsc_t));
    }

    return true;
}

void lv_imgfont_lefticon_task(void)
{
    lv_font_t * imgfont = lv_imgfont_create(55, get_imgfont_path_lefticon);
    if(imgfont == NULL) {
        LV_LOG_ERROR("imgfont init error");
        return;
    }

    imgfont->fallback = LV_FONT_DEFAULT;

    guider_ui.mainscreen_label_icon_left = lv_label_create(guider_ui.mainscreen);
    lv_label_set_text(guider_ui.mainscreen_label_icon_left, "\uF617");
    lv_obj_set_style_text_font(guider_ui.mainscreen_label_icon_left, imgfont, LV_PART_MAIN);
    lv_obj_set_pos(guider_ui.mainscreen_label_icon_left, 0, 0);
    lv_obj_set_size(guider_ui.mainscreen_label_icon_left, 785, 80);
    lv_obj_set_style_text_color(guider_ui.mainscreen_label_icon_left, lv_color_hex(0x666666), LV_PART_MAIN);
}

XF_REG_TASK_DIV(500, 0, lv_imgfont_lefticon_task)
 
//code end
0 Kudos
Reply