0 Replies Latest reply on May 31, 2017 2:43 AM by dnyaneshlb

    How to get default font size of Illistrator

    dnyaneshlb Level 1

      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;
          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.