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: prettify-symbols-mode, derived modes, and compose-region Date: Sat, 06 Mar 2021 11:15:11 +0200 Message-ID: <83r1kswsm8.fsf@gnu.org> References: <83k0qmzit9.fsf@gnu.org> <587ee071-985b-450a-2df7-0b4bb0f97b48@posteo.net> <83eeguyt58.fsf@gnu.org> <18caf24f-fb5d-616d-fb24-393f7d2149f7@posteo.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37426"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: D Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 06 10:17:00 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 1lIT3U-0009eN-2j for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Mar 2021 10:17:00 +0100 Original-Received: from localhost ([::1]:34022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIT3T-0003we-4W for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Mar 2021 04:16:59 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIT1z-0003QL-A3 for emacs-devel@gnu.org; Sat, 06 Mar 2021 04:15:27 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36395) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIT1x-0004Vp-LR; Sat, 06 Mar 2021 04:15:25 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4550 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lIT1w-0001fm-Vq; Sat, 06 Mar 2021 04:15:25 -0500 In-Reply-To: <18caf24f-fb5d-616d-fb24-393f7d2149f7@posteo.net> (message from D on Fri, 5 Mar 2021 22:24:44 +0100) 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:266061 Archived-At: > From: D > Cc: emacs-devel@gnu.org > Date: Fri, 5 Mar 2021 22:24:44 +0100 > > > And that's even before you consider > > complex text shaping which could combine several codepoints into a > > single wide grapheme cluster. > > I don't think that using a character capable of that would be of any > use as a decorative element. I was talking about the need to align the "decorative elements" with text that includes such grapheme clusters. > > Anyway, I think it should be very easy to add a new display property > > type that would override the pixel width of a font glyph with a fixed > > value calculated in some way by a Lisp program. > > That would of course be the perfect solution. But, doesn't this have > to exist in one way or another already? For example, the checkbox > widget in custom interfaces to my knowledge visually replaces a simple > "[X]" with a bitmap. When I examine a checkbox with C-u C-x = it > seems to be the case that display does the legwork and somehow obtains > the image size from the xpm file (I suppose). In your original use case you didn't have images, you had characters. Or did I misunderstand? > Same with superstar, essentially. For example, every decorative > bullet can have a "fallback character" for terminal displays, and this > behaves correctly from the perspective of the frame you opened the > buffer with. I include a simple redisplay command for emacsclient > users for this reason. So I suppose I operate under the same > limitations as shr? Yes, I think so. And on text terminals this issue is moot anyway, because every character takes a single column (if you forget about those rare ones that take 2). > In that case, I probably should look into that character size > function. Could you point me in the right general direction? I'm not > quite sure how to find it. shr-fill-line, I guess. You can also try using font-get-glyphs, it might be more suitable for your needs. I think shr.el doesn't use it because that turned out to be slower than the current approach, but your use case is different.