diff options
author | Uros Majstorovic <majstor@majstor.org> | 2024-09-04 22:44:34 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2024-09-04 22:44:34 +0200 |
commit | 1a95f351e7e0a3ccc34be3eba000b1b1b46f18d5 (patch) | |
tree | 8f5bf209dbe1cd5ef2c9755a0a08e3f9d45289b2 | |
parent | 2947da180404b758dedd42cb189ffc5734d4daa2 (diff) |
eve fonts improvement
-rw-r--r-- | fw/fe310/eos/eve/eve_font.c | 24 | ||||
-rw-r--r-- | fw/fe310/eos/eve/eve_font.h | 2 |
2 files changed, 13 insertions, 13 deletions
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); |