diff options
Diffstat (limited to 'fw/fe310/eos/eve/widget/label.c')
-rw-r--r-- | fw/fe310/eos/eve/widget/label.c | 9 |
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) { |