From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel Newsgroups: gmane.emacs.bugs Subject: bug#20628: 25.0.50; Incorrect line height for some fonts Date: Sun, 24 May 2015 04:20:32 -0400 Message-ID: <556189D0.2000208@live.com> References: <83bnhc4gx4.fsf@gnu.org> <555F7BFD.2090105@live.com> <83617k4e5g.fsf@gnu.org> <20150522.234959.238191883.wl@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1432455690 6328 80.91.229.3 (24 May 2015 08:21:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 May 2015 08:21:30 +0000 (UTC) Cc: ohwoeowho@gmail.com, 20628@debbugs.gnu.org To: Werner LEMBERG , eliz@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 24 10:21:18 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 1YwR9q-0000MV-5T for geb-bug-gnu-emacs@m.gmane.org; Sun, 24 May 2015 10:21:18 +0200 Original-Received: from localhost ([::1]:39363 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwR9p-0004CQ-Fr for geb-bug-gnu-emacs@m.gmane.org; Sun, 24 May 2015 04:21:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwR9h-00048q-V7 for bug-gnu-emacs@gnu.org; Sun, 24 May 2015 04:21:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YwR9d-0007GA-JW for bug-gnu-emacs@gnu.org; Sun, 24 May 2015 04:21:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44223) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwR9d-0007G6-FK for bug-gnu-emacs@gnu.org; Sun, 24 May 2015 04:21:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YwR9c-0005jd-Gi for bug-gnu-emacs@gnu.org; Sun, 24 May 2015 04:21:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 May 2015 08:21:04 +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.143245565522003 (code B ref 20628); Sun, 24 May 2015 08:21:04 +0000 Original-Received: (at 20628) by debbugs.gnu.org; 24 May 2015 08:20:55 +0000 Original-Received: from localhost ([127.0.0.1]:54194 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YwR9O-0005ic-HR for submit@debbugs.gnu.org; Sun, 24 May 2015 04:20:55 -0400 Original-Received: from mout.kundenserver.de ([212.227.17.24]:59161) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YwR9H-0005iC-45 for 20628@debbugs.gnu.org; Sun, 24 May 2015 04:20:48 -0400 Original-Received: from [18.189.125.138] ([18.189.125.138]) by mrelayeu.kundenserver.de (mreue104) with ESMTPSA (Nemesis) id 0LfSYr-1ZT40o1tBx-00p1P6; Sun, 24 May 2015 10:20:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <20150522.234959.238191883.wl@gnu.org> X-Provags-ID: V03:K0:17bl1Huapb5yiTgZX/SR212+gp9fj5ORNe68v/eQEkGkjpzPyPh SGDssr222qSfSYl9GJ9fgarfO1HBfIEM7G3vdLwDWyfPThPLRJSE+ow9GBVeUAhMxvKoSXp BY8f8JCY1pbZ1ckbi7timhkTtwYvO85JJsIkucQ916zP/MR5EFFipLIkIZqYvNKzmnahJz2 Dx6YPJYrNNWhtFGFN05eQ== 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:103121 Archived-At: On 05/22/2015 05:49 PM, Werner LEMBERG wrote: > >>> Here is an hypothesis. When I open Latin Modern in FontForge, I see >>> two types of ascent and descent values: the ones in the "General" >>> tab are 806 and 194, and the ones in the OS/2 tab, in particular >>> Win Ascent and Win Descent, are 3560 and 3060. Such a discrepancy >>> does not seem to exist in the few well-behaved fonts that I >>> checked. Could it be that most applications use the first set of >>> values, but Emacs relies on the second? > > Actually, there are *three* sets of font-wide ascender and descender > values in TrueType fonts: > > (1) From the `hhea' table: The `ascent' and `descent' fields, > together with `linegap'. Used by Apple, cf. > > https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6hhea.html > > These values are normally set by the font developer; there is no > relation to the actual ascender and descender values of > individual glyphs. > > (2) From the `OS/2' table: The `usWinAscent' and `usWinDescent' > fields, for Windows. Originally, those values are the ymax and > ymin values from all characters in the Windows ANSI character > set. Today, however, it is often set to the ymax and ymin > values of all glyphs in a font to avoid nasty clipping on (some? > older?) Windows applications. > > (3) From the `OS/2' table: The `sTypoAscender' and `sTypoDescender' > fields, together with `sTypoLinegap'. For Windows. These > values are normally set by the font developer; there is no > relation to the actual ascender and descender values of > individual glyphs. > > Note that (1) and (3) are defined differently. Mac fonts often miss > an `OS/2' table, making (2) and (3) unavailable. Additionally, many > fonts have incompatible or erroneous values for any of the fields. > It's really a mess, unfortunately. > > 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. Thanks for this detailed description! I looked a bit more into how other programs handle this, and it seems that they take the simple approach of relying on font-wide metrics. Only, they don't seem to use the same ones as Emacs. This causes LibreOffice and vim-gtk to display "∫" as slightly truncated when using Latin Modern Math (it's taller than the line height). Emacs on the other hand displays it fine (at the cost of having a huge line height. I wonder if changing the set of metrics used in Emacs would be easy.