emacs-devel
[Top][All Lists]
Advanced

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

Re: Redisplay issue


From: YAMAMOTO Mitsuharu
Subject: Re: Redisplay issue
Date: Mon, 07 Dec 2015 12:33:22 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shij┼Ź) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Sat, 5 Dec 2015 16:49:29 -0800, Yuan MEI <address@hidden> said:

>>> Maybe one font backend rounds the fractional metrics values but
>>> the other truncates them?
>> 
>> Could be.  Yuan, could you try these changes, and see if the
>> dimensions of the Cairo frame become identical to that of the
>> non-Cairo build?

> I tried the patch.  However Cairo frame and non-Cairo frame still
> differ by the same amount as reported before.

So, rounding has nothing to do with the difference you observe.

It seems that freetype has two types of structures containing metrics
values (ascender, descender, height): FT_FaceRec and FT_Size_Metrics.
ftfont.c uses the former for scalable fonts and the latter for the
other cases.

ftfont.c in Emacs:

  if (scalable)
    {
      font->ascent = ft_face->ascender * size / upEM + 0.5;
      font->descent = - ft_face->descender * size / upEM + 0.5;
      font->height = ft_face->height * size / upEM + 0.5;
    }
  else
    {
      font->ascent = ft_face->size->metrics.ascender >> 6;
      font->descent = - ft_face->size->metrics.descender >> 6;
      font->height = ft_face->size->metrics.height >> 6;
    }

libXft internally uses the latter only.

xftfreetype.c in libXft:

    if (fi->transform)
    {
/* snip */
    }
    else
    {
        descent = -(face->size->metrics.descender >> 6);
        ascent = face->size->metrics.ascender >> 6;
        if (fi->minspace)
            height = ascent + descent;
        else
            height = face->size->metrics.height >> 6;
    }
    font->public.ascent = ascent;
    font->public.descent = descent;
    font->public.height = height;

I don't know which is correct/appropriate.  At least, there is a case
that these two kinds of values are different.

                                     YAMAMOTO Mitsuharu
                                address@hidden



reply via email to

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