unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: hossein valizadeh <valizadeh.ho@gmail.com>,
	41005@debbugs.gnu.org, nicholasdrozd@gmail.com
Subject: bug#41005: problem with rendering Persian text in Emacs 27
Date: Fri, 05 Jun 2020 13:05:43 +0000	[thread overview]
Message-ID: <87a71h1x3s.fsf@gmail.com> (raw)
In-Reply-To: <834krpbrnu.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 05 Jun 2020 15:53:09 +0300")

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: hossein valizadeh <valizadeh.ho@gmail.com>
>> Date: Fri, 5 Jun 2020 17:02:55 +0430
>> Cc: pipcet@gmail.com, 41005@debbugs.gnu.org, 
>> 	Nicholas Drozd <nicholasdrozd@gmail.com>
>> 
>> I'm sorry, my English is so bad, at least in writing. That's why it's
>> hard for me to give a full explanation.
>
> Your English is entirely adequate, there's nothing for you to be
> ashamed of.
>
> Thanks for the details, I think they point to the code identified by
> Pip Cet, which is called from current-column and similar APIs.  A fix
> will probably be available soon.

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.

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.

Or am I missing something?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Test-patch-for-bug-41005.patch --]
[-- Type: text/x-diff, Size: 1605 bytes --]

From 18d0e15ac298f40951ddeeec56e9d87c01f51798 Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@gmail.com>
Date: Fri, 5 Jun 2020 12:54:01 +0000
Subject: [PATCH] Test patch for bug#41005

---
 src/composite.c | 4 +++-
 src/indent.c    | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/composite.c b/src/composite.c
index 2c589e4f3a..13421a80da 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -1213,7 +1213,9 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos,
 	continue;
       if (charpos < endpos)
 	{
-	  if ((bidi_level & 1) == 0)
+	  if (bidi_level < 0)
+	    direction = Qnil;
+	  else if ((bidi_level & 1) == 0)
 	    direction = QL2R;
 	  else
 	    direction = QR2L;
diff --git a/src/indent.c b/src/indent.c
index c0b4c13b2c..581323b91e 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -596,7 +596,7 @@ scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol, ptrdiff_t *prevcol)
       if (cmp_it.id >= 0
 	  || (scan == cmp_it.stop_pos
 	      && composition_reseat_it (&cmp_it, scan, scan_byte, end,
-					w, NEUTRAL_DIR, NULL, Qnil)))
+					w, -1, NULL, Qnil)))
 	composition_update_it (&cmp_it, scan, scan_byte, Qnil);
       if (cmp_it.id >= 0)
 	{
@@ -1504,7 +1504,7 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, EMACS_INT fromvpos,
 	  if (cmp_it.id >= 0
 	      || (pos == cmp_it.stop_pos
 		  && composition_reseat_it (&cmp_it, pos, pos_byte, to, win,
-					    NEUTRAL_DIR, NULL, Qnil)))
+					    -1, NULL, Qnil)))
 	    composition_update_it (&cmp_it, pos, pos_byte, Qnil);
 	  if (cmp_it.id >= 0)
 	    {
-- 
2.27.0.rc0


  reply	other threads:[~2020-06-05 13:05 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 18:02 bug#41005: problem with rendering Persian text in Emacs 27 hossein valizadeh
2020-05-01 18:51 ` Eli Zaretskii
     [not found]   ` <CAMyfNNp7FiFgAN5EVcVauawiy8ZB7U+eKY7qOeqZOnbMQfs5iQ@mail.gmail.com>
2020-06-03 14:34     ` Eli Zaretskii
2020-06-03 17:24 ` Nicholas Drozd
2020-06-03 18:01   ` Eli Zaretskii
2020-06-04  2:39     ` hossein valizadeh
2020-06-04  3:01       ` hossein valizadeh
2020-06-04  4:01         ` Eli Zaretskii
2020-06-04  4:10           ` Eli Zaretskii
2020-06-04  6:27             ` hossein valizadeh
2020-06-04  8:28               ` Pip Cet
2020-06-04 13:15                 ` Eli Zaretskii
2020-06-04 19:52                   ` Pip Cet
2020-06-05  4:46                     ` hossein valizadeh
2020-06-05  6:21                       ` Eli Zaretskii
2020-06-05 11:07                         ` Basil L. Contovounesios
2020-06-05 12:32                         ` hossein valizadeh
2020-06-05 12:53                           ` Eli Zaretskii
2020-06-05 13:05                             ` Pip Cet [this message]
2020-06-05 14:13                               ` Eli Zaretskii
2020-06-06  8:38                                 ` Pip Cet
2020-06-06  9:04                                   ` Eli Zaretskii
2020-06-06  9:11                                     ` Pip Cet
2020-06-06  9:24                                       ` Eli Zaretskii
2020-06-06 13:09                                         ` Pip Cet
2020-06-05 14:23                               ` hossein valizadeh
2020-06-05 14:25                                 ` Eli Zaretskii
2020-06-05  6:39                       ` Pip Cet
2020-06-05  8:01                     ` Eli Zaretskii
2020-06-05  8:41                       ` Pip Cet
2020-06-05 11:42                         ` Eli Zaretskii
2020-07-21 12:40                           ` Amin Bandali
2020-07-21 13:34                             ` Robert Pluim
2020-07-21 17:53                               ` Amin Bandali
2020-07-21 18:27                                 ` Eli Zaretskii
2020-07-22  2:12                                   ` Amin Bandali
2020-07-22 14:20                                     ` Eli Zaretskii
2020-07-24  4:11                                       ` Amin Bandali
2020-07-24  6:09                                         ` Eli Zaretskii
2020-07-25  4:19                                           ` Amin Bandali
2020-07-25  6:48                                             ` Eli Zaretskii
2020-07-25 15:53                                               ` Amin Bandali
2020-07-25 16:28                                                 ` Eli Zaretskii
2020-07-25 16:44                                                   ` Amin Bandali
2020-07-25 16:56                                                     ` Eli Zaretskii

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=87a71h1x3s.fsf@gmail.com \
    --to=pipcet@gmail.com \
    --cc=41005@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=nicholasdrozd@gmail.com \
    --cc=valizadeh.ho@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).