Skip to main content
lofloflof
Participating Frequently
Oct 18, 2023 12:27 PM UTC
Question

Controlling text direction property through expression?

Hi folks,

I need to control the text direction (LTR / RTL) with an expression. Yet I cannot find the property in the reference. I reckon it's just not possible, but just to be sure, I wanted to ask ...

 

Any tipps very much appreciated!

 

Thanks and cheers from Berlin

Flo

This topic is closed to new replies. Start a new post to keep the conversation going.

9 replies

ShiveringCactus
Community Expert
Community Expert
Oct 18, 2023 1:16 PM UTC

Apologies if this is way off, but I think I'd use 

var myTextArray = text.sourceText.split("");
var reversed = myTextArray.reverse();
var newText = reversed.join("");
newText;

 

You can write this more efficiently (I think), but the shows the steps involved.  You create an array of the characters in the text, reverse the order of that arrange, then join them back into a new string.

 

Translate
lofloflof
lofloflofAuthor
Participating Frequently
Oct 18, 2023 1:20 PM UTC

Hi @ShiveringCactus and thanks for your proposal!
If it was only about reversing the text, I think you approach might work. But theres more to it: RTL text is rendered differently, e. g. with arabic fonts. Hence your solution doesn't help for what I need to do, alas.

Translate