Reputation: 1888
I want to make my label fonts be a particular size and use C language specific word exchanges. Like below:
/* Label*/
wid->label = elm_label_add(wid->conform);
evas_object_resize(wid->label, 200, 100);
evas_object_move(wid->label, (w / 4)+115, (h / 2 )+100);
evas_object_color_set(wid->label, 50, 255, 150, 255);
evas_object_show(wid->label);
elm_object_text_set(wid->label, ("<font_size=30 >%s</font_size>","TestString"));
At the end line I want '%s' to be replaced by 'TestString' but can't control its size as it won't change its default size or html tags are not working doing this format. I don't know any other way to make it work as tutorials are too scarce for this.
How can I change the size of this label?
Upvotes: 1
Views: 68
Reputation: 92
It is a simple string manipulation issue.
To build a string using substitution, snprintf can be used:
char buf[100];
snprintf(buf, 100, "<font_size=30>%s</font_size>", "TestString");
object_text_set(wid->label, buf);
What You were trying to do in the code You've presented will not work as you expect. The expression ("<font_size=30 >%s</font_size>","TestString")
always evaluates to "TestString"
, due to the comma operator being used in parentheses. The value of the expression (a, b, c, ..., z)
is equal to the last element.
Upvotes: 2