unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: Eli Zaretskii <eliz@gnu.org>
Cc: yuan.mei.list@gmail.com, martin rudalics <rudalics@gmx.at>,
	emacs-devel@gnu.org
Subject: Re: Redisplay issue
Date: Sat, 05 Dec 2015 09:25:46 +0900	[thread overview]
Message-ID: <wla8ppyc51.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <83y4dah7f8.fsf@gnu.org>

>>>>> On Fri, 04 Dec 2015 11:47:23 +0200, Eli Zaretskii <eliz@gnu.org> said:

>> Date: Fri, 04 Dec 2015 10:05:14 +0100
>> From: martin rudalics <rudalics@gmx.at>
>> CC: Eli Zaretskii <eliz@gnu.org>, emacs-devel <emacs-devel@gnu.org>
>> 
>> > 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
				mituharu@math.s.chiba-u.ac.jp

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)



  parent reply	other threads:[~2015-12-05  0:25 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27 22:31 Redisplay issue Yuan MEI
2015-11-28  8:06 ` Eli Zaretskii
2015-11-28  8:27   ` Yuan MEI
2015-11-28  9:44     ` Eli Zaretskii
2015-11-28 20:19       ` Yuan MEI
2015-11-28 20:49         ` Eli Zaretskii
2015-11-29  2:54           ` Yuan MEI
2015-11-29 15:42             ` Eli Zaretskii
2015-11-29 23:35               ` Yuan MEI
2015-11-30 16:16                 ` Eli Zaretskii
2015-12-01  4:51                   ` Yuan MEI
2015-12-01 16:01                     ` Eli Zaretskii
2015-12-02  4:35                       ` Yuan MEI
2015-12-02 13:57                         ` Eli Zaretskii
2015-12-03  4:55                           ` Yuan MEI
2015-12-03  7:47                             ` Eli Zaretskii
2015-12-03  8:09                               ` Yuan MEI
2015-12-03 10:23                                 ` Eli Zaretskii
2015-12-03 18:16                                 ` martin rudalics
2015-12-03 21:23                                   ` Yuan MEI
2015-12-04  8:08                                     ` martin rudalics
2015-12-04  8:30                                       ` Yuan MEI
2015-12-04  8:48                                         ` martin rudalics
2015-12-04  8:54                                           ` Yuan MEI
2015-12-04  8:56                                           ` martin rudalics
2015-12-04  9:00                                             ` Yuan MEI
2015-12-04  9:05                                               ` martin rudalics
2015-12-04  9:47                                                 ` Eli Zaretskii
2015-12-04 10:21                                                   ` martin rudalics
2015-12-04 11:01                                                     ` Eli Zaretskii
2015-12-04 11:12                                                       ` Eli Zaretskii
2015-12-05  0:25                                                   ` YAMAMOTO Mitsuharu [this message]
2015-12-05  9:17                                                     ` Eli Zaretskii
2015-12-06  0:49                                                       ` Yuan MEI
2015-12-07  3:33                                                         ` YAMAMOTO Mitsuharu
2015-12-07 17:19                                                           ` Eli Zaretskii
2015-12-08  4:03                                                             ` YAMAMOTO Mitsuharu
2015-12-11  8:48                                                               ` Eli Zaretskii
2015-11-28 21:44   ` joakim
2015-11-29  0:14     ` Yuan MEI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=wla8ppyc51.wl%mituharu@math.s.chiba-u.ac.jp \
    --to=mituharu@math.s.chiba-u.ac.jp \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.at \
    --cc=yuan.mei.list@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).