From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Werner LEMBERG Newsgroups: gmane.emacs.bugs Subject: bug#20628: 25.0.50; Incorrect line height for some fonts Date: Sat, 23 May 2015 11:50:22 +0200 (CEST) Message-ID: <20150523.115022.503695176.wl@gnu.org> References: <83617k4e5g.fsf@gnu.org> <20150522.234959.238191883.wl@gnu.org> <83lhgf3hw1.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1432374687 31754 80.91.229.3 (23 May 2015 09:51:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 May 2015 09:51:27 +0000 (UTC) Cc: clement.pitclaudel@live.com, ohwoeowho@gmail.com, 20628@debbugs.gnu.org To: eliz@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 23 11:51:16 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1Yw65L-00014A-Tj for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 May 2015 11:51:16 +0200 Original-Received: from localhost ([::1]:37216 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yw65L-0002f4-9D for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 May 2015 05:51:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yw65E-0002ex-Ja for bug-gnu-emacs@gnu.org; Sat, 23 May 2015 05:51:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yw659-00011t-M0 for bug-gnu-emacs@gnu.org; Sat, 23 May 2015 05:51:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yw659-00011e-IC for bug-gnu-emacs@gnu.org; Sat, 23 May 2015 05:51:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Yw659-0003WZ-4T for bug-gnu-emacs@gnu.org; Sat, 23 May 2015 05:51:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Werner LEMBERG Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 May 2015 09:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20628 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20628-submit@debbugs.gnu.org id=B20628.143237465113525 (code B ref 20628); Sat, 23 May 2015 09:51:02 +0000 Original-Received: (at 20628) by debbugs.gnu.org; 23 May 2015 09:50:51 +0000 Original-Received: from localhost ([127.0.0.1]:53435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yw64r-0003Vv-OO for submit@debbugs.gnu.org; Sat, 23 May 2015 05:50:50 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:60071) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yw64i-0003VZ-G0 for 20628@debbugs.gnu.org; Sat, 23 May 2015 05:50:42 -0400 Original-Received: from gnu.org ([178.115.130.41]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0LeN3N-1ZUe4d3VYT-00qC0o; Sat, 23 May 2015 11:50:27 +0200 In-Reply-To: <83lhgf3hw1.fsf@gnu.org> X-Mailer: Mew version 6.5 on Emacs 25.0.50.1 / Mule 6.0 (HANACHIRUSATO) X-Provags-ID: V03:K0:uYjdxvKrZ44XUbYga3IfFbIAitOXHan9+oyK8MJWp1O8tv4PNGI AId1h18cYrcs/wZm+2hD51vj7EJ+wgLjCccN+tMwUX9CAY+vbsDpydugntRcgW8564yPc5I lbVQURajNvoNcybE8S6EpqPz6Ral+hFbI7dYvL2BPCB4AriQR+mZmxjKYaszSClQnQFBURP cK7lDcl6lXfEyBos9NUMg== X-UI-Out-Filterresults: notjunk:1; X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:103087 Archived-At: >> IMHO the bes solution is to completely ignore font-wide ascender >> and descender values. Instead, use the TeX approach: set the line >> gap to the current size of the font, multiplied by a factor of 1.2 >> (and make this configurable on a font-by-font basis in case it >> isn't already), and increase the linegap if individual glyphs need >> it. > > Could you perhaps look at the Emacs sources and suggest how to > change the *_open functions in the *font.c back-ends, to do what you > suggest above? Or at least tell how to get "the current size of the > font" from the back-ends we use, which are Freetype, Fontconfig, and > XLib's XLoadQueryFont? The relevant source files are xfont.c, > ftfont.c, and xftfont.c. Sorry, no time. However, with `current size' I mean the pixels per EM value computed in the standard way: ppem = size * DPI / 72 where `size' is given in points and `DPI' the screen resolution. This should be completely independent of the back-end. The idea is that font designers have a vital interest that a font rendered at, say, 10pt (more or less) fits other fonts drawn at 10pt, regardless what the font metrics say. An exception to that are math fonts, of course, since those need a real two-dimensional layout instead of positioning glyphs in lines. > Also, how to know from the glyph metrics, in their Emacs > incarnation, that an individual glyph needs an increase of the > vertical space? Again no time to check this, sorry. Assuming that Emacs somehow provides the maximum descender of the glyphs in the previous line together with a linegap value, simply check that the maximum ascender of the glyphs in the current line doesn't collide, shifting the line downwards if necessary. AFAIK, Emacs does this already. As a corollary, the only question is how to compute a proper default linegap value without relying on quirks caused by incompatible font formats and font metric data. Werner PS: If you want it especially nifty, implement a skyline algorithm to check whether the ascender of the glyph at a given horizontal position collides with the descender of the glyph(s) at the same horizontal position one line above.