Skip to main content
Participant
January 21, 2025
Question

How to get the mixed up character properties (normal font with superscript) from the same text layer

  • January 21, 2025
  • 1 reply
  • 215 views

Hi

 

is it possible to set superscript character in TextDocument by scripting?

I have TextLayer with text: 01st  03rd , this is downloaded from api url

And i want to set superscript for st and rd characters.

 

var textProp = layer.property("Source Text");
var textDoc = textProp.value;
textDoc.text = content.value;   // <--- here is value from api
textProp.setValue(textDoc);

 

thanks for your hints.

 

1 reply

Roland Kahlenberg
Legend
January 22, 2025

This thread has a few examples and a link to a video tutorial - https://community.adobe.com/t5/after-effects-discussions/tutorial-bold-part-of-a-text-layer-using-expressions/td-p/14973554 

What you should take note are the following - 
- this feature that allows multiple font styles per Text Layer is only available in the latest version of AE

- to implement this feature, you can write multiple setFont, setFontSize etc in the style definition statement. In previous versions of AE, you were only allowed to write a single instance of each Text Style in the style definition statement.

- you use a range to define which parts of the Text String gets styled differently from the Base Style. The Base Style is the style that affects the entire Text String. You do not have to define a range for the Base Style.

- the defined range requires a start index and a length.

HTH


Very Advanced After Effects Training | Adaptive &amp; Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV
vi_2372Author
Participant
January 22, 2025

thanks for reply, yes, I am using latest AE version.

 

I know how to do this manually in AE, what I want to do it to add it from AE script and I did not found the way how to add expressions property to existing TextLayer/TextDocument (the action Alt + click on the Stopwatch icon on your video link).

 

I cannot do changes in this AE project layers, I am not even this AE project owner, just I want to help with scripting to pre-fill some text parts from api.

 

I left it now for manual action to the project editor, after api data are loaded.