From 1a95f351e7e0a3ccc34be3eba000b1b1b46f18d5 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Wed, 4 Sep 2024 22:44:34 +0200 Subject: eve fonts improvement --- fw/fe310/eos/eve/eve_font.c | 24 ++++++++++++------------ fw/fe310/eos/eve/eve_font.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'fw/fe310/eos') diff --git a/fw/fe310/eos/eve/eve_font.c b/fw/fe310/eos/eve/eve_font.c index 4e149f2..8f272bc 100644 --- a/fw/fe310/eos/eve/eve_font.c +++ b/fw/fe310/eos/eve/eve_font.c @@ -19,7 +19,7 @@ int eve_font_ch_w(EVEFont *font, ucp_t ch) { return EVE_ERR; } -static int font_str_w(EVEFont *font, utf8_t *str, int *str_w, size_t *str_len) { +static int font_str_w(EVEFont *font, utf8_t *str, int *_str_w, size_t *_str_len) { uint16_t r = 0; size_t len = 0; ucp_t ch; @@ -30,20 +30,20 @@ static int font_str_w(EVEFont *font, utf8_t *str, int *str_w, size_t *str_len) { ch_l = utf8_dec(str + len, &ch); ch_w = eve_font_ch_w(font, ch); if (ch_w < 0) { - if (str_w) *str_w = r; - if (str_len) *str_len = len; + if (_str_w) *_str_w = r; + if (_str_len) *_str_len = len; return EVE_ERR; } r += ch_w; len += ch_l; } - if (str_w) *str_w = r; - if (str_len) *str_len = len; + if (_str_w) *_str_w = r; + if (_str_len) *_str_len = len; return EVE_OK; } -static int font_buf_w(EVEFont *font, utf8_t *buf, size_t buf_len, int *str_w, size_t *str_len) { +static int font_buf_w(EVEFont *font, utf8_t *buf, size_t buf_len, int *_buf_w, size_t *_buf_len) { uint16_t r = 0; size_t len = 0; ucp_t ch; @@ -54,16 +54,16 @@ static int font_buf_w(EVEFont *font, utf8_t *buf, size_t buf_len, int *str_w, si ch_l = utf8_dec(buf + len, &ch); ch_w = eve_font_ch_w(font, ch); if (ch_w < 0) { - if (str_w) *str_w = r; - if (str_len) *str_len = len; + if (_buf_w) *_buf_w = r; + if (_buf_len) *_buf_len = len; return EVE_ERR; } r += ch_w; len += ch_l; } - if (str_w) *str_w = r; - if (str_len) *str_len = len; + if (_buf_w) *_buf_w = r; + if (_buf_len) *_buf_len = len; return EVE_OK; } @@ -82,10 +82,10 @@ int eve_font_str_w(EVEFont *font, utf8_t *str) { return str_w; } -int eve_font_buf_w(EVEFont *font, utf8_t *str, size_t buf_len) { +int eve_font_buf_w(EVEFont *font, utf8_t *buf, size_t buf_len) { int buf_w, rv; - rv = font_buf_w(font, str, buf_len, &buf_w, NULL); + rv = font_buf_w(font, buf, buf_len, &buf_w, NULL); if (rv < 0) return rv; return buf_w; } diff --git a/fw/fe310/eos/eve/eve_font.h b/fw/fe310/eos/eve/eve_font.h index 7787f6c..7629106 100644 --- a/fw/fe310/eos/eve/eve_font.h +++ b/fw/fe310/eos/eve/eve_font.h @@ -13,5 +13,5 @@ void eve_font_init(EVEFont *font, uint8_t font_id); int eve_font_ch_w(EVEFont *font, ucp_t ch); int eve_font_verify(EVEFont *font, utf8_t *str, int *str_w, size_t *str_len); int eve_font_str_w(EVEFont *font, utf8_t *str); -int eve_font_buf_w(EVEFont *font, utf8_t *str, size_t buf_len); +int eve_font_buf_w(EVEFont *font, utf8_t *buf, size_t buf_len); uint8_t eve_font_h(EVEFont *font); -- cgit v1.2.3