From 2947da180404b758dedd42cb189ffc5734d4daa2 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Wed, 4 Sep 2024 22:32:28 +0200 Subject: eve fonts improvement --- fw/fe310/eos/eve/widget/textw.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'fw/fe310/eos/eve/widget/textw.c') diff --git a/fw/fe310/eos/eve/widget/textw.c b/fw/fe310/eos/eve/widget/textw.c index f85d1e0..86343a5 100644 --- a/fw/fe310/eos/eve/widget/textw.c +++ b/fw/fe310/eos/eve/widget/textw.c @@ -37,14 +37,14 @@ void eve_textw_init(EVETextWidget *widget, EVERect *g, EVEPage *page, EVEFont *f memset(widget, 0, sizeof(EVETextWidget)); eve_widget_init(_widget, EVE_WIDGET_TYPE_TEXT, g, page, eve_textw_draw, eve_textw_touch, eve_textw_putc); - widget->font = font; rv = utf8_verify(text, text_size, &text_len); if (rv) text[text_len] = '\0'; - rv = eve_font_str_w(font, text, NULL, &text_len); + rv = eve_font_verify(font, text, NULL, &text_len); if (rv) text[text_len] = '\0'; + widget->font = font; widget->text = text; widget->text_size = text_size; widget->text_len = text_len; @@ -59,10 +59,10 @@ int eve_textw_update(EVETextWidget *widget) { int rv; rv = utf8_verify(widget->text, widget->text_size, &text_len); - if (rv != UTF_OK) widget->text[text_len] = '\0'; + if (rv) widget->text[text_len] = '\0'; - rv = eve_font_str_w(widget->font, widget->text, NULL, &text_len); - if (rv != UTF_OK) widget->text[text_len] = '\0'; + rv = eve_font_verify(widget->font, widget->text, NULL, &text_len); + if (rv) widget->text[text_len] = '\0'; memset(widget->line, 0xff, widget->line_size * sizeof(uint16_t)); eve_textw_text_update(widget, 0, 0); @@ -399,8 +399,8 @@ void eve_textw_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, &ch_w, NULL); - if (rv) { + if (!rv) ch_w = eve_font_str_w(widget->font, clipb); + if (rv || (ch_w < 0)) { clipb = NULL; clipb_len = 0; ch_w = 0; -- cgit v1.2.3