PDA

View Full Version : What is the line spacing



smoozer
9th September 2009, 15:35
Hi All,

I want to know what the line spacing is, and how is it calculated? I investigate Qt4 source codes, but I have no idea yet.

Example text:
Touch go to start
Press button to continue

The line spacing is:
From the bottom of the g in the first line to the top of the P in the second line, OR
From the bottom of the T of the first line to the top of the P of the second line?

And how does QT4 calcuate this value?

Thanks!

Lykurg
9th September 2009, 15:46
Hi All,

I want to know what the line spacing is

Search for leading. Then you will quickly figure out what line spacing means in typographie.


, and how is it calculated? I investigate Qt4 source codes, but I have no idea yet.

Example text:
Touch go to start
Press button to continue

The line spacing is:
From the bottom of the g in the first line to the top of the P in the second line, OR
From the bottom of the T of the first line to the top of the P of the second line?

And how does QT4 calcuate this value?

Thanks!

I haven't looked up the sources, but Qt should use QFontInfo for getting the height of a font and then calculating the spacing. Depending on the factor you have set.

smoozer
9th September 2009, 16:15
Search for leading. Then you will quickly figure out what line spacing means in typographie.



I haven't looked up the sources, but Qt should use QFontInfo for getting the height of a font and then calculating the spacing. Depending on the factor you have set.

Thank you. I found this figure, and know exactly what the property of one font.
http://caterpillar.onlyfun.net/Gossip/Qt4Gossip/images/QPainter-2.jpg

There is one question about leading:
QFixed QFontEngineWin::leading() const
{
return tm.w.tmExternalLeading;
}

The tm.w.tmExternalLeading is always 0 when I debug. Is that the leading in the figure above. And there is one member tm.w.tmInternalLeading, I think, it's the exact leading value. But no witness in source codes. Any idea? Thanks.

wysota
9th September 2009, 16:26
How about looking at QFontMetrics::leading() and QFontMetrics::lineSpacing()?