[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] Rounding of ascent, descent, and line height

From: Behdad Esfahbod
Subject: Re: [ft-devel] Rounding of ascent, descent, and line height
Date: Thu, 10 Jan 2013 15:07:32 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

On 13-01-10 03:03 PM, Alexei Podtelezhnikov wrote:
> On Thu, Jan 10, 2013 at 1:38 PM, Behdad Esfahbod <address@hidden> wrote:
>> Hi,
>> There's a bug against Webkit:
>> that I think points to a problem in FreeType.  Simply put: for fonts that 
>> have
>> ascent+descent=line-height, this property may not hold anymore after hinting.
>>  ascent+descent may be off by one pixel compared to line-height, which is not
>> quite desirable.
> If I understand correctly that equality is broken only in the broken
> fonts.

Really?  I thought it happens because FreeType separately rounds ascent,
descent, and line_height.  From the bug:

    metrics->ascender    = FT_PIX_CEIL( FT_MulFix( face->ascender,
                                                   metrics->y_scale ) );

    metrics->descender   = FT_PIX_FLOOR( FT_MulFix( face->descender,
                                                    metrics->y_scale ) );

    metrics->height      = FT_PIX_ROUND( FT_MulFix( face->height,
                                                    metrics->y_scale ) );

    metrics->max_advance = FT_PIX_ROUND( FT_MulFix( face->max_advance_width,
                                                    metrics->x_scale ) );
#else /* !GRID_FIT_METRICS */

> So have you tried just forcing it?
> metrics->height      = metrics->ascender + metrics->descender;
> If the height is more trustworthy, force the ascender:
> metrics->ascender  = metrics->height + metrics->descender;

Webkit did end up working around it.  I was being a good citizen and bringing
up the issue upstream.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]