From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!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, 06 Jan 2019 17:50:54 +0200 Message-ID: <83y37xzswx.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> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1546789812 30464 195.159.176.226 (6 Jan 2019 15:50:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 6 Jan 2019 15:50:12 +0000 (UTC) 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 06 16:50:08 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 esmtp (Exim 4.84_2) (envelope-from ) id 1ggAgf-0007k3-Gi for geb-bug-gnu-emacs@m.gmane.org; Sun, 06 Jan 2019 16:50:05 +0100 Original-Received: from localhost ([127.0.0.1]:36857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggAim-0003nD-8I for geb-bug-gnu-emacs@m.gmane.org; Sun, 06 Jan 2019 10:52:16 -0500 Original-Received: from eggsout.gnu.org ([209.51.188.92]:49008 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggAid-0003n7-NQ for bug-gnu-emacs@gnu.org; Sun, 06 Jan 2019 10:52:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ggAiY-0000k5-MJ for bug-gnu-emacs@gnu.org; Sun, 06 Jan 2019 10:52:07 -0500 Original-Received: from debbugsout.gnu.org ([209.51.188.43]:41294) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ggAiY-0000jt-Il for bug-gnu-emacs@gnu.org; Sun, 06 Jan 2019 10:52:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ggAiY-0007m6-AH for bug-gnu-emacs@gnu.org; Sun, 06 Jan 2019 10:52: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, 06 Jan 2019 15:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33729 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33729-submit@debbugs.gnu.org id=B33729.154678987829819 (code B ref 33729); Sun, 06 Jan 2019 15:52:02 +0000 Original-Received: (at 33729) by debbugs.gnu.org; 6 Jan 2019 15:51:18 +0000 Original-Received: from localhost ([127.0.0.1]:48959 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ggAhp-0007kt-Jg for submit@debbugs.gnu.org; Sun, 06 Jan 2019 10:51:17 -0500 Original-Received: from eggsout.gnu.org ([209.51.188.92]:57199) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ggAho-0007km-Nr for 33729@debbugs.gnu.org; Sun, 06 Jan 2019 10:51:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ggAhi-00007v-T8 for 33729@debbugs.gnu.org; Sun, 06 Jan 2019 10:51:16 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggAhi-00007m-Q1; Sun, 06 Jan 2019 10:51:10 -0500 Original-Received: from [176.228.60.248] (port=4350 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ggAhi-0003Lw-A4; Sun, 06 Jan 2019 10:51:10 -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] [fuzzy] 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:154191 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). 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?