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: Variable pitch text filling Date: Sat, 27 Nov 2021 10:35:01 +0200 Message-ID: <83a6hq0zey.fsf@gnu.org> References: <87ilwft1ph.fsf@gnus.org> <837dcv2c2c.fsf@gnu.org> <875ysft0l3.fsf@gnus.org> <835yse3n01.fsf@gnu.org> <87lf1ars0f.fsf@gnus.org> <83czmm11t0.fsf@gnu.org> <87h7byrplm.fsf@gnus.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10972"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 27 09:36:03 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 1mqtBi-0002dB-CZ for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Nov 2021 09:36:02 +0100 Original-Received: from localhost ([::1]:37872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mqtBg-0007XQ-Kd for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Nov 2021 03:36:00 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59776) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqtAe-0006lU-MQ for emacs-devel@gnu.org; Sat, 27 Nov 2021 03:34:57 -0500 Original-Received: from [2001:470:142:3::e] (port=47242 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqtAe-00018T-Ar; Sat, 27 Nov 2021 03:34:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=etahjHqclhfAA9vsjtlp6BH49QTyWh3lbc2UoahIDic=; b=mA19bmZWmH4o 5zk9GCKvAZAMImxB9mInSkrOTMHsKW8qPI5mkk+LcTL3DwFkSe/mETuFIxsEYO1dp7itRYHZDdFV4 a/3GpKEpnOZCnqIWrymRQh6nfxtpT176yxeS6aoHFUJANRpJ77MfRpLmd1znYqpc37PTS3WqQbeoK jIxtvK3euy/kayyOz9N3xPHBvRf+kdGtZ5p0zhMEY/qd/sivAbCjXpXz4OvlmJPpAkmz7BzuvZ4Fa 0f9cUmx5bH+oPZgLCo33Gb31pEZFmDDhGXmpiUGElGi37r1/ri0pFd984YapI1p1ZxLQAxsVu0eiB SpLw8sa8ipVtF5RVJ6oFtQ==; Original-Received: from [87.69.77.57] (port=4339 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqtAd-0004HG-SA; Sat, 27 Nov 2021 03:34:56 -0500 In-Reply-To: <87h7byrplm.fsf@gnus.org> (message from Lars Ingebrigtsen on Sat, 27 Nov 2021 09:04:53 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:280305 Archived-At: > From: Lars Ingebrigtsen > Cc: emacs-devel@gnu.org > Date: Sat, 27 Nov 2021 09:04:53 +0100 > > 1) We want to display the "-" wider in the variable-pitch mode line > 2) In the justification case, we want to add some blank pixels more free-form > 3) A much-requested feature is to be able to "snap" characters to an > integer multiple of the standard font (in a fixed-width buffer). > (Mostly relevant for people that mix fonts, like CJK and roman.) > > All three of these are essentially the same: Add some pixels to the > glyphs in a region. > > So we could do just that. I.e., not a complex display spec, but a > simpler char-based one, for instance `char-spacing', that could have > values: > > 1) 1.0, to be at least 1 normal character wide > 2) 3, to add three blank pixels to the end > 3) `grid', to add enough blank pixels to have a width that's an > integer multiple of the normal character width It is trivial to add some pixels to the width of a glyph we produce for a character: it just involves enlarging the it->pixel_width and/or the glyph->pixel_width when we produce the glyph for that character. Then the display backends (xterm.c etc.) will draw the background color for those pixels automatically, thus creating an illusion of "blank pixels". The problem is how to determine which characters to "widen", and how to calculate the number of the "widening" pixels. The answer could be different for each kind of situations you mention. > So standard-mode-line-format would have > > (list > :propertize > (list "" > 'mode-line-mule-info > 'mode-line-client > 'mode-line-modified > 'mode-line-remote) > 'display '(min-width (5.0)) > 'char-spacing 1.0) What would be the exact meaning of "char-spacing 1.0" here? IOW, how would we compute the number of pixels to add to each glyph's width in this case? what is a "normal character" for this purpose? > while inter-character justification would use 'char-spacing 1 to add an > extra pixel after all the chars on the line, for instance. With the value 1 computed by Lisp? Because it cannot be a fixed value: it should at least depend on the size of the font, and I think it should be possible to add more pixels without making the display unpleasant. Also, in the case of CJK fonts, we should be able to do that without any text property put on the text, so we need some (optional) variable as well.