return absolute leading

Tagged: ,

This topic contains 2 replies, has 2 voices, and was last updated by  Raphael Freeman 5 days, 17 hours ago.

  • Author
    Posts
  • #92264

    I am writing my very first script (wish my luck) and I’m trying to return the leading of text that I have selected. The problem is that the leading happens to be set to Auto and I want it to return the absolute leading.

    This is what I typed:

    app.selection[0].leading;

    and it gave me AUTO instead of 15. (The leading happens to be 12/Auto but in the character panel it says (15pt)

    Is there a way to return 15?

  • #92265

    Loic Aigon
    Member

    Hello,

    Leading can either be a numeric value or an enumeration ( Leading.AUTO ) which you got.

    So you may want to check if leading is set that wey and if so compute the leading based on font size and autoLeading value:

    [pre]
    var sel = app.selection[0];
    var leading = sel.leading;
    leading==Leading.AUTO && leading = sel.pointSize*sel.autoLeading/100;
    alert (“leading is worth:”+leading );
    [/pre]

    FWIW

    Loic
    http://www.ozalto.com

  • #92267

    Thank you very much. I will try that.

You must be logged in to reply to this topic.