From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#33729: 27.0.50; Partial glyphs not rendered for Gujarati with Harfbuzz enabled (renders fine using m17n) Date: Sun, 27 Jan 2019 19:09:53 +0200 Message-ID: <83lg363u3i.fsf@gnu.org> References: <20181222154945.GE2244@macbook.localdomain> <83bm5d9wsc.fsf@gnu.org> <20181222205948.GF2244@macbook.localdomain> <838t0gapcj.fsf@gnu.org> <20181223135109.GA6568@macbook.localdomain> <83va3k8c79.fsf@gnu.org> <20181224020847.GC6568@macbook.localdomain> <83lg4e9a7q.fsf@gnu.org> <20181224173723.GH6568@macbook.localdomain> <838t085qx8.fsf@gnu.org> <20190105205314.GA28761@macbook.localdomain> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="3449"; mail-complaints-to="usenet@blaine.gmane.org" Cc: behdad@behdad.org, far.nasiri.m@gmail.com, 33729@debbugs.gnu.org To: Khaled Hosny Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 27 18:11:18 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gnnxl-0000lr-6G for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 Jan 2019 18:11:17 +0100 Original-Received: from localhost ([127.0.0.1]:48296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnnxj-0005vS-Tp for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 Jan 2019 12:11:15 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnnxY-0005tE-Ib for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 12:11:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gnnxW-00005N-Jt for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 12:11:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48550) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gnnxW-0008WE-B9 for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 12:11:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gnnxW-0001rQ-6H for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 12:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Jan 2019 17:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33729 X-GNU-PR-Package: emacs Original-Received: via spool by 33729-submit@debbugs.gnu.org id=B33729.15486090187098 (code B ref 33729); Sun, 27 Jan 2019 17:11:02 +0000 Original-Received: (at 33729) by debbugs.gnu.org; 27 Jan 2019 17:10:18 +0000 Original-Received: from localhost ([127.0.0.1]:47831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnnwn-0001qQ-Va for submit@debbugs.gnu.org; Sun, 27 Jan 2019 12:10:18 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnnwm-0001qB-HD for 33729@debbugs.gnu.org; Sun, 27 Jan 2019 12:10:16 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36518) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnnwh-0007oL-7P; Sun, 27 Jan 2019 12:10:11 -0500 Original-Received: from [176.228.60.248] (port=1227 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gnnwg-0000GT-Am; Sun, 27 Jan 2019 12:10:11 -0500 In-reply-to: <20190105205314.GA28761@macbook.localdomain> (message from Khaled Hosny on Sat, 5 Jan 2019 22:53:14 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:154817 Archived-At: > Date: Sat, 5 Jan 2019 22:53:14 +0200 > From: Khaled Hosny > Cc: far.nasiri.m@gmail.com, behdad@behdad.org, 33729@debbugs.gnu.org > > > Done. Please test. I made sure it compiles, but I couldn't actually > > test the results, as I don't have access to a GNU/Linux system with > > GUI display. So it could be that I misunderstood the Harfbuzz APIs, > > as I was essentially flying blind, guided only by the Harfbuzz docs. > > It seems to work, but still not quite right. You seem to be passing the > paragraph direction, but what HarfBuzz needs is resolved direction of > the text (i.e. the bidi embedding level of the run). In other words, if > Emacs is going to draw this text from right to left, then HarfBuzz must > shape it in right to left direction. Both should use the same direction > all the time and HarfBuzz direction guessing should never be used (i.e. > always pass to it an explicit direction). In response to that, I wrote: It isn't the paragraph direction; at least it wasn't supposed to be that. The code is (or was before your changes): if (charpos < endpos) { if (pdir == L2R) direction = QL2R; else if (pdir == R2L) direction = QR2L; [...] cmp_it->reversed_p = 0; } else { [...] cmp_it->reversed_p = 1; [...] if (pdir == L2R) direction = QR2L; else if (pdir == R2L) direction = QL2R; [...] } So, as you see, when the paragraph direction is L2R, normal text gets L2R direction, while test reversed for display gets R2L, and the other way around when the paragraph direction is R2L. Which AFAIU is what HarfBuzz needs, but maybe I'm missing something. Did you actually see incorrect display with the code I wrote? If so, could you please show the recipes for reproducing that, preferably with screenshots of correct and incorrect display? I'd like to look into that, to understand what I missed. > HarfBuzz direction guessing should never be used (i.e. always pass > to it an explicit direction). This is in general impossible (or at least very hard), since the shaper is sometimes called from Lisp without any display context. See the Lisp callers of the function font-shape-gstring. One use case is when we want to display the composition information for a grapheme cluster to the user, see descr-text.el (used by the "C-u C-x =" command). In these cases, the UBA is not invoked, and so we don't have the direction information. I could provide the direction information in this case by using the directionality of the base character of the grapheme cluster, but I figured out that HarfBuzz already does this as part of its guessing. Doesn't it? > I pushed a couple of commits that does this based on my limited > understanding of Emacs code, please check. Thanks. Do you see any difference in the results? If so, can you please show the text you used and the results of shaping it with both versions. AFAIU, your code should produce exactly the same results, unless I'm missing something. (I didn't want to use the resolved_level attribute because it is ephemeral, and might not provide the correct value where we are using it.) Btw, did you test both paragraph directions (controlled by the bidi-paragraph-direction variable), and also text inside directional override which changes its natural direction? Could you please respond and answer the few questions I asked? I'd like us to continue working on the branch. TIA