Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
About your hunch to write it more efficiently: I think this should be equivalent to your code:
text.sourceText.split("").reverse().join("");
Copy link to clipboard
Copied
I worried that Arabic might be your use case and I'm not sure what's required for that. I found this video, does it help:
https://www.youtube.com/watch?v=q9UNCEGKALA
And yes, that's the more efficient way to write my code. I quite like laying everything out so it's easier for a beginner to follow, but I think you got it.
Copy link to clipboard
Copied
Thank you @ShiveringCactus !
My question relates more to expresions.
I know how to write Arabic in AE, but IO wonder if I can set the text direction dynamically.
Copy link to clipboard
Copied
I think I'm starting to understand, but I can't find anything to help as a direct expression. However, have you considered making an Essential Graphics comp with two text layers and a checkbox? The checkbox could control the visibility of each text layer, with each set to a different text direction.
Copy link to clipboard
Copied
Using two textlayers is exactly what I'm trying to overcome …
Copy link to clipboard
Copied
Anyone? Is there a way to set text direction through an expression?
Copy link to clipboard
Copied
Im serarching exactly for this too... But, its just impossible for sure. Adobe themself should add this feature. They added that into scripting, in the latest version of AE, who knows, maybe sometime they add it to expressions.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more