[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Patch to vertically center line content when using line-spacing vari
Re: Patch to vertically center line content when using line-spacing variable
Mon, 26 Apr 2021 15:35:22 +0300
> From: Lars Ingebrigtsen <email@example.com>
> Date: Sun, 25 Apr 2021 21:41:09 +0200
> Cc: firstname.lastname@example.org, email@example.com
> 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.