GNU bug report logs - #76390
[PATCH] Center lines vertically with line-spacing-vertical-center

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Tue, 18 Feb 2025 10:43:02 UTC

Severity: wishlist

Tags: patch

Full log


View this message in rfc822 format

From: Daniel Mendler <mail <at> daniel-mendler.de>
To: 76390 <at> debbugs.gnu.org
Cc: Stefan Kangas <stefankangas <at> gmail.com>
Subject: bug#76390: [PATCH] Center lines vertically with line-spacing-vertical-center
Date: Tue, 18 Feb 2025 11:41:26 +0100
[Message part 1 (text/plain, inline)]
Tags: patch

A few years ago there was a discussion on emacs-devel started by Jesse
Nazario about vertically centering text for line-spacing > 0. A patch
was provided back then by Jesse. I hope to revive the discussion and I
like to provide an updated patch.

Centering text would be particularly useful if the text has a background
color (e.g., hl-line or hi-lock) as demonstrated by the following steps:

1. (setq-local line-spacing 0.5)
2. (hl-line-mode 1)
3. M-x hi-lock-face-symbol-at-point on a symbol at point

The proposal was to add a new variable `line-spacing-vertical-center' to
enable text centering. Maybe it makes sense to use a more general
approach which allows finer control over the alignment, e.g., a variable
`line-spacing-align' which can be set to a floating point number in the
interval [0.0, 1.0]. The value 0.5 means to center the text, 0.0 means
to align the text at the top of the line and 1.0 means to align the text
at the bottom of the line. Fine control over the alignment allows to to
adjust to fine differences of the font and its baseline alignment.

The old discussion can be found at:

https://lists.gnu.org/archive/html/emacs-devel/2019-09/msg00660.html

I attached the latest patch from the old discussion to this report.

[centering-text.patch (text/patch, attachment)]

This bug report was last modified 115 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.