On the Hidden “Em-Box” Option
December 31, 2019 | Tips | en
InDesign's TextFramePreference
object exposes a key, firstBaselineOffset
, which reflects the options available in the Baseline Options tab. In the Offset dropdown list, the user can choose among Ascent, Cap Height, Leading, x Height and Fixed. There is no other choice in this dialog:
But when you inspect the possible values of the FirstBaseline
enumerator, an extra option appears: EMBOX_HEIGHT
.
For some reason, this baseline offset mode is not visible in the UI although available in the scripting object model and fully functional in InDesign for a long time.
To assign the Em-Box offset to the first baseline of a text frame, just use the following code:
// Assuming a text frame is selected. var tf = app.selection[0]; const EMBOX = FirstBaseline.EMBOX_HEIGHT; tf.textFramePreferences.firstBaselineOffset = EMBOX;
Enjoy!