diff options
author | Uros Majstorovic <majstor@majstor.org> | 2024-09-04 17:01:05 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2024-09-04 17:01:05 +0200 |
commit | 16481ee83d7bde7a28dc8b0d767e0e59d78eb678 (patch) | |
tree | b57a851caaa964a6b5d2b798f0b74133b7ab5538 /fw/fe310/eos/eve | |
parent | 6da98500b8310c19d8b0745ce1b5adfc677ab6b1 (diff) |
unicode support improvements / bugfixes
Diffstat (limited to 'fw/fe310/eos/eve')
-rw-r--r-- | fw/fe310/eos/eve/eve_font.c | 6 | ||||
-rw-r--r-- | fw/fe310/eos/eve/eve_font.h | 2 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/selectw.c | 2 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/strw.c | 13 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/textw.c | 14 |
5 files changed, 21 insertions, 16 deletions
diff --git a/fw/fe310/eos/eve/eve_font.c b/fw/fe310/eos/eve/eve_font.c index e1e3aee..81df143 100644 --- a/fw/fe310/eos/eve/eve_font.c +++ b/fw/fe310/eos/eve/eve_font.c @@ -14,14 +14,14 @@ void eve_font_init(EVEFont *font, uint8_t font_id) { eve_readb(p, font->w_ch, 128); } -uint8_t eve_font_ch_w(EVEFont *font, utf32_t ch) { +uint8_t eve_font_ch_w(EVEFont *font, ucp_t ch) { if (ch < 128) return font->w_ch[ch]; return 0; } uint16_t eve_font_str_w(EVEFont *font, utf8_t *str) { uint16_t r = 0; - utf32_t ch; + ucp_t ch; uint8_t ch_w; uint8_t ch_l; @@ -40,7 +40,7 @@ uint16_t eve_font_str_w(EVEFont *font, utf8_t *str) { uint16_t eve_font_buf_w(EVEFont *font, utf8_t *buf, uint16_t buf_len) { int i = 0; uint16_t r = 0; - utf32_t ch; + ucp_t ch; uint8_t ch_w; uint8_t ch_l; diff --git a/fw/fe310/eos/eve/eve_font.h b/fw/fe310/eos/eve/eve_font.h index 87ef41f..c098519 100644 --- a/fw/fe310/eos/eve/eve_font.h +++ b/fw/fe310/eos/eve/eve_font.h @@ -10,7 +10,7 @@ typedef struct EVEFont { } EVEFont; void eve_font_init(EVEFont *font, uint8_t font_id); -uint8_t eve_font_ch_w(EVEFont *font, utf32_t ch); +uint8_t eve_font_ch_w(EVEFont *font, ucp_t ch); uint16_t eve_font_str_w(EVEFont *font, utf8_t *str); uint16_t eve_font_buf_w(EVEFont *font, utf8_t *buf, uint16_t buf_len); uint8_t eve_font_h(EVEFont *font); diff --git a/fw/fe310/eos/eve/widget/selectw.c b/fw/fe310/eos/eve/widget/selectw.c index f5bb6e0..b11f9b6 100644 --- a/fw/fe310/eos/eve/widget/selectw.c +++ b/fw/fe310/eos/eve/widget/selectw.c @@ -15,7 +15,7 @@ #define DIVC(x,y) ((x) / (y) + ((x) % (y) != 0)) static int selectw_verify(utf8_t *option, uint16_t option_size) { - int o_len; + size_t o_len; uint16_t o_curr; int rv; diff --git a/fw/fe310/eos/eve/widget/strw.c b/fw/fe310/eos/eve/widget/strw.c index 6bddbe9..cd1f51d 100644 --- a/fw/fe310/eos/eve/widget/strw.c +++ b/fw/fe310/eos/eve/widget/strw.c @@ -29,7 +29,8 @@ void eve_strw_init(EVEStrWidget *widget, EVERect *g, EVEPage *page, EVEFont *font, utf8_t *str, uint16_t str_size) { EVEWidget *_widget = &widget->w; - int rv, str_len; + size_t str_len; + int rv; memset(widget, 0, sizeof(EVEStrWidget)); eve_widget_init(_widget, EVE_WIDGET_TYPE_STR, g, page, eve_strw_draw, eve_strw_touch, eve_strw_putc); @@ -47,7 +48,8 @@ void eve_strw_init(EVEStrWidget *widget, EVERect *g, EVEPage *page, EVEFont *fon } int eve_strw_update(EVEStrWidget *widget) { - int rv, str_len; + size_t str_len; + int rv; rv = utf8_verify(widget->str, widget->str_size, &str_len); if (rv != UTF_OK) { @@ -317,7 +319,7 @@ void eve_strw_putc(void *w, int c) { if (!cursor1->on) return; if (!cursor2->on && ((c == CH_BS) || (c == CH_DEL))) { - utf32_t uc; + ucp_t uc; str = widget->str + cursor1->ch; switch (c) { @@ -371,7 +373,8 @@ void eve_strw_putc(void *w, int c) { ins_c = utf8_enc(c, utf8_buf); ins_w = eve_font_ch_w(widget->font, c); } else if (c == CH_CTRLV) { - int rv, clipb_len = 0; + size_t clipb_len = 0; + int rv; clipb = eve_clipb_get(); if (clipb) { @@ -413,7 +416,7 @@ void eve_strw_putc(void *w, int c) { void eve_strw_cursor_set(EVEStrWidget *widget, EVEStrCursor *cursor, int16_t x) { int i; int16_t _x, _d; - utf32_t ch; + ucp_t ch; uint8_t ch_w; uint8_t ch_l; EVEWidget *_widget = &widget->w; diff --git a/fw/fe310/eos/eve/widget/textw.c b/fw/fe310/eos/eve/widget/textw.c index 4348b67..d77e245 100644 --- a/fw/fe310/eos/eve/widget/textw.c +++ b/fw/fe310/eos/eve/widget/textw.c @@ -32,7 +32,8 @@ void eve_textw_init(EVETextWidget *widget, EVERect *g, EVEPage *page, EVEFont *font, utf8_t *text, uint16_t text_size, uint16_t *line, uint16_t line_size) { EVEWidget *_widget = &widget->w; - int rv, text_len; + size_t text_len; + int rv; memset(widget, 0, sizeof(EVETextWidget)); eve_widget_init(_widget, EVE_WIDGET_TYPE_TEXT, g, page, eve_textw_draw, eve_textw_touch, eve_textw_putc); @@ -327,7 +328,7 @@ void eve_textw_putc(void *w, int c) { if (!cursor1->on) return; if (!cursor2->on && ((c == CH_BS) || (c == CH_DEL))) { - utf32_t uc; + ucp_t uc; text = widget->text + cursor1->ch; switch (c) { @@ -371,7 +372,8 @@ void eve_textw_putc(void *w, int c) { ins_c = utf8_enc(c, utf8_buf); ch_w = eve_font_ch_w(widget->font, c); } else if (c == CH_CTRLV) { - int rv, clipb_len = 0; + size_t clipb_len = 0; + int rv; clipb = eve_clipb_get(); if (clipb) { @@ -431,7 +433,7 @@ void eve_textw_putc(void *w, int c) { uint16_t eve_textw_text_update(EVETextWidget *widget, uint16_t line, int uievt) { int i; - utf32_t ch; + ucp_t ch; uint8_t ch_w; uint8_t ch_l; uint16_t word_w, line_w, line_b; @@ -495,7 +497,7 @@ uint16_t eve_textw_text_update(EVETextWidget *widget, uint16_t line, int uievt) void eve_textw_cursor_update(EVETextWidget *widget, EVETextCursor *cursor) { int i = LINE_START(widget, cursor->line); uint16_t x = 0; - utf32_t ch; + ucp_t ch; uint8_t ch_l; EVEWidget *_widget = &widget->w; @@ -512,7 +514,7 @@ void eve_textw_cursor_set(EVETextWidget *widget, EVETextCursor *cursor, uint8_t int i; int16_t _x, _d; uint16_t c_line = LINE_EMPTY; - utf32_t ch; + ucp_t ch; uint8_t ch_w; uint8_t ch_l; EVEWidget *_widget = &widget->w; |