alignmenttizenefl

How to align text on elmentary label widget?


I want align text to center on elm_label widget. I can't find any functions about text align as evas object text function or elm_label function. Also, I can't find a function that can get the text size (absolute pixel or relative size) on a label.

I have tried elm_object_style_set with marker, it was showed bold text on center of label, but font size was too small (smaller than default style). (and I don't want bold on text.)

How I can align text to the center of a label?


Solution

  • You can use HTML like markup to customize the way you want to the display the text in elm_label.

    To align the text to the center, you can use <align> markup tag with value center .

    std::string text = "<align = center> TEXT TO DISPLAY </align>";
    Evas_Object *label = elm_label_add(parent);
    elm_object_text_set(label,text.c_str());
    evas_object_show(label);
    

    You can also use other tags like font_weight, font_style to customize your display text. List of all possible tags can be found here