Symbol didn't work on my project

The following screenshot is part of my project:


Are you sure your IDE has UTF-8 encoding?

Yes, I’m sure I use UTF-8 in the IDE

I’ve tired in the simulator like this:

    lv_obj_t * label = lv_label_create(lv_scr_act(), NULL);
    lv_label_set_text(label, LV_SYMBOL_BLUETOOTH "123");

and it worked fine. I also set the LV_COLOR_DEPTH 1 as I suppose it is in your configuration.

For the shape of the letters, it seems you are not using the latest version of lvgl.
Please, update lvgl to the latest version from the master branch. Maybe there was a temporal issue in the past.

To solve this problem, I cloned the latest master branch and spent some time tracking and debugging my program. Here are the problems I found:

The following screenshot is line 186 in the lv_font_fmt_txt.c . When I use symbols, the pointer p here returns NULL, so I manually give the pointer p a certain address (the first symbol defined ), So the screen looks like it is working properly.

This looks like the symbol was not found in the unicode_list in the lv_utils_bsearch function.

The font I use now is lv_font_roboto_16.


After my trace debugging, I found the problem:
Because I am using a 16-bit microcontroller, a data overflow occurred while executing the following function(Line 476 in file lv_font_fmt_txt.c), so when I cast the data to int32_t, all problems were resolved.

static int32_t unicode_list_compare(const void * ref, const void * element)
    /*Yaee debug start*/
    return ((int32_t)(*(uint16_t *)ref)) - ((int32_t)(*(uint16_t *)element));

    /*Yaee debug end*/

//    return (*(uint16_t *)ref) - (*(uint16_t *)element);

Can you send a Pull request with these updates?

I’ve just applied the fix. Thank you for suggestion!