summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve/widget/label.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2024-09-04 20:21:55 +0200
committerUros Majstorovic <majstor@majstor.org>2024-09-04 20:21:55 +0200
commitafd07f4bc007ddf4a9e036cd9f4c2db800719653 (patch)
treeb3c17ff70fb69636bb7279de0392ae5a21ae68f1 /fw/fe310/eos/eve/widget/label.c
parent16481ee83d7bde7a28dc8b0d767e0e59d78eb678 (diff)
support for unknown character in eve font
Diffstat (limited to 'fw/fe310/eos/eve/widget/label.c')
-rw-r--r--fw/fe310/eos/eve/widget/label.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fw/fe310/eos/eve/widget/label.c b/fw/fe310/eos/eve/widget/label.c
index 43d555d..bf99051 100644
--- a/fw/fe310/eos/eve/widget/label.c
+++ b/fw/fe310/eos/eve/widget/label.c
@@ -11,12 +11,19 @@
#include "label.h"
void eve_label_init(EVELabel *label, EVERect *g, EVEFont *font, char *title) {
+ size_t title_len;
+ int title_w, rv;
+
memset(label, 0, sizeof(EVELabel));
if (g) label->g = *g;
+
+ rv = eve_font_str_w(font, label->title, &title_w, &title_len);
+ if (rv) title[title_len] = '\0';
+
label->font = font;
label->title = title;
if (label->g.h == 0) label->g.h = eve_font_h(font);
- if (label->g.w == 0) label->g.w = eve_font_str_w(font, label->title) + EVE_LABEL_MARGIN;
+ if (label->g.w == 0) label->g.w = title_w + EVE_LABEL_MARGIN;
}
void eve_label_create(EVELabel *label, EVELabelSpec *spec, EVEPage *page) {