From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.bugs Subject: bug#41005: problem with rendering Persian text in Emacs 27 Date: Sat, 06 Jun 2020 09:11:36 +0000 Message-ID: <875zc4zhh3.fsf@gmail.com> 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> <831rmtbny0.fsf@gnu.org> <87d06czj00.fsf@gmail.com> <831rmsa7ln.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="121544"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: valizadeh.ho@gmail.com, 41005@debbugs.gnu.org, nicholasdrozd@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 06 11:12: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 1jhUs5-000VRG-RX for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Jun 2020 11:12:09 +0200 Original-Received: from localhost ([::1]:35488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jhUs4-00042X-Ev for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Jun 2020 05:12:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jhUry-00042P-GR for bug-gnu-emacs@gnu.org; Sat, 06 Jun 2020 05:12:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39168) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jhUry-00012n-1r for bug-gnu-emacs@gnu.org; Sat, 06 Jun 2020 05:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jhUrx-0007al-U5 for bug-gnu-emacs@gnu.org; Sat, 06 Jun 2020 05:12:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Jun 2020 09:12:01 +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.159143471229165 (code B ref 41005); Sat, 06 Jun 2020 09:12:01 +0000 Original-Received: (at 41005) by debbugs.gnu.org; 6 Jun 2020 09:11:52 +0000 Original-Received: from localhost ([127.0.0.1]:50714 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhUro-0007aL-I0 for submit@debbugs.gnu.org; Sat, 06 Jun 2020 05:11:52 -0400 Original-Received: from mail-wm1-f46.google.com ([209.85.128.46]:33039) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhUrl-0007a8-Km for 41005@debbugs.gnu.org; Sat, 06 Jun 2020 05:11:50 -0400 Original-Received: by mail-wm1-f46.google.com with SMTP id j198so10679394wmj.0 for <41005@debbugs.gnu.org>; Sat, 06 Jun 2020 02:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=h/fxcdETzM+vXtcGi7jHsKh/fYHiqQzTnReLk2T/82Y=; b=plM+e8m667h7Y3KaKTgqNzt9XTB5nJ/LmILO2QcfcT8/AulB1GdZCwzHJScZOdeK2B 8+sPxZYn3hlfcnkYhloarpoO61DR2gYc43nuxlhMHBC52zCJK/K6O/BDfzlA7I9Lf0KS 8D+T5LpomMPi4aCF8HMHq/+ui8aYS7kz0KuyoCR98OTMTKI7/v5sJ52FV6S4Ac5x9poT bE3ImrOKq+bge2MonydyoS82G7kuwriFbb/TjqCFP4k9qH0owLgxVU8FBtSGFTd0Tnzm TBwRx7CgrwgpuFIkGfnZZvggdAw2ly0u0xKuG/woiIBx2MuNpCZkn0d1UaGHmJz+POi+ R0EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=h/fxcdETzM+vXtcGi7jHsKh/fYHiqQzTnReLk2T/82Y=; b=uDDcdzl4tCNbeh578RhjUlenEvXqIb/QG01KUimaSRag16Hl6bR/JZSseZUcPfB1gi rheZgXFAmdWSwyoK3BuUdKKJu3MAwmSF7s4gDx/EyVszVxRmUGLZai/Bjaam7KDnQ62n 47G7/tWdRxTut96+hnl5sy/A13qroJTI30aujHNqaVbPUY23jUOFS25NxYXXoMca7DbJ fFX0/tXfcUL4pMadsI+Z4Utyr+MGOgWc8Nbyx4oHiC1dnsO6ivDE9K6qczIn/xwci/Wx 4Jlh09HD+gy09nXJg6U+bOn2jc2OfBc9fHptVGeQ4PNczfbxQz1uQ2Ubgo7vHk+LXORX zA2w== X-Gm-Message-State: AOAM5301MNmKFPgd16GkYBzU7LPmYv8BnlMS1O5HKT47Vrx7S6pxV8mr lW15LBrSj7O7+QWvtI+olwE= X-Google-Smtp-Source: ABdhPJwSv1/pF1IEk/F3WhZW+8GXLZZA8Gn+AWtsAQnhmydc9cNgoyCbz0Bi27smPKcX4ta16GL1jQ== X-Received: by 2002:a1c:c3d7:: with SMTP id t206mr6712480wmf.69.1591434703664; Sat, 06 Jun 2020 02:11:43 -0700 (PDT) Original-Received: from chametz (tor-exit-7.zbau.f3netze.de. [185.220.100.246]) by smtp.gmail.com with ESMTPSA id y5sm16182832wrs.63.2020.06.06.02.11.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jun 2020 02:11:43 -0700 (PDT) In-Reply-To: <831rmsa7ln.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 06 Jun 2020 12:04:04 +0300") 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:181601 Archived-At: Eli Zaretskii writes: >> From: Pip Cet >> Cc: valizadeh.ho@gmail.com, 41005@debbugs.gnu.org, nicholasdrozd@gmail.com >> Date: Sat, 06 Jun 2020 08:38:39 +0000 >> >> >> 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: ~~~~~~~~~~~~~~~~~~~~~ I should have been clearer here and said I was only concerned with 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. >> >> I think your example (RLO..PDF in RTL text) is better: that won't work >> anyway, right now, because if, for example, you type >> >> f i >> >> and have set the char table to treat "fi" as a ligature, the result will >> (at least sometimes) be an "fi" ligature, but it should look like the >> word "if". > > That's not how shaping engines work, at least not how HarfBuzz does > AFAIU. It gets the characters in the logical order, so it always > wants to see "fi", even if the directionality of the characters was > overridden, and it also wants to know the local text directionality. > What is produced from that depends on the font: if it has different > ligatures for "fi" in different directions, then HarfBuzz should give > us back the ligature appropriate for the direction it was passed. > > (Personally, I think that when some text uses a directional override, > they don't intend to see ligatures, because the override is mostly for > treating characters as independent of the surrounding context. But > this is eventually up to the font to specify. AFAIU, Arabic shaping > works differently in different directional contexts, for example.) > >> > 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. >> >> Yes, but we'll still cache the wrong direction. > > Why "wrong"? We will cache the same direction as we passed to > HarfBuzz, and thus the produced glyphs will be consistent with the > cached direction. And if we ever need to display the same sequence of > characters with a different direction, the cached sequence will fail > to match, and we will call HarfBuzz again to produce glyphs for this > other direction. That sounds TRT to me. You're absolutely correct, sorry for wasting so much of your time with this: caching directions is the right thing, I was just concerned about what to do in Emacs 27 where AIUI we don't want to cache directions... > Once the caching of direction is > implemented, my point is that passing the direction to HarfBuzz and > caching it will produce better results for text in a directional > override than if we let HarfBuzz guess the direction. Again, I agree. Sorry for the misunderstanding.