You must be logged in to post Login

Search Forums:


 






Resize selected line height / spacing

UserPost

3:55 pm
October 5, 2011


u-s-m

Germany

New Member

posts 2

I'm looking for a posibility to resize quickly the line height / spacing of a selected text by one or more points without resizing all line heights / spacings to the same point size. I need to find a plugin or a script that allows to resize the line height / spacing of a text selection and must handle different sized text and line heights / spacings in the selection.

There exists a script written by Thomas Silkjær for resizing text heights in the same manner. Unfortunately I didn't found someting similar for line heights / spacings and I don't know nothing about scripting to adapt Thomas' script.

Maybe somebody can help? Thanks in advance from Germany!


10:32 am
October 6, 2011


David Blatner

Admin

posts 823

The best way to do this is to use the keyboard shortcuts. For example, select the text and press command-shift-. (period/dot). That will increase all text by 2 points. If you want it to change by a diferent value, you can change this in the Units & Increments pane of the Preferences dialog box.

Another option is to use Blatner Tools (blatnertools.com), which has a panel and keyboard shortcuts that let you change this (and other values, such as indents) much faster than using preferences.

co-host, InDesignSecrets.com

10:33 am
October 6, 2011


David Blatner

Admin

posts 823

Oh, wait… I misunderstood. You mean changing leading! Yes, the same answer, but the shortcut is option/alt-Up or Down Arrow (on the keyboard).

co-host, InDesignSecrets.com

11:13 am
October 6, 2011


Kasyan Servetsky

Kiev, Ukraine

Member

posts 65

I don't know why you might want to do this by script, but here it is:


Main();

function Main() {
    if (app.documents.length == 0) {
        alert ("Please open a document, select some text, and try again.");
        exit();
    }
    else if (app.selection.length > 1 || app.selection[0].hasOwnProperty("baseline") == false) {
        alert ("Please select some text, and try again.");
        exit();
    }
        
    var the_document = app.documents[0];
    var the_selection = app.selection[0];

    var the_dialog = app.dialogs.add({name:"Change leading in the selected text"});
    with(the_dialog.dialogColumns.add()){
        with(dialogRows.add()){
            staticTexts.add({staticLabel:"Change leading in the selected text by"});
            var increase_by = measurementEditboxes.add({editUnits:MeasurementUnits.POINTS, editValue:0});
        }
    }
    var dialog_result = the_dialog.show();
        
    if (dialog_result) {
        if (the_selection.leading != Leading.AUTO) {
            the_selection.leading = the_selection.leading + increase_by.editValue;
        }
        else {
            the_selection.leading = (the_selection.pointSize * (the_selection.autoLeading/100)) +  increase_by.editValue;
        }
    }
}

Written in CS5.5, Windows.

Warning: it's not totally tested — just a quick exercise in scripting before going to bed.

Make sure that Preferences > Type > Apply Leading to Entire Paragraphs should be off.

Regards,
Kasyan

5:50 am
October 7, 2011


u-s-m

Germany

New Member

posts 2

Hi David, hi Kasyan,

thanks for your help – the shortcuts are that what I have searched for. I'm working since version 2.0 with ID but until now I didn't knew them. They will make my life easier. Thanks again and regards from Germany!