cancel
Showing results for 
Search instead for 
Did you mean: 

Rotate text at any angle

UVett.1
Associate II

Currently it seems that text can only be rotated by a multiple of 90 °. In a current project, however, I have a customer requirement that text must be rotated by any angle, since the display must be mounted rotated. What would be the best approach to implement this in the current circumstances?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

Here is a demo I made a while back using a custom widget called TextArc which can rotate a text at any angle but also around a circle or a curve. Have a look at the implementation in Screen1View.cpp/hpp and at the code of the widget in TextArc.cpp/hpp in the TouchGFX/widgets folder. The demo was made for a STM32L4R9-dk board but that doesn't change anything in the code :thumbs_up:

Since this is a custom widget you will not be able to see it in TouchGFX Designer, which is why I use what I call "dummies" (the red circle and box) to help me set the coordinates and angles.

/Romain

View solution in original post

6 REPLIES 6
Romain DIELEMAN
ST Employee

Hi,

Is the text already known and will not change ? With this scenario you take an image of the text and use it with a texture mapper widget.

Otherwise I have a custom widget that does this but I am not 100% sure I can share it, I need to check.

/Romain

UVett.1
Associate II

Hi,

thank you very much for your reply! In my current implementation I am using images of the text and rotate it with a texture mapper widget, exactly as you suggested. But this is not a good solution, especially since I am dealing with instances of the TextAreaWithOneWildcard class (so dyanmic text), and because the angle must be adjustable. So my first thought was that it might be possible to access the pixel data of the TextArea instance directly, rotate it with the use of a suitable rotational matrix and write it directly to the framebuffer (or a dynamic bitmap, or whatever the suitable approach would be). I would be very grateful for any help.

Ulrich

Hi,

Here is a demo I made a while back using a custom widget called TextArc which can rotate a text at any angle but also around a circle or a curve. Have a look at the implementation in Screen1View.cpp/hpp and at the code of the widget in TextArc.cpp/hpp in the TouchGFX/widgets folder. The demo was made for a STM32L4R9-dk board but that doesn't change anything in the code :thumbs_up:

Since this is a custom widget you will not be able to see it in TouchGFX Designer, which is why I use what I call "dummies" (the red circle and box) to help me set the coordinates and angles.

/Romain

Dear Romain,

thank you very much for your help! Hope these features will find their way into the framework.

Ulrich

I'm pushing for it ;)

/Romain

scottSD
Lead

@Romain DIELEMAN​ 

This is a pretty cool widget. Great job!

I second the vote to get it into the designer/framework.