You have to edit a letterhead with a 2-lined address as footer. The updated address is longer and will take 3 lines, but the last (third) line of the new address must be at the same level as the last (second) line from the former address. In that case of course the address should already be in a text frame with bottom-aligned text (Text Frame Options > Vertical Justification > Align > Bottom) but the apprentice who took care of the previous edition had kept the default alignment set to "Top".

You may add manually a guide at the level of the last line, set the alignment to "Bottom" and bring up the frame to align approximately the last line to its former position, before editing the address, or you can use this script that enables to "copy-paste" the baseline (the vertical coordinate) of a selected text:

In the present case you only have to

  • select the last text line,
  • run the script that will open a new palette,
  • click the "Copy baseline" button,
  • change the text frame parameter to "Text Frame Options > Vertical Justification > Align > Bottom",
  • select the action "Move text frame vertically" in the drop down menu
  • and click the "Paste baseline" button.
copy paste baseline fr

The baseline (vertical coordinate) of a character is a property that is not displayed in the InDesign User Interface but exists in the InDesign JavaScript DOM where it is read-only, that makes sense because it results from many parameters. Hence the idea to make this property not only accessible but also writable by creating this palette that offers you various available actions to obtain the desired "baseline" value[1], acting on a single parameter at once. Thus you can in the current version:

  • Modify text frame minimum 1st baseline offset[2,
  • Modify text frame inset spacing,
  • Move text frame vertically,
  • Modify characters baseline shift,
  • Modify paragraph leading[2,
  • Modify paragraph space before/after,
  • Modify space after previous paragraph/space before next paragraph,
  • Resize text frame,
  • Scale text frame.

In some situations you will get an error message warning you that the desired baseline value is impossible to obtain by acting only on the selected parameter, for example when it would require to apply a negative value to it when it can be only zero or positive (ex: text frame minimum 1st baseline offset, paragraph space before/after) or when the tested modification would reduce the available space in the frame until producing overset text.

A number of actions among those available can be proceeded differently according to the reference point locator P RefPointLocator1 22x22 N position (in the Transform or Control panel): for example if you select the action "Resize text frame" you will resize the bottom of the frame if you set the reference point to top, or the top of the frame if you set the reference point to bottom (this choice is useful only when the 2 possibilities allow to influence the baseline, for example when the text is vertically centered in the frame), as well for the action "Modify paragraph space before/after" you will modify the space after if you set the reference point to top, or the space before if you set the reference point to bottom.

Note: this script only copes properly with straight horizontal text frames, it is not intended for the type on a path, nor for the transformed text frames, especially rotated.

[1] with a higher accuracy than the three decimals visible to the user in the InDesign interface: as every jsx script the precision is 15 digits with floating point, for example with a values between 10 and 99 millimeters the precision is 13 decimals, that is the order of magnitude of an atomic core.

[2] This script will also enable you to notice an InDesign limitation that is undocumented by Adobe: when you set to "0 pt" the leading of a text, the actual leading value is not zero but 0.01 pt (0.0035277777778 mm). Also if you try this setting «Text Frame Options > Vertical Justification > Align > Top; Baseline Options > First Baseline > Offset: Fixed, Min.: 0 pt», the first baseline value will not be actually at the level of the upper bound of the text frame but exactly 0.01 pt below.

No thoughts on “Copy-paste baseline”

Leave your comment

In reply to Some User



An original idea from Loic Aigon, designed by Eddy.VH. It 's a scripts library for Desktop Publishing Adobe products. Find Javascript for Photoshop, Illustrator, inDesign and Acrobat or ATN scripts ( Photoshop actions ) you need.