From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: Redisplay issue Date: Sat, 05 Dec 2015 09:25:46 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <83y4dhonng.fsf@gnu.org> <83two4olqj.fsf@gnu.org> <83h9k3mphx.fsf@gnu.org> <834mg2kvj7.fsf@gnu.org> <83d1upj6ml.fsf@gnu.org> <83si3kht2b.fsf@gnu.org> <56608701.9050802@gmx.at> <566149F0.1090408@gmx.at> <56615343.2090901@gmx.at> <5661554A.9050209@gmx.at> <5661574A.60900@gmx.at> <83y4dah7f8.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1449275165 27416 80.91.229.3 (5 Dec 2015 00:26:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Dec 2015 00:26:05 +0000 (UTC) Cc: yuan.mei.list@gmail.com, martin rudalics , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 05 01:26:00 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a50fn-0000d7-L2 for ged-emacs-devel@m.gmane.org; Sat, 05 Dec 2015 01:26:00 +0100 Original-Received: from localhost ([::1]:44037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a50fm-0004zu-Qc for ged-emacs-devel@m.gmane.org; Fri, 04 Dec 2015 19:25:58 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a50fj-0004zo-1N for emacs-devel@gnu.org; Fri, 04 Dec 2015 19:25:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a50fi-00042g-0q for emacs-devel@gnu.org; Fri, 04 Dec 2015 19:25:55 -0500 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:57529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a50fd-00042H-PZ; Fri, 04 Dec 2015 19:25:50 -0500 Original-Received: from fermat1.math.s.chiba-u.ac.jp (fermat [192.168.32.10]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id 45392C0572; Sat, 5 Dec 2015 09:25:46 +0900 (JST) In-Reply-To: <83y4dah7f8.fsf@gnu.org> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 133.82.132.2 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:195911 Archived-At: >>>>> On Fri, 04 Dec 2015 11:47:23 +0200, Eli Zaretskii said: >> Date: Fri, 04 Dec 2015 10:05:14 +0100 >> From: martin rudalics >> CC: Eli Zaretskii , emacs-devel >> >> > 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)