Some symbols icon don't appear in list

Hello,

I’m trying to figure out why exactly some custom icons are not displayed in a list but are on other widgets.
I tried debugging and went into lv_font_get_glyph_dsc not being able to get glyph description resulting in having the width of the symbol being 0.

Is this a known bug ?

FYI, the compiled font is from Font Awesome and computed with:
lv_font_conv --size 15 --bpp 2 --font FontAwesome5-Solid+Brands+Regular.woff -o FA5_15.c --format lvgl --range 0xf7b9,0xf7ba,0xf028,0xf04b,0xf6a9,0xf013,0xf04d,0xf3fd,0xf071,0xf12a,0xf05e,0xf06c,0xf5d2,0xf4fd,0xf102,0xf100,0xf101,0xf240,0xf241,0xf242,0xf243,0xf244,0xf080,0xf535,0xf2f5,0xf8a2,0xf545,0xf26c,0xf0e7 --no-compress

What MCU/Processor/Board and compiler are you using?

nrf53840

What LVGL version are you using?

8.2.0

What do you want to achieve?

Display a custom symbol into the list widget (with lv_list_add_btn)

What have you tried so far?

Checking if related icons works elsewhere (lv_label_set_text for instance is OK on other screens but not this one as well)
Check other icons from the custom font → OK

Code to reproduce

// Previous objects definition...
 
/* List */
  list_l1 = lv_list_create(settings_container);
  lv_obj_set_size(list_l1, lv_pct(100), lv_pct(100));
  lv_style_reset(&style_settings_list);

  /* Add buttons to the list */
  lv_list_add_text(list_l1, "Settings");

  list_btn0 = lv_list_add_btn(list_l1, Q_ICON_RETURN, "Go back"); // Displayed correctly
  lv_obj_add_event_cb(list_btn0, go2Cb, LV_EVENT_CLICKED, v->parent);

  lv_group_add_obj(g_settings, list_btn0);

  list_btn1 = lv_list_add_btn(list_l1, Q_ICON_RULER, "Unit"); // Not displayed
  lv_obj_add_event_cb(list_btn1, go2Cb, LV_EVENT_CLICKED, (void *)&(sub_views[SETTINGS_UNIT_VIEW_INDEX]));

  lv_group_add_obj(g_settings, list_btn1);

Thanks in advance for you help.

EDIT:

  1. when forcing the font to the problematic icons with lv_style_set_text_font it works but, of course, the normal text isn’t displayed anymore :smiley:
  2. custom icons having no issue are actually duplicated with the native LVGL icons (like Q_ICON_RETURN → LV_SYMBOL_NEW_LINE) that’s why these are working properly…

Any tips then ? (I think we can now simply rephrase the question as "how to use custom icons with list widget :slight_smile: )

I finally tried to use font fallback to load my icons but this gives me an Access violation error at runtime :

extern const lv_font_t FA5_quantum_15;

bool load_font_fallback() {
  lv_font_t *dfont = lv_font_default(); // In debugger -> lv_font_montserrat_14 (->fallback null)

  if(!dfont) {
    return false;
  }

  dfont->fallback = &FA5_quantum_15; // Data Access Violation

  return true;
}

Is this bad practice ?

I saw meanwhile the default font is declared as const, so I made my own font loader function that implements its fallback to my icon font and that solved my problem.