[softwarelist] Re: Leading calculation for lines of differing sizes

Hello, David,

Yes - I see now that it was my concept of "baseline" that was erroneous. I thought you were referring to the bottom of the text but it is in fact the line on which the body of the text sits in the conventional handwriting sense with the descenders falling below it. This also corresponds to that which I termed the "origin" of the font.

Absolute leading then sets the distance between the baselines.

Relative leading effectively just sets the incremental leading as a percentage of the upper line size so we can deal with these two together:-

If the determining nominal font height of the upper line is F1 and that of the lower line F2, incremental leading sets the distance between a point F1 above the upper baseline and a point F2 above the lower baseline. It is important to note that these points are above the top of the font by an amount equal to the maximum descender size. Also note that this uses the nominal font height which is not necessarily the same as the font bounding box height (which doesn't seem come into the calculations at all).

Then if x = maximum descender height / nominal font height, it is easy to show that the formula I gave in my first note viz.
L = incremental leading + x * ( F2 - F1 )
does in fact give the size of the "strip" between the two lines of text. For Homerton.Medium, x = 0.224 which is reassuringly close to my measured value of approximately 0.225. This formula is very useful because ( L + F2 ) is the total additional height actually used when the second line of text is added.

Just in case anyone's interested, if the two lines have differing determining fonts with x1 and x2 being the respective values of x as defined above, the formula generalises to
L = incremental leading + ( x2 *  F2 ) - ( x1 * F1 )

If you're still reading, you may like to know that the maximum descender height for the font was determined as the y0 value returned from font_stringbbox() given all characters from ASCII 33 to 255 and scaled for text of unit height. Some other values of x are:
  Trinity.Medium              0.226
  Corpus.Medium            0.2341
  Flourish.Condensed       0.325
so there is quite a variation - especially with fancy fonts.

Hope that helps.
Given in good faith; E & OE etc.

Regards
John Grogan




Other related posts: