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.bugs Subject: bug#41005: problem with rendering Persian text in Emacs 27 Date: Fri, 05 Jun 2020 17:13:27 +0300 Message-ID: <831rmtbny0.fsf@gnu.org> References: <831rmwc9ke.fsf@gnu.org> <35A46479-A62C-42FF-995B-B295FE3408C0@gnu.org> <08A9D65F-0C9C-4EE2-B3B9-2AA25BFFAD54@gnu.org> <878sh35j6f.fsf@gmail.com> <83y2p3as6c.fsf@gnu.org> <87pnae4nhx.fsf@gmail.com> <83lfl2av8z.fsf@gnu.org> <834krpbrnu.fsf@gnu.org> <87a71h1x3s.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="124937"; mail-complaints-to="usenet@ciao.gmane.io" Cc: valizadeh.ho@gmail.com, 41005@debbugs.gnu.org, nicholasdrozd@gmail.com To: Pip Cet Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 05 16:14:10 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1jhD6n-000WOn-R9 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Jun 2020 16:14:09 +0200 Original-Received: from localhost ([::1]:57104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jhD6m-000812-U6 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Jun 2020 10:14:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jhD6g-00080v-Qi for bug-gnu-emacs@gnu.org; Fri, 05 Jun 2020 10:14:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38029) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jhD6g-0006Zo-Hd for bug-gnu-emacs@gnu.org; Fri, 05 Jun 2020 10:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jhD6g-00077p-DX for bug-gnu-emacs@gnu.org; Fri, 05 Jun 2020 10:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Jun 2020 14:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41005 X-GNU-PR-Package: emacs Original-Received: via spool by 41005-submit@debbugs.gnu.org id=B41005.159136642627358 (code B ref 41005); Fri, 05 Jun 2020 14:14:02 +0000 Original-Received: (at 41005) by debbugs.gnu.org; 5 Jun 2020 14:13:46 +0000 Original-Received: from localhost ([127.0.0.1]:49575 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhD6P-00077C-UT for submit@debbugs.gnu.org; Fri, 05 Jun 2020 10:13:46 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:32982) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhD6O-00076z-Ni for 41005@debbugs.gnu.org; Fri, 05 Jun 2020 10:13:44 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:37353) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jhD6J-0006Ym-Ff; Fri, 05 Jun 2020 10:13:39 -0400 Original-Received: from [176.228.60.248] (port=4173 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jhD6I-0002Bz-7U; Fri, 05 Jun 2020 10:13:38 -0400 In-Reply-To: <87a71h1x3s.fsf@gmail.com> (message from Pip Cet on Fri, 05 Jun 2020 13:05:43 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181563 Archived-At: > From: Pip Cet > Cc: hossein valizadeh , 41005@debbugs.gnu.org, > nicholasdrozd@gmail.com > Date: Fri, 05 Jun 2020 13:05:43 +0000 > > I think the attached patch is a fairly minimal fix; it's against master, > applies to emacs-27 but I haven't tested it there. Thanks, it LGTM. I think we should put this on emacs-27, because this is a regression caused by Emacs 27's support for HarfBuzz as the default shaping engine. The other shapers didn't want us to provide the direction, they determined it internally. We added the DIRECTION argument as part of integrating HarfBuzz. We could do better than your patch by actually computing the resolved bidi level there, which would require start_display followed by move_it_to, in which case we probably won't need to call composition_reseat_it by hand at all, and could just pick up the result produced by move_it_to. Or maybe we should just use Fvertical_motion instead (which does all that internally). But these ideas are for the master branch, not for emacs-27. > Given these two bugs, I wonder whether it wouldn't be more reasonable > always to let HarfBuzz guess the direction, at least for Emacs-27: > scripts which change direction, if they are supported by HarfBuzz, won't > work anyway. Please explain "scripts that change direction" and "won't work anyway", I don't think I understand that part. The reason we don't let HarfBuzz guess in all cases is because the resolved bidi level, when we have it, is a more accurate indication of the required direction. For example, if you have RTL characters inside the LRO..PDF embedding, it would be wrong to let the shaper guess, because it could (and usually will) guess wrongly that the direction is R2L. It is true that these are rare and unusual use cases, but they do exist, and Emacs does want to support them, including with scripts that must use the shaping engine.