Issue 73811 - External Leading is incorrectly calculated
Summary: External Leading is incorrectly calculated
Status: CLOSED DUPLICATE of issue 60945
Alias: None
Product: gsl
Classification: Code
Component: code (show other issues)
Version: OOo 2.1
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: hdu@apache.org
QA Contact: issues@gsl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-24 00:50 UTC by akrioukov
Modified: 2007-01-31 16:02 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description akrioukov 2007-01-24 00:50:14 UTC
One more problem related with vcl/source/glyphs/gcach_ftyp.cxx. I noticed the
following piece of code:

        if( pHHEA != NULL )
        {
            // extleading formula from www.microsoft.com/typography/otspec/recom.htm
            int nExtLeading = pHHEA->Line_Gap;
            nExtLeading -= (pOS2->usWinAscent + pOS2->usWinDescent);
            nExtLeading -= (pHHEA->Ascender - pHHEA->Descender);
            if( nExtLeading > 0 )
                rTo.mnExtLeading = (long)(nExtLeading * fScale + 0.5);
        }

Frankly speaking, I don't understand how this code may correspond to the
referenced page of specification, which actually recommends the following
formula for calculating external leading:

MAX(0, LineGap - ((usWinAscent + usWinDescent) - (Ascender - Descender)))

As far as I can see, the problem lies in the extra pair of parentheseis: the
specification recommends to subtract the difference of (usWinAscent +
usWinAscent) and (Ascender - Descender) from LineGap, while in the current code
both these values are subtracted sequentially. Such method of calculation seems
to make no sense, as it will almost certainly result into a negative value, thus
making the whole piece of code unusable.
Comment 1 hdu@apache.org 2007-01-24 07:50:06 UTC
Yes, see
http://gsl.openoffice.org/source/browse/gsl/vcl/source/glyphs/gcach_ftyp.cxx?r1=1.133&r2=1.134
for the fix. It is in development releases >=SRC680_m193 and will be in OOo 2.2.

*** This issue has been marked as a duplicate of 60945 ***
Comment 2 hdu@apache.org 2007-01-31 16:02:51 UTC
Closing duplicate issue.