From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Font height issue Date: Thu, 25 Feb 2016 20:34:52 +0100 Message-ID: <87oab4fusj.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1456428931 10087 80.91.229.3 (25 Feb 2016 19:35:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Feb 2016 19:35:31 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 25 20:35:21 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 1aZ1h2-0001gZ-7f for ged-emacs-devel@m.gmane.org; Thu, 25 Feb 2016 20:35:20 +0100 Original-Received: from localhost ([::1]:45451 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ1h1-0001Nq-4h for ged-emacs-devel@m.gmane.org; Thu, 25 Feb 2016 14:35:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ1gm-0001Jw-Te for emacs-devel@gnu.org; Thu, 25 Feb 2016 14:35:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZ1gi-00015M-K4 for emacs-devel@gnu.org; Thu, 25 Feb 2016 14:35:04 -0500 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:56611) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ1gi-00015I-GA for emacs-devel@gnu.org; Thu, 25 Feb 2016 14:35:00 -0500 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id F0FBB215AE for ; Thu, 25 Feb 2016 14:34:59 -0500 (EST) Original-Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Thu, 25 Feb 2016 14:34:59 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=Hd kdwUKrSzBznGFg08hqxXiDVM8=; b=awIOQj7IGh17zpN0q58+iaG4CaabklttzF Ga4PJL8/Jp1ZPXTyT+30jn9EO8Q7tAbWJBznvZT5A5a0jZSdvUpXg/rzitBNJ27l nn8uYBueq6w2x+CqR63y+gvNedIA7k2UjwQYBlW+tz6dFMgANY0pvIdppgHcB3VL KyM+8IY6w= X-Sasl-enc: /bseIDlPSNPAY3YKFU8vVHJBjDH1yELAq8PxaciSfsrk 1456428899 Original-Received: from thinkpad-t440p (unknown [2.160.80.154]) by mail.messagingengine.com (Postfix) with ESMTPA id 6400AC00012 for ; Thu, 25 Feb 2016 14:34:59 -0500 (EST) Mail-Followup-To: emacs-devel@gnu.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.91 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.29 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:200672 Archived-At: Hi all, 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. I have no idea about font handling, so I cannot tell if the above DTRT. However, it fixes an annoying issue that seems to happen only with Emacs. Somewhere on the net I've read that Emacs seems to be the only one being correct, i.e., it displays what the font says, and if the bold version of a font is higher than the regular one, that's a (mis)feature of the font. Anyhow, since the results can be annoying and apparently not so few users are affected, can we have a customize option for that? Bye, Tassilo