From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: Patch to vertically center line content when using line-spacing variable Date: Mon, 09 Sep 2019 10:40:33 +0200 Message-ID: References: <83ftl85tbn.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="228415"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Eli Zaretskii , Stefan Kangas , emacs-devel@gnu.org To: Jesse Medeiros Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 09 10:41:16 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i7FEX-000xFU-36 for ged-emacs-devel@m.gmane.org; Mon, 09 Sep 2019 10:41:13 +0200 Original-Received: from localhost ([::1]:52924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7FEV-0007fJ-VE for ged-emacs-devel@m.gmane.org; Mon, 09 Sep 2019 04:41:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56228) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7FDz-0007fD-A9 for emacs-devel@gnu.org; Mon, 09 Sep 2019 04:40:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7FDy-0007wV-9x for emacs-devel@gnu.org; Mon, 09 Sep 2019 04:40:39 -0400 Original-Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:34841) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i7FDx-0007vb-Kg; Mon, 09 Sep 2019 04:40:38 -0400 Original-Received: by mail-wm1-x333.google.com with SMTP id n10so13604145wmj.0; Mon, 09 Sep 2019 01:40:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-copies-to:gmane-reply-to-list :date:in-reply-to:message-id:mime-version:content-transfer-encoding; bh=eumKmynfuLByUuxW+8coKSRiCB0bIw5PkemNve+2eJg=; b=eEwR/xq8VLPUWVlh6l/L4CvbqnVY/485GvxX9PRzlDRl/9oqhezkflf3mnM0iZhNZ2 nUfsKsZ8i2MT9uA9rLlyCVTRXIB4fJSklOVOYXvIQV6Lr1xWxz1z9iCi6r7MQL7vmQDt SM/b3+pKc/4dStZvcKnG7XYyiAYeRrQ/CrDTQ1ERaGIPit2MxYWj6L3zMmaJzbRM7Wy6 j2tPqcGSlFu1wAtcxt+SEfQcAGd8uECHS0pqH3PjI5VjRomggR3zuxOZVTP/ttSYPPpe wXUwWPswua5zZOwBgWXhEE4vvttyziFo5JmVvr255iP4992UcDdCf4SyWENIXeXQUj9D lbEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version :content-transfer-encoding; bh=eumKmynfuLByUuxW+8coKSRiCB0bIw5PkemNve+2eJg=; b=hI44YBUWtSAdFXG77YnOV3tJ73+JPJVBmWOMzYbaoKF2wuN0PR9cprmUwJNH2udgMN KKamDKelPbGXpMrNKBRnTc5r0sFF4QP1azLMYOLtPmiCuZ7XqbVDQWb51nOUJ2c9Z/1c pLle6fMB3AO5EHTcC6C/f6zxj+ZAyRcxC07p3x19CcVVmgKqN01UjXP20+wY//ZQnqh4 EJsbHIiRg9t4OCRylR0/rAaq3wRz7Ahi0c5pmyWGrE/RIF0umDYKYzqB6ZA9/sOInn5T 96IJK8BodkVmHP7w+z/pbdqLK9GYBGU++gtpMP3mYYkYa2DZhF7PWc1WLQiaxtMkgnso /uHw== X-Gm-Message-State: APjAAAV9zAks32IaXPv6pX8+FwAAsYuTG5a3Ma/fRqR4EGSq3zZX5X/F 4yuCfUuIDWJHmrmxL35XJ6o= X-Google-Smtp-Source: APXvYqxwiV68aIu2SPHxzeX7JFE0zV3RvG4pEjVd0kyksIgDOlv6PDWww/xSKACqu0iwifQvox3YZQ== X-Received: by 2002:a05:600c:251:: with SMTP id 17mr17758644wmj.17.1568018435609; Mon, 09 Sep 2019 01:40:35 -0700 (PDT) Original-Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id r20sm18585819wrg.61.2019.09.09.01.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2019 01:40:34 -0700 (PDT) Mail-Copies-To: never Gmane-Reply-To-List: yes In-Reply-To: (Jesse Medeiros's message of "Sun, 8 Sep 2019 20:24:50 -0300") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::333 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:239950 Archived-At: >>>>> On Sun, 8 Sep 2019 20:24:50 -0300, Jesse Medeiros 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 po= sitive Jesse> integer). @xref{Line Height}, for more information. =20 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=CA=BCt think you implemented this as a frame parameter, which means t= he 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 +=3D extra_line_spacing; Jesse> + if (! BVAR (XBUFFER (it->w->contents), line_spacing_verti= cal_center)) I think this currently works because Qnil =3D=3D 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.