Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
2

Controlling text direction property through expression?

Explorer ,
Oct 18, 2023 Oct 18, 2023

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

TOPICS
Expressions
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 18, 2023 Oct 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.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 18, 2023 Oct 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 18, 2023 Oct 18, 2023

About your hunch to write it more efficiently: I think this should be equivalent to your code:

text.sourceText.split("").reverse().join("");

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 18, 2023 Oct 18, 2023

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 18, 2023 Oct 18, 2023

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 18, 2023 Oct 18, 2023

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 18, 2023 Oct 18, 2023

Using two textlayers is exactly what I'm trying to overcome …

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 25, 2023 Oct 25, 2023

Anyone? Is there a way to set text direction through an expression?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 29, 2024 Aug 29, 2024
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines