Line Spacing Calculations

Khaled Hosny khaledhosny at
Sat Aug 27 18:02:22 UTC 2016

On Fri, Aug 26, 2016 at 06:14:09PM +0000, Nate Bellowe wrote:
> - Word is using a different process than we are to calculate the
>   "leading" of a font. We don't parse the font files ourselves,
>   instead rely on libraries to get font sizing information, and
>   perhaps in the "world of font files" I am missing something, and
>   word is parsing the fonts directly and differently.

I have no insight on how Word might be calculating line spacing, but
this would be my first guess. Fonts has 3 different set of parameters
that can affect line height calculations and different applications can
use different parameters:
* sTypoAscender, sTypoDescender, and sTypoLineGap, from OS/2 table[1].
* usWinAscent and usWinDescent, also from OS/2 table.
* Ascender, Ascender and LineGap from hhea table[2].

Ideally applications should use the Typo set, falling back to the hhea
if OS/2 table is missing, but the reality is that many Windows
applications tend to abuse Win set for line spacing, and Mac
applications tend to prefer hhea one.

So for realistic comparison, you need to get the values of those three
sets of parameters and compare Word’s line spacing to them.



More information about the LibreOffice mailing list