unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Khaled Hosny <dr.khaled.hosny@gmail.com>
Cc: behdad@behdad.org, far.nasiri.m@gmail.com, 33729@debbugs.gnu.org
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	[thread overview]
Message-ID: <83lg363u3i.fsf@gnu.org> (raw)
In-Reply-To: <20190105205314.GA28761@macbook.localdomain> (message from Khaled Hosny on Sat, 5 Jan 2019 22:53:14 +0200)

> Date: Sat, 5 Jan 2019 22:53:14 +0200
> From: Khaled Hosny <dr.khaled.hosny@gmail.com>
> 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





  parent reply	other threads:[~2019-01-27 17:09 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13 20:20 bug#33729: 27.0.50; Partial glyphs not rendered for Gujarati with Harfbuzz enabled (renders fine using m17n) Kaushal Modi
2018-12-13 20:25 ` Kaushal Modi
2018-12-13 20:31   ` Khaled Hosny
2018-12-13 20:43     ` Kaushal Modi
2018-12-13 20:53       ` Khaled Hosny
2018-12-13 21:04         ` Kaushal Modi
2018-12-14  5:57       ` Eli Zaretskii
2018-12-14  7:48         ` Eli Zaretskii
2018-12-14  7:50         ` Khaled Hosny
2018-12-14 10:03           ` Eli Zaretskii
2018-12-14 11:03             ` Khaled Hosny
2018-12-14 13:42               ` Eli Zaretskii
2018-12-14 15:25                 ` Eli Zaretskii
2018-12-17  0:30                   ` Glenn Morris
2018-12-17 15:55                     ` Eli Zaretskii
2018-12-20 18:58                       ` Eli Zaretskii
2018-12-20 20:45                         ` Behdad Esfahbod
2018-12-22  8:54                       ` Khaled Hosny
2018-12-22  9:06                         ` Khaled Hosny
2018-12-22 10:11                           ` Eli Zaretskii
2018-12-22 15:15                             ` Khaled Hosny
2018-12-22 15:27                               ` Behdad Esfahbod
2018-12-22 15:42                                 ` Khaled Hosny
2018-12-22 15:42                               ` Eli Zaretskii
2018-12-22 15:49                                 ` Khaled Hosny
2018-12-22 16:33                                   ` Eli Zaretskii
2018-12-22 19:38                                   ` Eli Zaretskii
2018-12-22 20:59                                     ` Khaled Hosny
2018-12-23  3:34                                       ` Eli Zaretskii
2018-12-23 13:51                                         ` Khaled Hosny
2018-12-23 16:00                                           ` Eli Zaretskii
2018-12-24  2:08                                             ` Khaled Hosny
2018-12-24  4:12                                               ` Kaushal Modi
2018-12-24 16:10                                               ` Eli Zaretskii
2018-12-24 17:37                                                 ` Khaled Hosny
2018-12-24 18:07                                                   ` Eli Zaretskii
2019-01-05 21:15                                                     ` Khaled Hosny
2019-01-06 16:03                                                       ` Eli Zaretskii
2019-01-27 17:12                                                         ` Eli Zaretskii
2019-01-29 22:25                                                           ` Khaled Hosny
2018-12-29 14:49                                                   ` Eli Zaretskii
2019-01-05 20:53                                                     ` Khaled Hosny
2019-01-05 21:04                                                       ` Khaled Hosny
2019-01-06 17:54                                                         ` Eli Zaretskii
2019-01-27 17:12                                                           ` Eli Zaretskii
2019-01-29 22:33                                                           ` Khaled Hosny
2019-01-06 15:50                                                       ` Eli Zaretskii
2019-01-29 22:29                                                         ` Khaled Hosny
2022-04-29 12:47                                                           ` Lars Ingebrigtsen
2022-04-29 13:24                                                             ` Eli Zaretskii
2019-01-27 17:09                                                       ` Eli Zaretskii [this message]
2018-12-24 17:38                           ` Benjamin Riefenstahl
2018-12-14 22:47                 ` Khaled Hosny
2018-12-16 14:47               ` Benjamin Riefenstahl
2018-12-14  6:45 ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83lg363u3i.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=33729@debbugs.gnu.org \
    --cc=behdad@behdad.org \
    --cc=dr.khaled.hosny@gmail.com \
    --cc=far.nasiri.m@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).