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

Count the number of glyphs in a text layer

Explorer ,
May 27, 2021 May 27, 2021

Hi guys. I really hope someone can shed some light on this problem.

 

I am working with some arabic texts and I want to highlight words based on their position. I can count from end to start in order to reverse the animator but the thing is that JavaScript and after effects animator count the characters in a different way. So JavaScript .indexof() function does not count the characters in the same way that the animator range does.

 

Ex: if I use “لى” as text source, animator says it is 1 character while text.sourceText.length (of which count is similar to .indexof()) says it is 2. If I have one of two of this in my string, the whole thing works badly. Is there any way to either make the animator count this as 2 or make JS see it as one?

 

As a side information, I noticed that animator does the same thing for “fi” or other ligature in the fonts that have them. If your font has the “fi” ligature, AE counts it as one char. But activating or deactivating ligatures has no effect in the arabic text layer.

TOPICS
Expressions , Scripting
363
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

correct answers 1 Correct answer

LEGEND , May 27, 2021 May 27, 2021

I don't think so. Glyph substitution is handled automatically by the Adobe text engine and those functions are not exposed. Feel free to implement your own corrections by having a laist/ array somewhere that contains the most common ligatures/ contractions and that then could be checked for whatever the engine reports.

 

Mylenium

Translate
LEGEND ,
May 27, 2021 May 27, 2021

I don't think so. Glyph substitution is handled automatically by the Adobe text engine and those functions are not exposed. Feel free to implement your own corrections by having a laist/ array somewhere that contains the most common ligatures/ contractions and that then could be checked for whatever the engine reports.

 

Mylenium

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 ,
May 27, 2021 May 27, 2021
LATEST

If you always want to highlight entire words, maybe you can change your logic to count words instead of letters?

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
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