Text not rotating when using transform_angle


Hello everyone!

First of I’d like to thank the team of LVGL for putting together a very nice and easy to use graphics library!

I’m trying to rotate my text objects 90 degrees but only the other base object itself rotates while the text is frozen in place. I’ve tried the examples from the LVGL documentation (convert to image and rotate button object). Rotation works however if I use a png image converted to a C file with the image converter.

As far as I understand LVGL should be able to rotate any object using lv_style_set_transform_angle or lv_obj_set_style_transform_angle.

What MCU/Processor/Board and compiler are you using?

MCU is STM32H74743bit6 and compiler is GCC with West.

What LVGL version are you using?

Using Zephyr RTOS with Zephyr’s latest release of LVGL.

What do you want to achieve?

Rotating text 90 degrees clockwise in literally any way possible.

What have you tried so far?

As mentioned above I have tried copying the examples from the LVGL documentation.

Rotating a button with text inside it does nothing to either the object or the text.
Rotating an image with text as source (with LV_SYMBOL_DUMMY) rotates the actual container, but not the text itself.

In the example I’m using the basic lv_font_unscii_8. I’ve tried using both my own imported font Roboto and the default font Montserrat.

Code to reproduce

Below I’m using zephyr’s emulator. I get the same result when running it on harware.

static void spin(void *var, int32_t v)
    lv_obj_t *obj = var;
    lv_obj_set_style_transform_angle(obj, v, LV_PART_MAIN);

static void basic_rotation(void)
    lv_obj_t *scr = lv_obj_create(NULL);
    lv_obj_set_style_bg_color(scr, lv_color_hex(COLOR_WHITE), 0);

    static lv_style_t style;

    lv_style_set_size(&style, LV_SIZE_CONTENT);
    lv_style_set_bg_opa(&style, LV_OPA_COVER);
    lv_style_set_bg_color(&style, lv_color_hex(COLOR_PERI_YELLOW_CUSTOM));

    lv_obj_t *square = lv_img_create(scr);
    //lv_obj_set_style_text_font(square, &roboto_20_v8, 0);
    lv_img_set_src(square, LV_SYMBOL_DUMMY "ACCEPT");
    lv_obj_add_style(square, &style, 0);

    lv_obj_align(square, LV_ALIGN_CENTER, 0, 0);

    lv_anim_t anim;

    lv_anim_set_exec_cb(&anim, spin);
    lv_anim_set_time(&anim, 3000);
    lv_anim_set_repeat_count(&anim, LV_ANIM_REPEAT_INFINITE);
    lv_anim_set_var(&anim, square);
    lv_anim_set_values(&anim, 0, 3599);

Screenshot and/or video

This is the output of the image on the emulator. As you can see the text is frozen but the object itself is resizing itself as if the text is rotating.


Hi @Tilling ,

I am not sure this is currently possible. May be see this post for inspiration?