From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Patch to vertically center line content when using line-spacing variable Date: Mon, 26 Apr 2021 15:35:22 +0300 Message-ID: <83k0opjkad.fsf@gnu.org> References: <1398d749303cdc2a490cd9eb35f88fcf@johnmuhl.me> <87sg3ei23u.fsf@gnus.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6021"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jessenzr@gmail.com, email@johnmuhl.me, emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Apr 26 14:38:43 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lb0Vf-0001NC-Da for ged-emacs-devel@m.gmane-mx.org; Mon, 26 Apr 2021 14:38:43 +0200 Original-Received: from localhost ([::1]:58002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lb0Ve-00026N-Gk for ged-emacs-devel@m.gmane-mx.org; Mon, 26 Apr 2021 08:38:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lb0Ss-0008Oq-38 for emacs-devel@gnu.org; Mon, 26 Apr 2021 08:35:50 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55189) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lb0Sq-0001Gh-Ce; Mon, 26 Apr 2021 08:35:48 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1541 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lb0Sl-0007Gh-Vn; Mon, 26 Apr 2021 08:35:45 -0400 In-Reply-To: <87sg3ei23u.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun, 25 Apr 2021 21:41:09 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:268462 Archived-At: > From: Lars Ingebrigtsen > Date: Sun, 25 Apr 2021 21:41:09 +0200 > Cc: jessenzr@gmail.com, emacs-devel@gnu.org > > I've included the patch below. > > I've never used the `line-spacing' variable myself (and my guess is that > few do, which is probably why your message didn't get any responses), > but I did a > > (setq line-spacing 20) > > now, and I see that this puts more space at the bottom of the line. The > proposed patch allows centring instead, which seems eminently reasonable > to me. (Perhaps this should even be the default?) > > Does anybody have any comments here before I apply the patch? I have a few comments, some (most) of them were already voiced, either in this discussion or in the past ones on the same theme: . I don't see a need for a separate new variable (and a built-in one on top of that). I think it is cleaner to extend the line-spacing property, parameter and variables to support a cons of two numbers, (ABOVE . TOTAL), which would allow users and Lisp programs to specify how to subdivide the spacing between the ascent and descent parts. This would then also solve the problem with the proposed change, whereby the vertical position of the text inside the spacing can only be controlled per buffer, but not on every level where the line-spacing is supported . The code misses one other place where line-spacing takes effect, see the function append_space_for_newline. . The division between ascent and descent in the patch loses 1 pixel if the value of line-spacing is an odd number of pixels, so the code needs to be fixed not to do that. Thanks.