# relation between leading and ascent/descent

Community Beginner ,
Oct 05, 2020 Oct 05, 2020

Copied

Hello,

I have been try to solve this for quite a while and I cannot make it work. Now I narroed it down to knowing the relation between leading and ascent/descent of a type.

I am trying to do an apparently simple thing.

I have three lines of text that I want to have highlighted with a colour background. Each line has a different charater height (12, 18, 8) and different lengths depending on the text. I created one paragraph style, I added 2mm before paragraph, and I made the paragraph shading...

I thought this would work because we are talking about adding 2mm to each paragraph independently of the height of the character... Wrong...

When I put the space before paragraph to zero it also (in my view) inconsistent.

I understand that the space is added to the leading. I assumed the ascent and descent of a type would be related to the leading and that would simply work out. I did not realize that if you have the descent of the smaller type on the top line will stay very distante from the ascent of the larger type on the line below.

A possible solution is to offset the baseline according to the fonte size, but for that you would need to know the relation between ascent/descent and the leading. Any idea?

Any other ideas?

Thanks, N

TOPICS
Type

Views

195

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Adobe Community Professional , Oct 06, 2020 Oct 06, 2020
Here‘s a JS version:     var gap = 5; var doc = app.documents.item(0); with(doc.viewPreferences){ horizontalMeasurementUnits = MeasurementUnits.POINTS; verticalMeasurementUnits = MeasurementUnits.POINTS; } var sel = doc.selection[0].paragraphs; for (var i = 1; i < sel.length; i++){ var d = sel[i-1].descent; var a = sel[i].ascent; sel[i].properties = {leading:d+a+gap} };

Likes

9 Replies 9
Oct 05, 2020 Oct 05, 2020

Copied

Since each paragraph has different point size for the text, this would be difficult to do with just one paragraph style. Instead, create a separate paragraph style for each paragraph. You will have more control using Paragraph Rules rather than Paragraph Shading because you will be able to adjust the Weight of the rule and it's Offset position.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 05, 2020 Oct 05, 2020

Copied

I assumed the ascent and descent of a type would be related to the leading and that would simply work out.

Leading is the distance between the text’s baselines—the ascenders and decenders are not considered.

This might help:

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 05, 2020 Oct 05, 2020

Copied

If I'm understanding what you're trying to do, you can adjust the leading of the second line to close up the space above (try starting with 14 points and adjust as needed).

The leading setting in InDesign doesn't take into account whether a line does or doesn't have ascenders or descenders, which is the same way that linespacing in Word and line height in HTML/CSS also work.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Oct 06, 2020 Oct 06, 2020

Copied

Thank you @Barbara Ash@rob day, and @David Popham,

My question was rather if there is a metric relation between leading and bounding box (distance between ascent and descent). My guess is that it will depend on each type of font.

In the meantime, I have "solved" my problem with my font by offseting the baseline with font pt's by 0.1mm, i.e. font size 8pt = 0.8mm offset; font size 12pt = 1.2mm offset; font size 18pt=1.8mm offset. So with paragraph shading set to baseline and leading, and paragraph before set to 1mm, it finally looks as expected.

@Barbara Ash, I did not know much about rules and is good to know (thank you) but your suggestion has two draw backs for me. One, it would work only on the first line of the paragraph. Two, it would still not solve the paragraph gap. The baseline offset and the paragraph shading gives full control and consistency on the gap between shading, independently of the paragraph sequence.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 06, 2020 Oct 06, 2020

Copied

Hi nsgma,

you may also consider to change the value for auto leading from default 120 % of point size to something else.

The value of auto leading is a property of the paragraph or the applied paragraph style.

Regards,
Uwe Laubender

( ACP )

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 06, 2020 Oct 06, 2020

Copied

You can get at the ascent and descent properties of text via scripting, so I think what you are looking for the ascent of the the line, plus the descent of the line above, plus the desired gap amount, equals the line’s leading.

So this AppleScript (OSX only) does that to the selected text putting a 5pt space between:

``````tell application id "com.adobe.indesign"
set g to 5
set properties of view preferences to {horizontal measurement units:points, vertical measurement units:points}
set x to object reference of every paragraph of selection

repeat with i from 2 to count of x
set d to descent of item (i - 1) of x
set a to ascent of item i of x
set properties of item i of x to {leading:d + a + g, space after:0, space before:0}
end repeat
end tell``````

Selecting the text and run the script:

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 06, 2020 Oct 06, 2020

Copied

Here‘s a JS version:

``````var gap = 5;
var doc = app.documents.item(0);

with(doc.viewPreferences){
horizontalMeasurementUnits = MeasurementUnits.POINTS; verticalMeasurementUnits = MeasurementUnits.POINTS;
}

var sel = doc.selection[0].paragraphs;

for (var i = 1; i < sel.length; i++){
var d = sel[i-1].descent;
var a = sel[i].ascent;
};  ``````

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Oct 21, 2020 Oct 21, 2020

Copied

Dear Rob

Thank you so much. I did not know you could script in Indesign and it opens a lot of possibilities (and rabit holes...).

For what I needed, the shift of the baseline worked since they were one-line captions, without text body following.

One question though, the script alters a selected text leading, or does it alter the paragraph style?

An done other question, when the font size is changed (or the fonte type), you need to run the script again?

Thank you, N

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 21, 2020 Oct 21, 2020

Copied

The script changes the one line paragraph’s leading—it could adjust the Baseline Shift, but that’s not necessary because changing the line’s Leading moves its baseline relative to the line above. You can get a font’s ascent descent measurements via scripting, but not the UI, so scripting the gap between the descent and ascent is going to be much more accurate than adjusting the Baseline Shift by eye.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Resources
Learn and Support
Resources
Features