emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch to vertically center line content when using line-spacing vari


From: Robert Pluim
Subject: Re: Patch to vertically center line content when using line-spacing variable
Date: Mon, 09 Sep 2019 10:40:33 +0200

>>>>> On Sun, 8 Sep 2019 20:24:50 -0300, Jesse Medeiros <address@hidden> said:

    Jesse> When using line-spacing, the new variable 
line-spacing-vertical-center
    Jesse> can be set to non-nil to center the line content vertically.
    Jesse> ---
    Jesse>  doc/lispref/frames.texi |  5 +++++
    Jesse>  etc/NEWS                |  4 ++++
    Jesse>  src/buffer.c            | 14 ++++++++++++++
    Jesse>  src/buffer.h            |  4 ++++
    Jesse>  src/xdisp.c             |  9 ++++++++-
    Jesse>  5 files changed, 35 insertions(+), 1 deletion(-)

Hmm, should this be customizable, like 'line-spacing' is? In any case,
I think the doc string of 'line-spacing' should refer to this new
variable as well.

Also: could this not work as a new type of value for 'line-spacing'
instead? Something like

'(both . 5)

to mean 5 pixels above and below?

    Jesse> diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
    Jesse> index 618ea16fcf..75a6725f03 100644
    Jesse> --- a/doc/lispref/frames.texi
    Jesse> +++ b/doc/lispref/frames.texi
    Jesse> @@ -1857,6 +1857,11 @@ Layout Parameters
    Jesse>  Additional space to leave below each text line, in pixels (a 
positive
    Jesse>  integer).  @xref{Line Height}, for more information.
 
    Jesse> +@vindex line-spacing-vertical-center@r{, a frame parameter}
    Jesse> +@item line-spacing-vertical-center
    Jesse> +If non-nil, centers the line content vertically when using
    Jesse> +using the @code{line-spacing} variable.
    Jesse> +

I donʼt think you implemented this as a frame parameter, which means the
documentation should go in "@node Line Height" in display.texi, or you
could implement the frame parameter as well. [1]

    Jesse>    if (extra_line_spacing > 0)
    Jesse>      {
    Jesse> -      it->descent += extra_line_spacing;
    Jesse> +      if (! BVAR (XBUFFER (it->w->contents), 
line_spacing_vertical_center))

I think this currently works because Qnil == 0, for now, but you should
probably use NILP.

Footnotes:
[1] line-spacing can be a frame parameter, per-buffer, or a newline overlay
     property. Implementing all three is probably overkill.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]