all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Naheel Azawy <naheelazawy@gmail.com>
Cc: 32516@debbugs.gnu.org
Subject: bug#32516: 26.1; Reshape Arabic Characters in the Terminal
Date: Fri, 24 Aug 2018 09:28:51 +0300	[thread overview]
Message-ID: <83o9ds9t24.fsf@gnu.org> (raw)
In-Reply-To: <CAJr1c0LfR5YxiOEjOGLshAYDjgfOJxAuHrp81+_+T1FsMn6CDA@mail.gmail.com> (message from Naheel Azawy on Fri, 24 Aug 2018 00:06:19 +0300)

> From: Naheel Azawy <naheelazawy@gmail.com>
> Date: Fri, 24 Aug 2018 00:06:19 +0300
> 
> The problem occurs in the terminal mode with Arabic characters. Emacs
> handles the bidirectional text correctly in terms of direction but it
> doesn't reshape the characters depending on its location. More details
> can be seen with screenshots on my question in Emacs stack exchange:
> https://emacs.stackexchange.com/questions/44144/arabic-in-terminal-mode
> I have also written a little minor mode as workaround to this problem:
> https://github.com/Naheel-Azawy/emacs-arabic-reshaper
> but an actual solution is expected to only render the characters while
> they're displayed in the screen and not reshape the entire file as I'm
> doing with my minor mode.

Does it help to turn off auto-composition-mode?

If that doesn't help, then I'm afraid you will have to look for a
terminal emulator that supports character composition and Arabic
shaping, but can let you turn off its bidi reordering.  (PuTTY can do
that, but it's for logging from Windows into Unix systems, so AFAIK
will not run natively on Posix hosts.)

You see, Emacs supports Arabic shaping by using a shaping engine
(a.k.a. "font backend") that works with OTF/TTF fonts, which know what
glyphs are needed to represent a correctly-shaped Arabic letter or
ligature composed from certain codepoints.  But this only works on GUI
frames, because on text-mode frames, Emacs just writes the codes of
the characters to the terminal driver, it cannot specify font glyphs
to display those characters.

As you have discovered, disabling bidi-display-reordering is not the
solution, because there's much more to bidi editing support in Emacs
than just reordering characters for display.  That is why we need
bidi-aware display engine in Emacs in the first place, and cannot rely
on external solutions like what exists in Pango etc., or in terminal
emulators, for that matter.

If BiCon can let you disable its reordering, and still perform
shaping, then that's your solution.  If it doesn't, then maybe asking
its developers to provide such a feature, or coding it yourself, is
the way forward for you and other Arabic-speaking users of text-mode
frames in Emacs.

Bottom line: this isn't a bug in Emacs, this is how the code was
designed and supposed to work on TTY frames.

Of course, if someone knows a way to communicate character shaping to
a terminal driver, we could think of implementing that in Emacs.  But
does such a protocol exist?

Thanks.





  reply	other threads:[~2018-08-24  6:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-23 21:06 bug#32516: 26.1; Reshape Arabic Characters in the Terminal Naheel Azawy
2018-08-24  6:28 ` Eli Zaretskii [this message]
2018-08-24 22:25   ` Naheel Azawy
2018-08-25  7:03     ` 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

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

  git send-email \
    --in-reply-to=83o9ds9t24.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=32516@debbugs.gnu.org \
    --cc=naheelazawy@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.