summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve/widget/strw.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/widget/strw.c
parentd23bf86e83d58b84431cef73936227c39ac7d33e (diff)
eve fonts improvement
Diffstat (limited to 'fw/fe310/eos/eve/widget/strw.c')
-rw-r--r--fw/fe310/eos/eve/widget/strw.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fw/fe310/eos/eve/widget/strw.c b/fw/fe310/eos/eve/widget/strw.c
index 873e017..1b2e131 100644
--- a/fw/fe310/eos/eve/widget/strw.c
+++ b/fw/fe310/eos/eve/widget/strw.c
@@ -34,14 +34,14 @@ void eve_strw_init(EVEStrWidget *widget, EVERect *g, EVEPage *page, EVEFont *fon
memset(widget, 0, sizeof(EVEStrWidget));
eve_widget_init(_widget, EVE_WIDGET_TYPE_STR, g, page, eve_strw_draw, eve_strw_touch, eve_strw_putc);
- widget->font = font;
rv = utf8_verify(str, str_size, &str_len);
if (rv) str[str_len] = '\0';
- rv = eve_font_str_w(font, str, &str_w, &str_len);
+ rv = eve_font_verify(font, str, &str_w, &str_len);
if (rv) str[str_len] = '\0';
+ widget->font = font;
widget->str = str;
widget->str_size = str_size;
widget->str_len = str_len;
@@ -56,7 +56,7 @@ int eve_strw_update(EVEStrWidget *widget) {
rv = utf8_verify(widget->str, widget->str_size, &str_len);
if (rv) widget->str[str_len] = '\0';
- rv = eve_font_str_w(widget->font, widget->str, &str_w, &str_len);
+ rv = eve_font_verify(widget->font, widget->str, &str_w, &str_len);
if (rv) widget->str[str_len] = '\0';
widget->str_len = str_len;
@@ -368,7 +368,7 @@ void eve_strw_putc(void *w, int c) {
if (cursor2->on) {
del_c = c2->ch - c1->ch;
- eve_font_buf_w(widget->font, str, del_c, &del_w, NULL);
+ del_w = eve_font_buf_w(widget->font, str, del_c);
if ((c == CH_CTRLX) || (c == CH_CTRLC)) {
eve_clipb_push(str, del_c);
if (c == CH_CTRLC) return;
@@ -387,8 +387,8 @@ void eve_strw_putc(void *w, int c) {
clipb = eve_clipb_get();
if (clipb) {
rv = utf8_verify(clipb, EVE_CLIPB_SIZE_BUF, &clipb_len);
- if (!rv) rv = eve_font_str_w(widget->font, clipb, &ins_w, NULL);
- if (rv) {
+ if (!rv) ins_w = eve_font_str_w(widget->font, clipb);
+ if (rv || (ins_w < 0)) {
clipb = NULL;
clipb_len = 0;
ins_w = 0;