How to process runts using script instead grep in paragraph style

There are two terms referring to common text flow problems that occur in typesetting.

Widow — the last line of the paragraph at the beginning of the next page/column.

Orphan — the first line of the paragraph at the end of the page/column.

And now, in our time, when everyone began to use indesign, another term Runt appeared in typesetting — it was invented by David Blatner for a short single word in the last line of a paragraph.

What is special about this short word standing alone in the last line of a paragraph? Why did this topic arise? Some designers believe that such a short word spoils a page view, and we need to do something with it.

Resetting the “Hyphenate Last Word” checkbox on the “Hyphenation” tab in paragraph style settings will not help if this short word turned out to be entirely on one line.

A reasonable solution is to assign the “No break” attribute to the space before this word. All sites where this issue is discussed, everyone sees only one solution: use grep commands in paragraph style, only grep commands vary. And they agree to put up with the fact that the use of grep styles slows down the process of recalculating the layout. Although it is sometimes very noticeable.

But if we remember Apple's motto: Think different, and refuse to be obligated to do as everyone does, not to be such a conformist, then you can see another solution: use a script!

After all, this task to assign to some of the last spaces of the paragraph the attribute "No break" is needed only once. And if you do, like everyone who is in the trend of imposed solutions — add grep commands to the paragraph style — then each recalculation of the layout will look for these spaces again and again and confirm the already established attribute "No break". And this is a direct waste of time!

Therefore, it is more expedient to determine the paragraph style of the text, find spaces before the last word in the selected text with a script and assign the "No break" attribute to these spaces. This is a one-time text processing, grep search commands are not implemented in the paragraph style, which can potentially slow down the layout recalculation process.

This task is solved by the free script. The archive with this program must be unpacked in the user area of the scripts, then when you click on the cross in the header of the program window, its current settings will be remembered.

Archive (eng)
Archive (esp)

 

***

If you want to have this script with your language interface, this is very easy — it’s enough to translate 19 lines ms01-ms19, its are the first lines of this script.