From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)) Date: Wed, 20 May 2020 18:18:35 +0300 Message-ID: <83blmi7hys.fsf@gnu.org> References: <20200517165953.000044d2@web.de> <83lflqblp0.fsf@gnu.org> <83ftbybio3.fsf@gnu.org> <83zha69xs2.fsf@gnu.org> <83367x9qeq.fsf@gnu.org> <0ccae2a4-533b-d15c-2884-c2f00b067776@gmail.com> <83wo5987mk.fsf@gnu.org> <99d4beed-88ae-b5cd-3ecb-a44325c8a1dc@gmail.com> <20200518215908.GA57594@breton.holly.idiocy.org> <83mu6481v3.fsf@gnu.org> <75a90563-51b4-d3b8-4832-fc0e2542af0d@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="49904"; mail-complaints-to="usenet@ciao.gmane.io" Cc: cpitclaudel@gmail.com, alan@idiocy.org, emacs-devel@gnu.org To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed May 20 17:32:21 2020 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 1jbQhg-000CsQ-Uu for ged-emacs-devel@m.gmane-mx.org; Wed, 20 May 2020 17:32:20 +0200 Original-Received: from localhost ([::1]:49508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbQhf-0007Bh-Vq for ged-emacs-devel@m.gmane-mx.org; Wed, 20 May 2020 11:32:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbQgp-0006kb-Op for emacs-devel@gnu.org; Wed, 20 May 2020 11:31:27 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:51252) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbQgn-0004mz-95; Wed, 20 May 2020 11:31:26 -0400 Original-Received: from [176.228.60.248] (port=1515 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jbQUO-0007Gg-QK; Wed, 20 May 2020 11:18:37 -0400 In-Reply-To: (message from Pip Cet on Tue, 19 May 2020 21:43:49 +0000) 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:251065 Archived-At: > From: Pip Cet > Date: Tue, 19 May 2020 21:43:49 +0000 > Cc: Eli Zaretskii , Alan Third , emacs-devel@gnu.org > > And I'm afraid the difference is much more obvious with box cursors > than it is with carets. I'm attaching a screenshot of a patched Emacs > displaying "ffi", with point on the second f, in the "Linux Libertine > Display O" font (using approximately equal slices). > > I think this is a bit of a worst-case scenario, a three-letter > ligature in a font using ligatures and overhangs very > enthusiastically. It might be okay for other fonts. I'm not sure this is the worst case. It might be the worst case if we are talking about ligatures that involve only ASCII characters, and don't involve symbols like ==> that gets converted to ⇒. But in general, there are worse cases, like á (two codepoints). And for kicks see the Khmer hello in etc/HELLO, where you can find 4 codepoints that produce a grapheme cluster made of 3 glyphs. If we only want this feature for ASCII ligatures, then it sounds like a limitation to me (and frankly, somewhat unclean as features go), but if we really want this only for these limited cases, we will need to somehow indicate to the display engine which ligatures are to be handled like this and which aren't. > My remaining idea is to stretch characters so we can break up a > ligature without changing its total width. I'm not sure how to do > that, though. I don't think I understand what you'd like to do. Can you elaborate? > (I'm also attaching the patch, for the morbidly curious; it isn't > clean, readable, or finished in any way, and contains at least one > obvious bug. It's just good enough to produce the screenshot, and > maybe it can serve as a hint as to which files need changing for > ligatures to work; but such changes would have to be done very > differently from the patch.). Right, the actual implementation will have to be different. In particular, I think that if ligatures will use automatic compositions, the information you need is already stored in the composition table and reachable from the glyph string, so you don't need to invoke the shaper again. I see you implemented this for static compositions, which are semi-obsolete. Also, I don't see the code which moves point inside the ligature; Emacs will not allow doing that by default. In particular, how did you tell the display code to show the cursor on the middle 'f', not on the first one? Did I miss something? And finally, you said you intended to do this via row->clip, but this patch does something very different. What changed your mind? Thanks.