From 6c68095fb5d62648d9bc644042d0334758a5dc47 Mon Sep 17 00:00:00 2001 From: Arnaud Mouiche Date: Tue, 10 May 2022 18:25:46 +0200 Subject: [PATCH] fix(txt): fix returned value of lv_txt_iso8859_1_next(..., NULL) (#3338) Should return the first character of txt instead of the following one. For example, used in lv_txt_get_width() to get 'letter_next' leading to incorrect lv_font_get_glyph_width results. Co-authored-by: Arnaud Mouiche --- src/misc/lv_txt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/misc/lv_txt.c b/src/misc/lv_txt.c index ef60d742e..da7eca0bb 100644 --- a/src/misc/lv_txt.c +++ b/src/misc/lv_txt.c @@ -798,7 +798,7 @@ static uint32_t lv_txt_iso8859_1_conv_wc(uint32_t c) */ static uint32_t lv_txt_iso8859_1_next(const char * txt, uint32_t * i) { - if(i == NULL) return txt[1]; /*Get the next char*/ + if(i == NULL) return txt[0]; /*Get the next char*/ uint8_t letter = txt[*i]; (*i)++;