From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#20628: 25.0.50; Incorrect line height for some fonts Date: Sat, 23 May 2015 13:31:16 +0300 Message-ID: <83y4kf1t6z.fsf@gnu.org> References: <83617k4e5g.fsf@gnu.org> <20150522.234959.238191883.wl@gnu.org> <83lhgf3hw1.fsf@gnu.org> <20150523.115022.503695176.wl@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1432377148 3021 80.91.229.3 (23 May 2015 10:32:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 May 2015 10:32:28 +0000 (UTC) Cc: clement.pitclaudel@live.com, ohwoeowho@gmail.com, 20628@debbugs.gnu.org To: Werner LEMBERG Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 23 12:32: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 1Yw6j0-0005Lx-9h for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 May 2015 12:32:14 +0200 Original-Received: from localhost ([::1]:37264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yw6iz-0007Ov-8A for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 May 2015 06:32:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yw6is-0007Oa-Fy for bug-gnu-emacs@gnu.org; Sat, 23 May 2015 06:32:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yw6io-0006hN-Ok for bug-gnu-emacs@gnu.org; Sat, 23 May 2015 06:32:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43481) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yw6io-0006gw-Mb for bug-gnu-emacs@gnu.org; Sat, 23 May 2015 06:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Yw6io-0004Vq-Bw for bug-gnu-emacs@gnu.org; Sat, 23 May 2015 06:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 May 2015 10:32: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.143237709217310 (code B ref 20628); Sat, 23 May 2015 10:32:02 +0000 Original-Received: (at 20628) by debbugs.gnu.org; 23 May 2015 10:31:32 +0000 Original-Received: from localhost ([127.0.0.1]:53456 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yw6iG-0004V2-27 for submit@debbugs.gnu.org; Sat, 23 May 2015 06:31:31 -0400 Original-Received: from mtaout24.012.net.il ([80.179.55.180]:60879) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yw6i9-0004Uk-K6 for 20628@debbugs.gnu.org; Sat, 23 May 2015 06:31:25 -0400 Original-Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0NOS00H00S4S2600@mtaout24.012.net.il> for 20628@debbugs.gnu.org; Sat, 23 May 2015 13:22:38 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NOS00FI3STQEC30@mtaout24.012.net.il>; Sat, 23 May 2015 13:22:38 +0300 (IDT) In-reply-to: <20150523.115022.503695176.wl@gnu.org> X-012-Sender: halo1@inter.net.il 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:103092 Archived-At: > Date: Sat, 23 May 2015 11:50:22 +0200 (CEST) > Cc: clement.pitclaudel@live.com, ohwoeowho@gmail.com, 20628@debbugs.gnu.org > From: Werner LEMBERG > > > >> 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. I guess you mean font->pixel_size, something we have already. > > 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. Emacs indeed does that already, but it uses the font's ascent and descent values, not values specific to each glyph. I was under the impression that you said we could access and use the ascent/descent values of each glyph in a font, and I was asking how to do that, i.e. which metrics express these per-glyph values. > 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. What do you mean by "linegap"? the vertical gap between two screen lines in Emacs is the sum of the line height, computed as a sum of its max_ascent and max_descent values, plus the value of line-spacing. > 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. This again goes back to the question how to access the ascender of a glyph. Thanks.