I am in process of writing a script which create text frames in AI document. I want to apply same font style as that of what user have selected.
e.g If user selects font as Papayrus and size as 36, and runs the script. All text frames created with this script should have same style as user have selected before running script.
Below is my script.
var doc = app.activeDocument;
//var ss = app.textFonts;
var txt = doc.textFrames.add();
txt.contents = "adobe Illustrator";
txt.top = -100;
txt.left = 100;
var fonts = app.textFonts;
var ff = fonts.getFontByName(app.textFonts.getCurrentFont());
txt.textRange.textFont = ff;
txt.textRange.characterAttributes.size = 36;
I could get user selected font but not the size?
Thanks in advance.
Retrieving data ...