From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Font height issue Date: Thu, 25 Feb 2016 22:04:21 +0200 Message-ID: <83ziuoeeuy.fsf@gnu.org> References: <87oab4fusj.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1456430682 6895 80.91.229.3 (25 Feb 2016 20:04:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Feb 2016 20:04:42 +0000 (UTC) Cc: emacs-devel@gnu.org To: Tassilo Horn Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 25 21:04:36 2016 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 1aZ29M-0004Qn-HC for ged-emacs-devel@m.gmane.org; Thu, 25 Feb 2016 21:04:36 +0100 Original-Received: from localhost ([::1]:45566 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ29L-0003bk-NT for ged-emacs-devel@m.gmane.org; Thu, 25 Feb 2016 15:04:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44123) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ29E-0003bQ-D5 for emacs-devel@gnu.org; Thu, 25 Feb 2016 15:04:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZ29B-0008Vb-Kw for emacs-devel@gnu.org; Thu, 25 Feb 2016 15:04:28 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ29B-0008VU-Gt for emacs-devel@gnu.org; Thu, 25 Feb 2016 15:04:25 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1428 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aZ297-0001Je-A4; Thu, 25 Feb 2016 15:04:24 -0500 In-reply-to: <87oab4fusj.fsf@gnu.org> (message from Tassilo Horn on Thu, 25 Feb 2016 20:34:52 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:200674 Archived-At: > From: Tassilo Horn > Date: Thu, 25 Feb 2016 20:34:52 +0100 > > I have the problem that the font I want to use in Emacs (PragmataPro in > size 10, sizes 9 or 11 seem to be not affected) seems to have slightly > different heights in the regular and the bold version, or at least Emacs > thinks so. As a result, when modes change text to/from regular to bold > or vice versa dynamically (e.g., show-paren-mode with a bold > show-paren-match face), the height of the line changes which is > extremely annoying. > > When I searched the net I found many others having this kind of issue > with different fonts (like DejaVu Sans Mono), too, and I also found this > workaround > > https://www.reddit.com/r/emacs/comments/3zto22/i_sort_of_fixed_a_font_rendering_bug_of_emacs/ > > suggesting this patch: > > --8<---------------cut here---------------start------------->8--- > diff --git a/src/xftfont.c b/src/xftfont.c > index 110f99a..95e7e52 100644 > --- a/src/xftfont.c > +++ b/src/xftfont.c > @@ -395,16 +395,16 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size) > > font->ascent = xftfont->ascent; > font->descent = xftfont->descent; > - if (pixel_size >= 5) > - { > - /* The above condition is a dirty workaround because > - XftTextExtents8 behaves strangely for some fonts > - (e.g. "Dejavu Sans Mono") when pixel_size is less than 5. */ > - if (font->ascent < extents.y) > - font->ascent = extents.y; > - if (font->descent < extents.height - extents.y) > - font->descent = extents.height - extents.y; > - } > + /* if (pixel_size >= 5) */ > + /* { */ > + /* /\* The above condition is a dirty workaround because */ > + /* XftTextExtents8 behaves strangely for some fonts */ > + /* (e.g. "Dejavu Sans Mono") when pixel_size is less than 5. *\/ */ > + /* if (font->ascent < extents.y) */ > + /* font->ascent = extents.y; */ > + /* if (font->descent < extents.height - extents.y) */ > + /* font->descent = extents.height - extents.y; */ > + /* } */ > font->height = font->ascent + font->descent; > > if (XINT (AREF (entity, FONT_SIZE_INDEX)) == 0) > --8<---------------cut here---------------end--------------->8--- > > And indeed, that does solve the issue for me. Now the regular and the > bold version are displayed with the same height. Sorry, this is bug #22383, where the conclusion was already reached that the workaround was not needed anymore. I thought the change was committed, but I see that it wasn't, so I committed it now to the emacs-25 branch.