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

Ability to set text style attributes with expressions per index/character instead of per layer

Community Beginner ,
Jun 16, 2023 Jun 16, 2023

Copy link to clipboard

Copied

Currently, I can read the style attributes per character using sourceTextProperty.getStyleAt(index). I should be able to set the styling in the same way, but instead you can only set it for the entire layer at once.  This would be a game-changer for MOGRTs and Essential Graphics as well, if I could copy the kerning from a live text layer and have it pass all that information to my EGP comp, it would be next level in terms of how much MOGRTs could accomplish.

 

For example, I have a stacked font that needs multiple layers to achieve the effect my client is looking for.  I also need to adjust leading/baseline shift etc, and doing this for each instance is repetitive and error-prone. If I could use a simple for-loop to copy this character by character this would significantly lessen the amount of work this takes.

 

Even better would be a set of additional methods that could set it all at once - something like .sourceText, but inclusive of all styling— .sourceTextAndStyle or something similar.

 

The following is how I could see this working:

 

var sourceTextProperty = thisComp.layer("SourceTextLayer").text.sourceTextAndStyle; //creates an exact copy of SourceTextLayer, which can then further be modified:
var newStyle = sourceTextProperty.getStyleAt(0,0);
newStyle.setStyleAt(0,5).setFont("Helvetica") .setBaselineShift(10);
//change the font from characters 0 - 5 to Helvetica with a baseline shift of +10

OR
var sourceTextProperty = thisComp.layer("SourceTextLayer").text.sourceText; 
var newStyle = sourceTextProperty.style;
for (i = 0; i < sourceTextProperty.length; i++){
   newStyle[i] = sourceTextProperty.style[i];
   //iterate through the style array and copy that style character-by-character.
}
newStyle.setFont("Helvetica");
//changes the font, but would keep all text attributes from sourceTextLayer intact.

 

I'm sure there are plenty of implementation details that I missed, but hopefully this gets the point across.

Idea Started
TOPICS
Expressions

Views

670

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

correct answers 1 Pinned Reply

Adobe Employee , Jun 18, 2024 Jun 18, 2024

Hi all,

We are happy to announce that this functionality is now available to try out in Public Beta. Full details can be found in the Beta forums: https://community.adobe.com/t5/after-effects-beta-discussions/now-in-beta-per-character-text-and-paragraph-styling-in-expressions/td-p/14624910 

 

Thanks again for your requests and input!

- John, After Effects Engineering Team 

Status Started

Votes

Translate

Translate
10 Comments
Explorer ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

It would be great to not only be able to use the "getStyleAt()" method, but also implement something like "setStyleAt()" in order to style portions of the text separately.

It would also help to be able to chain different styles together. Right now, it's impossible to do proper text styling with different style types programmatically. It would be incredibly helpful, especially for Templates / MOGRTs.

Votes

Translate

Translate

Report

Report
Engaged ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

Yes please

Votes

Translate

Translate

Report

Report
Explorer ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

Yes please. Any change to sourceText through scripting will lose all special character formatting in layer and set the formatting of first character to all characters in text layer.

This would unlock so many possibilities through scripting.

Votes

Translate

Translate

Report

Report
Explorer ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community Expert ,
Jun 16, 2023 Jun 16, 2023

Copy link to clipboard

Copied

Oh man, the amount of workarounds this would eliminate would be very tasty indeed.

Votes

Translate

Translate

Report

Report
Adobe Employee ,
Jun 21, 2023 Jun 21, 2023

Copy link to clipboard

Copied

This is for sure needed and on the list of feature requests for remaining text expressions to enable for users. 

In the meantime, there is this handy little workaround that was shared to me by a Mogrt Genius who was able to use Expression Selectors and some creative JavaScript to create a mark-up style way to do substring editing, i.e. make some letters bold, or subscript, or superscript. 
In the example shared in the attached file the end user simply puts special characters around the characters that they want to be bold within the text edit control. Por ejemplo, Dacia #loves# Mogrts would be rendered as Dacia loves Mogrts. 

 

Here's a link to a sample project with the expressions.

Hope this can help in the meantime,

Dacia

- Dacia Saenz, AE Engineering Team

Votes

Translate

Translate

Report

Report
Engaged ,
Aug 31, 2023 Aug 31, 2023

Copy link to clipboard

Copied

Yes, we need this! 

Votes

Translate

Translate

Report

Report
Explorer ,
Sep 11, 2023 Sep 11, 2023

Copy link to clipboard

Copied

A different potential approach that I believe could be just as useful would be if you simply had a Font property amongst the properties that can be added to text animators, ie. you would be able to define a range in which that font gets applied to the text, or use expression selectors for more complex application of a different font across a single text layer.

Votes

Translate

Translate

Report

Report
Explorer ,
Apr 15, 2024 Apr 15, 2024

Copy link to clipboard

Copied

Heya @DaciaSaenz, this script is similar to something I was working on... but unfortunately adding returns breaks it. This is also true in the file you shared. I've not been able to solve this issue. Any ideas how to deal with returns/line breaks?
Thanks.

Votes

Translate

Translate

Report

Report
Adobe Employee ,
Jun 18, 2024 Jun 18, 2024

Copy link to clipboard

Copied

LATEST

Hi all,

We are happy to announce that this functionality is now available to try out in Public Beta. Full details can be found in the Beta forums: https://community.adobe.com/t5/after-effects-beta-discussions/now-in-beta-per-character-text-and-par... 

 

Thanks again for your requests and input!

- John, After Effects Engineering Team 

Status Started

Votes

Translate

Translate

Report

Report