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: Ligature support Date: Sat, 06 Nov 2021 11:49:37 +0200 Message-ID: <83lf21bolq.fsf@gnu.org> References: <83tugqd488.fsf@gnu.org> <87zgqiiq8c.fsf@gnus.org> <83r1bud3or.fsf@gnu.org> <87r1buipf5.fsf@gnus.org> <83o86yd0ig.fsf@gnu.org> <87a6iiimay.fsf@gnus.org> <20211105171356.GB24570@tuxteam.de> <83ee7uct47.fsf@gnu.org> <20211105195245.GC24570@tuxteam.de> <838ry2cpl4.fsf@gnu.org> <20211106091625.GB18911@tuxteam.de> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4472"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: tomas@tuxteam.de Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 06 10:50:45 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 1mjILV-00010U-5a for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Nov 2021 10:50:45 +0100 Original-Received: from localhost ([::1]:36564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mjILT-0004BP-Ca for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Nov 2021 05:50:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjIKg-0003Ud-MN for emacs-devel@gnu.org; Sat, 06 Nov 2021 05:49:54 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:39468) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjIKf-00013R-OY; Sat, 06 Nov 2021 05:49:53 -0400 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=9uGJybu4gy6Pm/Bbenf8LyhK2LkojcwKWtrHUWrtYno=; b=rdWL7UUYriWX bSiCxS9emhPjU2C1bON2wvcV29YJsykA8hreLW291NxkKIHeUD/6u1S7y/j9JvwTN+VKFx/EOzyAQ JzNasQn3JWie2ZsP/XNj+xMq4n2N2lBI1xw1KWSJxBSZT6BfmT9fw5b42ZRiNmgEdvXGMG8YkNJ31 ySbe04qP+4G9BTgM5QcSckgDjbY3p6LeH62+Qc4FkDfc4g0nKlbECG8iO/OS/DmL0G/CZMRr0hLNE NXxpgfJwGon5NpgPkae9TJWgWlP/7AK3WnCrWqlM4sOTjWfT4bNnMMzCp2e+8XwlPa8praLDr5Z1y l+VrCVYG/ZXW4J7/vvyl4Q==; Original-Received: from [87.69.77.57] (port=1108 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 1mjIKf-0001uF-7i; Sat, 06 Nov 2021 05:49:53 -0400 In-Reply-To: <20211106091625.GB18911@tuxteam.de> (tomas@tuxteam.de) 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:278853 Archived-At: > Date: Sat, 6 Nov 2021 10:16:25 +0100 > From: tomas@tuxteam.de > Cc: emacs-devel@gnu.org > > > > > We do pass the language to HarfBuzz when we think we know it, but the > > > > problem is Emacs itself has no good notion of the "current language". > > > > > > This is what I was pointing at. > > > > Well, don't just point to the obvious: better sit down and code some > > features that we can use to be smarter ;-) > > > > > If the text itself is multilingual, your best bet is to ask the user > > > > Asking the user during redisplay is a non-starter. > [...] > In short, there are languages where "asking the user" is just the > only option; that means that the feature only makes sense while > typesetting (where you /can/ ask the user) and not while rendering > dynamically (the "redisplay" case we are treating here). I thought you were suggesting to ask the user about the language pertinent to a particular chunk of text. Regarding ligatures in general: of course, the user should be able to say whether the ligatures are wanted, and be able to select which of the ligatures are and which aren't. The issue at hand was that ligatures are language sensitive, and we don't have a good notion of the language of the text. > > > and your second-best bet is to do some statistical heuristics, which > > > only will "work" for a longer stretch of text. > > > > That's a waste of CPU cycles: when we don't know the language, we ask > > HarfBuzz to guess, and I trust HarfBuzz that it can guess as well or > > better as we can. > > I haven't looked into it, but I wonder what magic it uses, if it > isn't some variation of "maximum likelihood over n-gram statistics". Nothing of the kind, AFAIU: it just looks at the script of the characters. But it sounds strange to me to have Emacs use n-gram statistics during display. We should collect the relevant data from other sources.