Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
I've moved your question to the InDesign Scripting forum. If this is possible, it will be by using a script.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Clever.
Copy link to clipboard
Copied
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).
Copy link to clipboard
Copied
Big Thanks for help! It works!
Copy link to clipboard
Copied
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;
Copy link to clipboard
Copied
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).
Copy link to clipboard
Copied
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;
Copy link to clipboard
Copied
Kai,
Great! Works fine for me! I'm sure Aleko will be glad!
Copy link to clipboard
Copied
A little comment: maybe the script does not need to include the first line (its leading does not need to change).
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi Kai,
Cool! Works very fine!
Copy link to clipboard
Copied
Great, so whatever is the right or helpful answer here, some should mark this thread as answered ๐
Copy link to clipboard
Copied
Totally! But it's not me who post the question !!
Copy link to clipboard
Copied
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
Find more inspiration, events, and resources on the new Adobe Community
Explore Now