-
How do you adjust the styles of a text layer on a per character basis?
I’m using a script to import a subtitles from an SRT file so I can bake subtitles into my video. The script works by reading the subtitle file and creating markers on a text layer at the proper timecode containing the actual text for the subtitle. Then there is an expression on the “Source Text” property actually display the imported subtitle based on the nearest marker.
n = 0; t = 0;
mySubtitle=""if (marker.numKeys > 0) {
n = marker.nearestKey(time).index;
if (marker.key(n).time > time) n--;
}if (n > 0)
mySubtitle=marker.key(n).comment;mySubtitle;
However, it seems to lack the ability to properly process <b></b> and <i></i> tags in my subtitle file. I’d like to add that functionality but I’m not sure how to modify these properties on a per character basis.
I understand how to write the code to parse the mySubtitle string to strip out the tags and store the start/end locations of the characters to modify their style but I can’t figure out how to actually make a section of text bold or italics accordingly.
is there some sort of
mySubtitle[start,end].font.style.bold=truefunctionality? I assume it’s possible to adjust font styles on a per character basis because I can manually do it by making selections and adjusting settings in the character window but I can’t find how to do it in the AE CS6 Scripting Guide.
or
mySubtitle[start,end].font.style.italics=true