1 Reply Latest reply on Sep 7, 2009 2:36 AM by [Jongware]

    Font Spacing and Line Spacing

    goh6613

      hi all

       

      may i know that how can i set the font spacing (space between 2 font) and line spacing (space between 2 line) using indesign script

       

      please kindly provide me example if possible

       

      thanks

        • 1. Re: Font Spacing and Line Spacing
          [Jongware] Most Valuable Participant

          There is no spacing between 2 fonts. I can't even begin to imagine what you could mean by that.

           

          "Line spacing" is called "leading" in InDesign ("Line Spacing" is generally understood as a multiplier of the 'regular' leading, as in "line spacing: double"). Searching this in the ExtendScript Toolkit Help returns a lot of items, which all have one thing in common: it seems to be a property of objects of type 'Text'.

           

          Knowing that, there are a million ways to read and set the leading, for example, on some specific characters:

           

          app.selection[0].parentStory.characters.itemByRange(5,10).leading = "12pt";

           

          This is not very useful, as you can see when you do this with InDesign itself. Usually leading is applied to entire paragraphs:

           

          app.selection[0].parentStory.paragraphs[2].leading = "5mm";

           

          or even entire text frames:

           

          app.activeDocument.textFrames[0].paragraphs.everyItem().leading *= 2.0;

           

          (this last one doubles existing leading).

           

          "Leading" is a special property, in the sense it might have two entirely different values. Either it's a regular numeric value -- a measurement in points, or given explicitly (as above in the '5mm' example) --, or it's a special constant named "Leading.AUTO". This "value" corresponds to the "Auto Leading" in the user interface; you assign it just like the other 'real' values.

           

          app.activeDocument.stories[0].leading = Leading.AUTO;