Skip to main content
Participating Frequently
October 18, 2023
Question

Controlling text direction property through expression?

  • October 18, 2023
  • 1 reply
  • 1309 views

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 has been closed for replies.

1 reply

ShiveringCactus
Community Expert
Community Expert
October 18, 2023

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.

 

lofloflofAuthor
Participating Frequently
October 18, 2023

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.