freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] Differences in metrics between WINDOWS and FREETYPE


From: David Turner
Subject: Re: [Devel] Differences in metrics between WINDOWS and FREETYPE
Date: Sun, 07 Oct 2001 14:52:19 +0200

Hello Stefan,

> Hi,
> 
> Is this a Bug???????
> 
> I have differences in metrics (ascender, descender and external leading)
> between windows API and freetype API. Especially with Times New Roman at
> 300dpi.
> 
> Here is what i get:
> 
>                      freetype         Windows
> 
> 12PT    descender:      11              12
>             ext. lead.:      1               2
> 
> 10PT    ascender:       37              38
>            descender:       9              10
> 
> I also had differences with Arial 12Pt external leading (1 <-> 2). But this
> was fixed, when
> I upgraded from version 2.0.1 to 2.0.4.
> So i think this could be a bug or is there a flag that influences
> computation of metrics.
> It would be nice if you can help me.
>

Actually, this may be a hard problem. It seems that many fonts do not
respect the TrueType specification to the letter when specifying the
ascent/descent/line_gap in font files..

It is not unusual to find some fonts where the information is 0 or
simply invalid, and it seems that Windows uses some sort of voodoo
to "guess" correct values.

Some "guesses" have been included in recent versions of FreeType,
based on metrics that I gathered for Arial and Times New Roman,
the code is actually in function SFNT_Load_Face of file src/sfnt/sfobjs.c:

        /* if the line_gap is 0, we add an extra 15% to the text height --  */
        /* this computation is based on various versions of Times New Roman */
        if ( face->horizontal.Line_Gap == 0 )
          root->height = (FT_Short)( ( root->height * 115 + 50 ) / 100 );

however it seems that you discovered some new dark spots, and I don't have
any simple solution for now.. the problem might come from rounding errors,
for example, when computing the "y_scale" and "x_scale" each time
FT_Set_Pixel_Sizes or FT_Set_Char_Size are called, however some extensive
testing is required to be certain of that..

I don't have the time to do it right now, however, if you wish to spend
a few hours to solve the problem, I could give you direction (i.e. patches
to apply and test) if you want..

Regards,

- David



reply via email to

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