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: Horizontal centering in the display engine Date: Wed, 14 Apr 2021 09:56:07 +0300 Message-ID: <8335vt1hiw.fsf@gnu.org> References: <87fszuvy7p.fsf@catern.com> <83czuy112a.fsf@gnu.org> <877dl6vvax.fsf@catern.com> <83blai0y3i.fsf@gnu.org> <8735vtx62w.fsf@catern.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17607"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: sbaugh@catern.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Apr 14 08:57:04 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 1lWZSR-0004SQ-RU for ged-emacs-devel@m.gmane-mx.org; Wed, 14 Apr 2021 08:57:03 +0200 Original-Received: from localhost ([::1]:52062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lWZSQ-0002v9-RU for ged-emacs-devel@m.gmane-mx.org; Wed, 14 Apr 2021 02:57:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWZRl-0002Un-VI for emacs-devel@gnu.org; Wed, 14 Apr 2021 02:56:21 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:37863) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lWZRl-0004Cj-Ly; Wed, 14 Apr 2021 02:56:21 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1186 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lWZRl-0006UD-4h; Wed, 14 Apr 2021 02:56:21 -0400 In-Reply-To: <8735vtx62w.fsf@catern.com> (sbaugh@catern.com) 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:268026 Archived-At: > From: sbaugh@catern.com > Date: Tue, 13 Apr 2021 16:49:59 -0400 > > >> :align-to (- center (0.5 . line-size)) > >> > >> [...] > >> > >> As far as I understand the documentation, there's no way to express > >> something like line-size currently? Maybe that could be easily added? > > > > We have window-text-pixel-size, isn't that what you want? > > But that can't be used in a pixel specification, as far as I understand? I meant to suggest to use that function to compute the pixel value for the :align-to spec. > And anyway, I don't think that's right - as the Elisp manual says, > "window-text-pixel-size treats the text displayed in a window as a whole > and does not care about the size of individual lines." That's a surprising interpretation. The function accepts FROM and TO arguments; if those are the beginning and the end of a line, you get the pixel with of that line and nothing else. > > E.g., are you planning on centering each line separately, or > > everything together, or something else? > > Each line separately. So each line should have a different value of :align-to? > > IOW, how did you envision you'd put the display property on each line? > > The same display property would be applied to every line. This contradicts my understanding from above, or what am I missing? > > and how does this work when the user types text to add more lines, or > > make a line longer than the window? etc. etc. > > When they add more lines, those new lines are also centered. If a line > is longer than the window, it's truncated or wrapped depending on > truncate-lines, word-wrap, etc., as usual. If the lines are wrapped, you'd want the continuation line to be centered as well? And if we go one level higher, I guess you intend to write a post-command-hook that recalculates the :align-to specs whenever text changes, is that right? Or how did you plan on taking text changes into consideration?