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

Possible to get positions of characters in a text layer?

Engaged ,
Apr 02, 2018 Apr 02, 2018

Copy link to clipboard

Copied

Hello. Is it possible to get position of each character in a text layer? I'm building words from individual characters (one per layer), but would like to obtain kerning from complete words.

TOPICS
Scripting

Views

1.2K

Translate

Translate

Report

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
Engaged ,
Apr 02, 2018 Apr 02, 2018

Copy link to clipboard

Copied

No, you can't (complain to Adobe!), but you could work around it in a script by adding letters to a text layer one by one and measuring the bounds.

Votes

Translate

Translate

Report

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
Engaged ,
Apr 03, 2018 Apr 03, 2018

Copy link to clipboard

Copied

That's what I was afraid of. This is a pretty obscure requirement, so I'm not holding my breath

Votes

Translate

Translate

Report

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
Engaged ,
Apr 03, 2018 Apr 03, 2018

Copy link to clipboard

Copied

Not really. Text layers in AE are really badly designed, the whole way the text is represented looks like they hot-glued some code from another app in.

Votes

Translate

Translate

Report

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 ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

I 2nd the improvement of text in after effects. Including the above request!

Votes

Translate

Translate

Report

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 ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

LATEST

Why do you want every letter on a separate layer? You can animate individual characters using one or more text animators. I can't imagine any animated text graphics that would require every letter to be on a separate layer.

 

If you absolutely must have every character on a separate layer, then you can use sourceRectAtTime() .width + a padding value to keep the space between letters constant and fake kerning. I'm not going to give you the expression, but it would start by looking at the layer above, taking the position of the first character, and the width + a padding value applied to the layer's position to make it work. 

 

Come to think of it; the expression is so simple I'll share it. The first letter would be on the bottom layer and have no expression. Here is the Position expression for each text layer above the first letter.

 

r = thisComp.layer(index + 1);
p = r.position;
pad = 20; // 20 pixel padding
w = r.sourceRectAtTime().width;
[p[0] + pad + w, p[1]]

 

The padding for a font with a point size of about 100 would be about 20. You'll have to adjust the pad for your font size. If you wanted to do the math, you could retrieve the font size from the SourceText property and divide that by some figure. Maybe I'll try that later. That could give you an animation preset that you could apply to multiple text layers.

 

You'll also need a way to make a space. The easiest way to do that would be to pick a character that you are not going to use, like a -. Write an expression for opacity that sets the opacity to 0 whenever the source text is a dash. That expression looks like this:

 

t = text.sourceText;
if (t == "-")
	0
else
	100

 

Those two expressions give you something like this. The position of the line depends on the position of the first character.

 

If you want more than one line you have to add another layer with a different position expression that uses sourceRectAtTime().height plus padding to offset the second line in Y by the height and a padding value equal to the amount of leading you need between the lines. A capital letter is going to require less padding than a lowercase letter like an 'e.' 

 

This is what that looks like:

RickGerard_0-1678428288839.png

I shared a project file if you want to fiddle around. 

Votes

Translate

Translate

Report

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