Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Espaรฑol
      • Franรงais
      • Portuguรชs
  • ๆ—ฅๆœฌ่ชžใ‚ณใƒŸใƒฅใƒ‹ใƒ†ใ‚ฃ
  • ํ•œ๊ตญ ์ปค๋ฎค๋‹ˆํ‹ฐ
0

Automatically increasing leading in paragraph line by line

Guest
Mar 22, 2014 Mar 22, 2014

Here is the question: could I in InDesign CS6 automatically increase lieading (line spacing) in paragraph line by line? What I mean is for example first line goes with lieading = 5.5 pt, next with 6.5 pt, third with 7.5 pt and so on. Is it possible somehow or it could be done only manually?

Thanks for the answers,

Aleko

TOPICS
Scripting
2.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 22, 2014 Mar 22, 2014

I've moved your question to the InDesign Scripting forum. If this is possible, it will be by using a script.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Mar 22, 2014 Mar 22, 2014

Peter may have missed a trick here. It should be possible by setting up a bunch of character styles with your required leading. Then create a paragraph style that uses Nested Line Styles. For each line, apply the character style with the required leading.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 22, 2014 Mar 22, 2014

Clever.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 22, 2014 Mar 22, 2014

Hi,

It's easy to do it:

Put the point insertion in the last line of the paragraph and then, until the 1st line of the paragraph is selected, play (on MAC):

Cmd-Shift-ยง

Alt-Down arrow

Shift-Up arrow

Alt-Down arrow

Shift-Up arrow

Alt-Down arrow

Shift-Up arrow

Alt-Down arrow

Shift-Up arrow

Alt-Down arrow

Shift-Up arrow

Alt-Down arrow

Shift-Up arrow

Alt-Down arrow

Shift-Up arrow

Alt-Down arrow

Shift-Up arrow

Alt-Down arrow

Shift-Up arrow

...

If you're lazy like me, and hurry, you can still create a small process with QuicKeys (2 minutes to do it). 

Capture dโ€™รฉcran 2014-03-22 ร  13.19.07.png

Capture dโ€™รฉcran 2014-03-22 ร  13.19.34.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 23, 2014 Mar 23, 2014

Big Thanks for help! It works!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 23, 2014 Mar 23, 2014

I wrote yesterday some scriptlines. Sadly the forum was down, so I could not post it.

First, there must be always checked, if the right preferences are turned off, otherwise all those tricks here wonโ€™t work. The script assumes, that the cursor is placed in the paragraph.

var curDoc = app.activeDocument;

var leadingPref = curDoc.textPreferences.useParagraphLeading;

curDoc.textPreferences.useParagraphLeading = false;

var curSel = app.selection[0];

var para = curSel.paragraphs[0];

var allLines = para.lines;

for ( var i = 0; i < allLines.length; i++ ) {

    var curLine = allLines;

    curLine.leading = 10 + i; // your leading value >> i means in this case increase every line to 1 more

}

curDoc.textPreferences.useParagraphLeading = leadingPref;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 23, 2014 Mar 23, 2014

Hi Kaรฏ,

Excellent! 

This script would be even better if it is based on ID prefs incrementing settings and takes account any leading (auto or not).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 23, 2014 Mar 23, 2014

Hi,

it seems, that auto is a bit tricky and it needs a pointSize-reference of a character or insertionPoint for that. If this is not correct, maybe someone could correct me here.

However: I took this value from every first character in a line.

Do the following lines work for you?

var curDoc = app.activeDocument;

var textPrefs = curDoc.textPreferences;

var leadingPref = textPrefs.useParagraphLeading;

var counter = textPrefs.leadingKeyIncrement;

textPrefs.useParagraphLeading = false;

var curSel = app.selection[0];

var para = curSel.paragraphs[0];

var allLines = para.lines;

for ( var i = 0; i < allLines.length; i++ ) {

    var curLine = allLines;

    var c = curLine.characters[0];

    if ( curLine.leading == Leading.AUTO ) {

        var lg = c.pointSize * ( c.autoLeading/100 );

    }

    else {

    var lg = curLine.leading;

    }

    curLine.leading = lg + ( counter * (i+1) );

}

textPrefs.useParagraphLeading = leadingPref;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 23, 2014 Mar 23, 2014

Kai,

Great! Works fine for me! I'm sure Aleko will be glad! 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 23, 2014 Mar 23, 2014

A little comment: maybe the script does not need to include the first line (its leading does not need to change).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 24, 2014 Mar 24, 2014

Try this one:

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

if ( app.selection[0].constructor.name != "InsertionPoint" ) {

    ( alert ( "Put the insertion point in the paragraph!" ) );

    exit();

}

var curDoc = app.activeDocument;

var textPrefs = curDoc.textPreferences;

var leadingPref = textPrefs.useParagraphLeading;

var counter = textPrefs.leadingKeyIncrement;

textPrefs.useParagraphLeading = false;

var curSel = app.selection[0];

var para = curSel.paragraphs[0];

var allLines = para.lines;

for ( var i = 0; i < allLines.length; i++ ) {

    var curLine = allLines;

    var c = curLine.characters[0];

    if ( curLine.leading == Leading.AUTO ) {

        var lg = c.pointSize * ( c.autoLeading/100 );

    }

    else {

    var lg = curLine.leading;

    }

    curLine.leading = lg + ( counter * i ); // when the first line should change too: counter * (i+1)

}

textPrefs.useParagraphLeading = leadingPref;

best

Kai

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2014 Mar 24, 2014

Hi Kai,

Cool! Works very fine! 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 24, 2014 Mar 24, 2014

Great, so whatever is the right or helpful answer here, some should mark this thread as answered ๐Ÿ˜‰

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2014 Mar 24, 2014

Totally! But it's not me who post the question !! 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 24, 2014 Mar 24, 2014
LATEST

Wow! Big thanks! It was awesome! As I am new here how it would be done - to mark this thread as answered, did some search, but cant't find the magic button

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines