Ok, I think I found what went wrong.
So in lv_font_fmt_txt.c
we have the following lines.
Somehow the optimizer just “assumes” the letter is ‘\t’ and leaves me with a space. I run the optimizer in -Os (size) mode. Setting the optimizer to -O0 (zero) mode will cause the code to just run fine. An alternative is to comment out these 4 lines.
Since these kinds of claims require some sort of evidence, I updated get_glyph_dsc_id
static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
{
LV_LOG_USER("Begin with font %p and letter %d", font, letter);
if(letter == '\0') return 0;
lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *)font->dsc;
So, with the optimizer in -Os mode we get the following lines at the end (note: the 2nd call is the 2nd time this method is called in lv_font_get_glyph_dsc_fmt_txt()
.)
[User] (12.685, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 32 (in lv_font_fmt_txt.c line #211)
[User] (12.687, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 109 (in lv_font_fmt_txt.c line #211)
[User] (12.689, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 32 (in lv_font_fmt_txt.c line #211)
[User] (12.691, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 97 (in lv_font_fmt_txt.c line #211)
[User] (12.693, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 32 (in lv_font_fmt_txt.c line #211)
[User] (12.694, +1) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 116 (in lv_font_fmt_txt.c line #211)
[User] (12.696, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 32 (in lv_font_fmt_txt.c line #211)
[User] (12.698, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 105 (in lv_font_fmt_txt.c line #211)
[User] (12.700, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 32 (in lv_font_fmt_txt.c line #211)
[User] (12.702, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 99 (in lv_font_fmt_txt.c line #211)
[User] (12.705, +3) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 32 (in lv_font_fmt_txt.c line #211)
[User] (12.705, +0) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 97 (in lv_font_fmt_txt.c line #211)
[User] (12.708, +3) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 32 (in lv_font_fmt_txt.c line #211)
[User] (12.710, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 108 (in lv_font_fmt_txt.c line #211)
[User] (12.712, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 32 (in lv_font_fmt_txt.c line #211)
[User] (12.714, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 108 (in lv_font_fmt_txt.c line #211)
[User] (12.716, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 32 (in lv_font_fmt_txt.c line #211)
[User] (12.716, +0) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 121 (in lv_font_fmt_txt.c line #211)
[User] (12.718, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 32 (in lv_font_fmt_txt.c line #211)
[User] (12.720, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 46 (in lv_font_fmt_txt.c line #211)
[User] (12.723, +3) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 32 (in lv_font_fmt_txt.c line #211)
[User] (12.725, +2) get_glyph_dsc_id: Begin with font 0xa0026ba0 and letter 0 (in lv_font_fmt_txt.c line #211)
Now with the if(unicode_letter == '\t')
section disabled
[User] (13.432, +1) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 109 (in lv_font_fmt_txt.c line #211)
[User] (13.433, +1) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 109 (in lv_font_fmt_txt.c line #211)
[User] (13.435, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 97 (in lv_font_fmt_txt.c line #211)
[User] (13.437, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 97 (in lv_font_fmt_txt.c line #211)
[User] (13.439, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 116 (in lv_font_fmt_txt.c line #211)
[User] (13.441, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 116 (in lv_font_fmt_txt.c line #211)
[User] (13.442, +1) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 105 (in lv_font_fmt_txt.c line #211)
[User] (13.444, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 105 (in lv_font_fmt_txt.c line #211)
[User] (13.446, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 99 (in lv_font_fmt_txt.c line #211)
[User] (13.448, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 99 (in lv_font_fmt_txt.c line #211)
[User] (13.450, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 97 (in lv_font_fmt_txt.c line #211)
[User] (13.452, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 97 (in lv_font_fmt_txt.c line #211)
[User] (13.453, +1) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 108 (in lv_font_fmt_txt.c line #211)
[User] (13.455, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 108 (in lv_font_fmt_txt.c line #211)
[User] (13.457, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 108 (in lv_font_fmt_txt.c line #211)
[User] (13.460, +3) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 108 (in lv_font_fmt_txt.c line #211)
[User] (13.462, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 121 (in lv_font_fmt_txt.c line #211)
[User] (13.464, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 121 (in lv_font_fmt_txt.c line #211)
[User] (13.464, +0) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 46 (in lv_font_fmt_txt.c line #211)
[User] (13.467, +3) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 46 (in lv_font_fmt_txt.c line #211)
[User] (13.469, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 0 (in lv_font_fmt_txt.c line #211)
And finally the optimizer set to -O0
[User] (13.432, +1) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 109 (in lv_font_fmt_txt.c line #211)
[User] (13.433, +1) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 109 (in lv_font_fmt_txt.c line #211)
[User] (13.435, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 97 (in lv_font_fmt_txt.c line #211)
[User] (13.437, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 97 (in lv_font_fmt_txt.c line #211)
[User] (13.439, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 116 (in lv_font_fmt_txt.c line #211)
[User] (13.441, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 116 (in lv_font_fmt_txt.c line #211)
[User] (13.442, +1) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 105 (in lv_font_fmt_txt.c line #211)
[User] (13.444, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 105 (in lv_font_fmt_txt.c line #211)
[User] (13.446, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 99 (in lv_font_fmt_txt.c line #211)
[User] (13.448, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 99 (in lv_font_fmt_txt.c line #211)
[User] (13.450, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 97 (in lv_font_fmt_txt.c line #211)
[User] (13.452, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 97 (in lv_font_fmt_txt.c line #211)
[User] (13.453, +1) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 108 (in lv_font_fmt_txt.c line #211)
[User] (13.455, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 108 (in lv_font_fmt_txt.c line #211)
[User] (13.457, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 108 (in lv_font_fmt_txt.c line #211)
[User] (13.460, +3) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 108 (in lv_font_fmt_txt.c line #211)
[User] (13.462, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 121 (in lv_font_fmt_txt.c line #211)
[User] (13.464, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 121 (in lv_font_fmt_txt.c line #211)
[User] (13.464, +0) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 46 (in lv_font_fmt_txt.c line #211)
[User] (13.467, +3) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 46 (in lv_font_fmt_txt.c line #211)
[User] (13.469, +2) get_glyph_dsc_id: Begin with font 0xa0026b7c and letter 0 (in lv_font_fmt_txt.c line #211)
As a test I updated lv_font_get_glyph_dsc_fmt_txt()
to the following.
bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter,
uint32_t unicode_letter_next)
{
volatile uint32_t temp_unicode_letter = unicode_letter;
volatile bool is_tab = false;
if(temp_unicode_letter == '\t') {
unicode_letter = ' ';
is_tab = true;
}
lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *)font->dsc;
This also seems to work with -Os.