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: Sat, 05 Dec 2015 09:25:46 +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 Fri, 04 Dec 2015 11:47:23 +0200, Eli Zaretskii <address@hidden> said:

>> Date: Fri, 04 Dec 2015 10:05:14 +0100
>> From: martin rudalics <address@hidden>
>> CC: Eli Zaretskii <address@hidden>, emacs-devel <address@hidden>
>> 
>> > Without cairo:
>> >
>> > 17 (#o21, #x11, ?\C-q)
>> >
>> > With cairo:
>> >
>> > 16 (#o20, #x10, ?\C-p)
>> 
>> So it's the Cairo font backend.  59 text lines plus one menu bar line
>> give the 60 pixels difference.

> I don't understand how can it do that with the same size of the same
> font.  Some bug in ftcrfont.c, perhaps?

Maybe one font backend rounds the fractional metrics values but the
other truncates them?

                                     YAMAMOTO Mitsuharu
                                address@hidden

diff --git a/src/ftfont.c b/src/ftfont.c
index 17e41a9..c10d4ad 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -1159,6 +1159,12 @@ ftfont_list_family (struct frame *f)
 }
 
 
+/* Operators for 26.6 fixed fractional pixel format */
+
+#define FLOOR(x)    ((x) & -64)
+#define CEIL(x)            (((x)+63) & -64)
+#define ROUND(x)    (((x)+32) & -64)
+
 Lisp_Object
 ftfont_open2 (struct frame *f,
               Lisp_Object entity,
@@ -1237,9 +1243,9 @@ ftfont_open2 (struct frame *f,
     }
   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;
+      font->ascent = ROUND (ft_face->size->metrics.ascender) >> 6;
+      font->descent = - ROUND (ft_face->size->metrics.descender) >> 6;
+      font->height = ROUND (ft_face->size->metrics.height) >> 6;
     }
   if (INTEGERP (AREF (entity, FONT_SPACING_INDEX)))
     spacing = XINT (AREF (entity, FONT_SPACING_INDEX));
@@ -1252,7 +1258,7 @@ ftfont_open2 (struct frame *f,
       )
     font->min_width = font->average_width = font->space_width
       = (scalable ? ft_face->max_advance_width * size / upEM + 0.5
-        : ft_face->size->metrics.max_advance >> 6);
+        : ROUND (ft_face->size->metrics.max_advance) >> 6);
   else
     {
       int n;
@@ -1261,7 +1267,7 @@ ftfont_open2 (struct frame *f,
       for (i = 32, n = 0; i < 127; i++)
        if (FT_Load_Char (ft_face, i, FT_LOAD_DEFAULT) == 0)
          {
-           int this_width = ft_face->glyph->metrics.horiAdvance >> 6;
+           int this_width = ROUND (ft_face->glyph->metrics.horiAdvance) >> 6;
 
            if (this_width > 0
                && (! font->min_width || font->min_width > this_width))
@@ -1601,12 +1607,6 @@ ftfont_get_glyph_id (MFLTFont *font, MFLTGlyphString 
*gstring,
   return 0;
 }
 
-/* Operators for 26.6 fixed fractional pixel format */
-
-#define FLOOR(x)    ((x) & -64)
-#define CEIL(x)            (((x)+63) & -64)
-#define ROUND(x)    (((x)+32) & -64)
-
 static int
 ftfont_get_metrics (MFLTFont *font, MFLTGlyphString *gstring,
                    int from, int to)



reply via email to

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