Skip to main content
dnyaneshlb
Known Participant
May 31, 2017
Question

How to get default font size of Illistrator

  • May 31, 2017
  • 0 replies
  • 520 views

Hi guys,

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;

if(fonts.isFontAvailable(app.textFonts.getCurrentFont()))

{

    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.

-Dnyanesh

This topic has been closed for replies.