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.