summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve/eve_font.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2024-09-04 22:32:28 +0200
committerUros Majstorovic <majstor@majstor.org>2024-09-04 22:32:28 +0200
commit2947da180404b758dedd42cb189ffc5734d4daa2 (patch)
treecade773d28a2ff923f7609a7e334e828c558e34b /fw/fe310/eos/eve/eve_font.c
parentd23bf86e83d58b84431cef73936227c39ac7d33e (diff)
eve fonts improvement
Diffstat (limited to 'fw/fe310/eos/eve/eve_font.c')
-rw-r--r--fw/fe310/eos/eve/eve_font.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/fw/fe310/eos/eve/eve_font.c b/fw/fe310/eos/eve/eve_font.c
index cde0a17..4e149f2 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;
}
-int eve_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;
@@ -43,7 +43,7 @@ int eve_font_str_w(EVEFont *font, utf8_t *str, int *str_w, size_t *str_len) {
return EVE_OK;
}
-int eve_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 *str_w, size_t *str_len) {
uint16_t r = 0;
size_t len = 0;
ucp_t ch;
@@ -67,6 +67,29 @@ int eve_font_buf_w(EVEFont *font, utf8_t *buf, size_t buf_len, int *str_w, size_
return EVE_OK;
}
+int eve_font_verify(EVEFont *font, utf8_t *str, int *str_w, size_t *str_len) {
+ int rv;
+
+ rv = font_str_w(font, str, str_w, str_len);
+ return rv;
+}
+
+int eve_font_str_w(EVEFont *font, utf8_t *str) {
+ int str_w, rv;
+
+ rv = font_str_w(font, str, &str_w, NULL);
+ if (rv < 0) return rv;
+ return str_w;
+}
+
+int eve_font_buf_w(EVEFont *font, utf8_t *str, size_t buf_len) {
+ int buf_w, rv;
+
+ rv = font_buf_w(font, str, buf_len, &buf_w, NULL);
+ if (rv < 0) return rv;
+ return buf_w;
+}
+
uint8_t eve_font_h(EVEFont *font) {
return font->h;
}