From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Variable pitch text filling Date: Sat, 27 Nov 2021 15:28:08 +0100 Message-ID: <87lf19r7uv.fsf@gnus.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> <83a6hq0zey.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23451"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 27 15:28:57 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 1mqyhC-0005kr-Pj for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Nov 2021 15:28:54 +0100 Original-Received: from localhost ([::1]:42230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mqyhB-0004yO-RZ for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Nov 2021 09:28:53 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqygb-0004He-Bt for emacs-devel@gnu.org; Sat, 27 Nov 2021 09:28:17 -0500 Original-Received: from [2a01:4f9:2b:f0f::2] (port=52378 helo=quimby.gnus.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqygX-0006pY-Pk; Sat, 27 Nov 2021 09:28:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=1PZNCYbuu3q9IhWqtvjsAc7xx6pC8qhTTFcd/LPL62A=; b=Cj13LmeOFyUQoL5ECRM0UiPWy8 aoirMnjlvqhxW+FstnINb4RXV/B/ln2NeFhPwcv+UfWczRyxVr26WpppYNZJxqrfVQ8RMRzF2Ofno FQHonUpu0B8DgCIExThpwy1gQk6HPOWQCYRTfIg2HkGI4qZdFH7Ag/n/GSPNjFgNvVBg=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mqygT-0001HC-34; Sat, 27 Nov 2021 15:28:11 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAALVBMVEX9/fnq5dPQ0M2u raC0w8VplIzr1qbhvWX3pxCSaC9aVSQyLBRXTzSclmf////+39xWAAAAAWJLR0QOb70wTwAAAAd0 SU1FB+ULGw4RN5tvagsAAAGmSURBVDjLnZPBS8JQHMf3XpKBCZuiRRC4KXXoYq4ODYUs9R+I7kKg Hg0PBtXVnrcoSCSEoNPe5slTvjp1cipo0MFh/0vPLHDb85BfdtjeZ+/32/f7e+O4BQUWIPw/t8Ao cMnHJ7LMYtJErFrAJ0kwIiWtEHLQn9yTxDCUUpbXIQ93JV9EEgEvgFz2b1mgXwtpk1hYpI8X52vZ GQ90XaQXx7lRcaXCslBA2XXEM0C9XiygIgNgrWXUWQBV7x/JgAVQFlVZOwqojKbNBStw3yyjytSe bRZlgH4MulKnISsJTo0HUumSrdpUrtT21cMRC6T7l7XPqBMEjLdxQ313Ag8hr1gffTjAartLXvSD L8dB8BiEtPVEQp4MbFYbdB3rpjGwh7OjUYAbnaG9VBxrpK/q8iRpSzhmzSRY1bpRO+jkr3vjttai t3AWgGZ5q9cl2q19MkvNfKnXNdRDe2+vmisrGD85jEMcC8bbWsgBOGU/o4xajNi9scyZyUidA0Mh 2OBYEoTfIdslCsyR00zu5gDFfAbM39m/2aSHTuB5J+InsfJgTkWrvgHykXNhcXUPfQAAACV0RVh0 ZGF0ZTpjcmVhdGUAMjAyMS0xMS0yN1QxNDoxNzo1NSswMDowMOTIvwQAAAAldEVYdGRhdGU6bW9k aWZ5ADIwMjEtMTEtMjdUMTQ6MTc6NTUrMDA6MDCVlQe4AAAAAElFTkSuQmCC X-Now-Playing: Joni Mitchell's _Ladies of the Canyon_: "Morning Morgantown" In-Reply-To: <83a6hq0zey.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 27 Nov 2021 10:35:01 +0200") X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:4f9:2b:f0f::2 (failed) Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@gnus.org; helo=quimby.gnus.org X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:280341 Archived-At: Eli Zaretskii writes: > 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. Right. This reminds me -- perhaps we'd want to distribute the extra space both before and after the glyph, to centre it within its allotted width? I haven't looked at the code yet, but I assume that's not going to make this significantly more difficult. > 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. Yup. > 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? It's the same as for all these width specs -- it's FRAME_COLUMN_WIDTH. The lengthy commentary before calc_pixel_width_or_height has all the grisly details, and I see that I misremembered the specs when doing the documentation. Floating point numbers aren't special: SPEC ::=3D NUM - a (fractional) multiple of the default font width/height (NUM) - specifies exactly NUM pixels So both 1 and 1.0 is one "normal character width", and it's (10) that's the pixel spec. (But I did it correctly in the code. =F0=9F=98=80) >> while inter-character justification would use 'char-spacing 1 to add an >> extra pixel after all the chars on the line, for instance.=20 > > 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. Yes, for the justification case, the algo would have to do all the computation, and I'm guessing getting at a pleasing result will depend on a lot of things. For instance, if the display is low res, we wouldn't want to do inter-character spacing at all -- unless there aren't any spaces, and then we'd have to do it after all. Etc. I think we'll just have to implement it, see what it looks like and tweak it until it's OK. > 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. Yup. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no